Automated dotnet-format update

This commit is contained in:
github-actions-dotnet-formatter[bot] committed 2020-12-04 15:12:55 +00:00
1 parent ad4c2f68aa
commit 2af18c2d38
165 files changed
+1053 -1051

No files matched your search

@@ -1,8 +1,8 @@
namespace HandyControlDemo.Data namespace HandyControlDemo.Data
{ {
public class MessageToken public class MessageToken
{ {
public static readonly string LoadShowContent = nameof(LoadShowContent); public static readonly string LoadShowContent = nameof(LoadShowContent);
public static readonly string FullSwitch = nameof(FullSwitch); public static readonly string FullSwitch = nameof(FullSwitch);
@@ -35,224 +35,224 @@ namespace HandyControlDemo.Properties.Langs
Mode = BindingMode.OneWay Mode = BindingMode.OneWay
}); });
private void UpdateLangs() private void UpdateLangs()
{ {
OnPropertyChanged(nameof(About)); OnPropertyChanged(nameof(About));
OnPropertyChanged(nameof(AddItem)); OnPropertyChanged(nameof(AddItem));
OnPropertyChanged(nameof(AnimationPath)); OnPropertyChanged(nameof(AnimationPath));
OnPropertyChanged(nameof(AppClosingTip)); OnPropertyChanged(nameof(AppClosingTip));
OnPropertyChanged(nameof(Ask)); OnPropertyChanged(nameof(Ask));
OnPropertyChanged(nameof(Badge)); OnPropertyChanged(nameof(Badge));
OnPropertyChanged(nameof(BasicInfo)); OnPropertyChanged(nameof(BasicInfo));
OnPropertyChanged(nameof(BasicLayout)); OnPropertyChanged(nameof(BasicLayout));
OnPropertyChanged(nameof(Blink)); OnPropertyChanged(nameof(Blink));
OnPropertyChanged(nameof(Blog)); OnPropertyChanged(nameof(Blog));
OnPropertyChanged(nameof(Border)); OnPropertyChanged(nameof(Border));
OnPropertyChanged(nameof(Brush)); OnPropertyChanged(nameof(Brush));
OnPropertyChanged(nameof(Button)); OnPropertyChanged(nameof(Button));
OnPropertyChanged(nameof(ButtonCustom)); OnPropertyChanged(nameof(ButtonCustom));
OnPropertyChanged(nameof(ButtonGroup)); OnPropertyChanged(nameof(ButtonGroup));
OnPropertyChanged(nameof(Calendar)); OnPropertyChanged(nameof(Calendar));
OnPropertyChanged(nameof(CalendarWithClock)); OnPropertyChanged(nameof(CalendarWithClock));
OnPropertyChanged(nameof(Card)); OnPropertyChanged(nameof(Card));
OnPropertyChanged(nameof(Carousel)); OnPropertyChanged(nameof(Carousel));
OnPropertyChanged(nameof(ChangeLangAsk)); OnPropertyChanged(nameof(ChangeLangAsk));
OnPropertyChanged(nameof(ChatBubble)); OnPropertyChanged(nameof(ChatBubble));
OnPropertyChanged(nameof(Chatroom)); OnPropertyChanged(nameof(Chatroom));
OnPropertyChanged(nameof(CheckBox)); OnPropertyChanged(nameof(CheckBox));
OnPropertyChanged(nameof(CheckComboBox)); OnPropertyChanged(nameof(CheckComboBox));
OnPropertyChanged(nameof(CirclePanel)); OnPropertyChanged(nameof(CirclePanel));
OnPropertyChanged(nameof(Clear)); OnPropertyChanged(nameof(Clear));
OnPropertyChanged(nameof(Click2Count)); OnPropertyChanged(nameof(Click2Count));
OnPropertyChanged(nameof(Clock)); OnPropertyChanged(nameof(Clock));
OnPropertyChanged(nameof(ColorPicker)); OnPropertyChanged(nameof(ColorPicker));
OnPropertyChanged(nameof(ColumnOffset)); OnPropertyChanged(nameof(ColumnOffset));
OnPropertyChanged(nameof(ColumnSpacing)); OnPropertyChanged(nameof(ColumnSpacing));
OnPropertyChanged(nameof(ComboBox)); OnPropertyChanged(nameof(ComboBox));
OnPropertyChanged(nameof(ComingSoon)); OnPropertyChanged(nameof(ComingSoon));
OnPropertyChanged(nameof(Comment)); OnPropertyChanged(nameof(Comment));
OnPropertyChanged(nameof(Common)); OnPropertyChanged(nameof(Common));
OnPropertyChanged(nameof(CompareSlider)); OnPropertyChanged(nameof(CompareSlider));
OnPropertyChanged(nameof(Complete)); OnPropertyChanged(nameof(Complete));
OnPropertyChanged(nameof(ContentDemoStr)); OnPropertyChanged(nameof(ContentDemoStr));
OnPropertyChanged(nameof(Contributors)); OnPropertyChanged(nameof(Contributors));
OnPropertyChanged(nameof(Controls)); OnPropertyChanged(nameof(Controls));
OnPropertyChanged(nameof(CoverFlow)); OnPropertyChanged(nameof(CoverFlow));
OnPropertyChanged(nameof(CoverView)); OnPropertyChanged(nameof(CoverView));
OnPropertyChanged(nameof(Danger)); OnPropertyChanged(nameof(Danger));
OnPropertyChanged(nameof(DataGrid)); OnPropertyChanged(nameof(DataGrid));
OnPropertyChanged(nameof(DatePicker)); OnPropertyChanged(nameof(DatePicker));
OnPropertyChanged(nameof(DateTimePicker)); OnPropertyChanged(nameof(DateTimePicker));
OnPropertyChanged(nameof(Default)); OnPropertyChanged(nameof(Default));
OnPropertyChanged(nameof(Demo)); OnPropertyChanged(nameof(Demo));
OnPropertyChanged(nameof(Dialog)); OnPropertyChanged(nameof(Dialog));
OnPropertyChanged(nameof(DialogDemo)); OnPropertyChanged(nameof(DialogDemo));
OnPropertyChanged(nameof(Divider)); OnPropertyChanged(nameof(Divider));
OnPropertyChanged(nameof(Doc_cn)); OnPropertyChanged(nameof(Doc_cn));
OnPropertyChanged(nameof(Doc_en)); OnPropertyChanged(nameof(Doc_en));
OnPropertyChanged(nameof(Documentation)); OnPropertyChanged(nameof(Documentation));
OnPropertyChanged(nameof(DragHere)); OnPropertyChanged(nameof(DragHere));
OnPropertyChanged(nameof(Drawer)); OnPropertyChanged(nameof(Drawer));
OnPropertyChanged(nameof(Effects)); OnPropertyChanged(nameof(Effects));
OnPropertyChanged(nameof(Email)); OnPropertyChanged(nameof(Email));
OnPropertyChanged(nameof(Error)); OnPropertyChanged(nameof(Error));
OnPropertyChanged(nameof(Exit)); OnPropertyChanged(nameof(Exit));
OnPropertyChanged(nameof(Expander)); OnPropertyChanged(nameof(Expander));
OnPropertyChanged(nameof(Fatal)); OnPropertyChanged(nameof(Fatal));
OnPropertyChanged(nameof(FlexPanel)); OnPropertyChanged(nameof(FlexPanel));
OnPropertyChanged(nameof(FlipClock)); OnPropertyChanged(nameof(FlipClock));
OnPropertyChanged(nameof(FloatingBlock)); OnPropertyChanged(nameof(FloatingBlock));
OnPropertyChanged(nameof(FlowDocument)); OnPropertyChanged(nameof(FlowDocument));
OnPropertyChanged(nameof(FlowDocumentPageViewer)); OnPropertyChanged(nameof(FlowDocumentPageViewer));
OnPropertyChanged(nameof(FlowDocumentReader)); OnPropertyChanged(nameof(FlowDocumentReader));
OnPropertyChanged(nameof(FlowDocumentScrollViewer)); OnPropertyChanged(nameof(FlowDocumentScrollViewer));
OnPropertyChanged(nameof(Frame)); OnPropertyChanged(nameof(Frame));
OnPropertyChanged(nameof(Geometry)); OnPropertyChanged(nameof(Geometry));
OnPropertyChanged(nameof(GifImage)); OnPropertyChanged(nameof(GifImage));
OnPropertyChanged(nameof(GotoTop)); OnPropertyChanged(nameof(GotoTop));
OnPropertyChanged(nameof(Gravatar)); OnPropertyChanged(nameof(Gravatar));
OnPropertyChanged(nameof(Grid)); OnPropertyChanged(nameof(Grid));
OnPropertyChanged(nameof(GroupBox)); OnPropertyChanged(nameof(GroupBox));
OnPropertyChanged(nameof(Groups)); OnPropertyChanged(nameof(Groups));
OnPropertyChanged(nameof(Growl)); OnPropertyChanged(nameof(Growl));
OnPropertyChanged(nameof(GrowlAsk)); OnPropertyChanged(nameof(GrowlAsk));
OnPropertyChanged(nameof(GrowlDemo)); OnPropertyChanged(nameof(GrowlDemo));
OnPropertyChanged(nameof(GrowlError)); OnPropertyChanged(nameof(GrowlError));
OnPropertyChanged(nameof(GrowlFatal)); OnPropertyChanged(nameof(GrowlFatal));
OnPropertyChanged(nameof(GrowlInfo)); OnPropertyChanged(nameof(GrowlInfo));
OnPropertyChanged(nameof(GrowlSuccess)); OnPropertyChanged(nameof(GrowlSuccess));
OnPropertyChanged(nameof(GrowlWarning)); OnPropertyChanged(nameof(GrowlWarning));
OnPropertyChanged(nameof(HatchBrushGenerator)); OnPropertyChanged(nameof(HatchBrushGenerator));
OnPropertyChanged(nameof(HoneycombPanel)); OnPropertyChanged(nameof(HoneycombPanel));
OnPropertyChanged(nameof(HybridLayout)); OnPropertyChanged(nameof(HybridLayout));
OnPropertyChanged(nameof(Ignore)); OnPropertyChanged(nameof(Ignore));
OnPropertyChanged(nameof(ImageBlock)); OnPropertyChanged(nameof(ImageBlock));
OnPropertyChanged(nameof(ImageBrowser)); OnPropertyChanged(nameof(ImageBrowser));
OnPropertyChanged(nameof(ImageSelector)); OnPropertyChanged(nameof(ImageSelector));
OnPropertyChanged(nameof(Index)); OnPropertyChanged(nameof(Index));
OnPropertyChanged(nameof(Info)); OnPropertyChanged(nameof(Info));
OnPropertyChanged(nameof(InteractiveDialog)); OnPropertyChanged(nameof(InteractiveDialog));
OnPropertyChanged(nameof(IsNotPhone)); OnPropertyChanged(nameof(IsNotPhone));
OnPropertyChanged(nameof(Label)); OnPropertyChanged(nameof(Label));
OnPropertyChanged(nameof(LangComment)); OnPropertyChanged(nameof(LangComment));
OnPropertyChanged(nameof(ListBox)); OnPropertyChanged(nameof(ListBox));
OnPropertyChanged(nameof(ListView)); OnPropertyChanged(nameof(ListView));
OnPropertyChanged(nameof(Loading)); OnPropertyChanged(nameof(Loading));
OnPropertyChanged(nameof(Magnifier)); OnPropertyChanged(nameof(Magnifier));
OnPropertyChanged(nameof(Menu)); OnPropertyChanged(nameof(Menu));
OnPropertyChanged(nameof(MessageBox)); OnPropertyChanged(nameof(MessageBox));
OnPropertyChanged(nameof(Morphing_Animation)); OnPropertyChanged(nameof(Morphing_Animation));
OnPropertyChanged(nameof(Name)); OnPropertyChanged(nameof(Name));
OnPropertyChanged(nameof(NewWindow)); OnPropertyChanged(nameof(NewWindow));
OnPropertyChanged(nameof(Next)); OnPropertyChanged(nameof(Next));
OnPropertyChanged(nameof(Notification)); OnPropertyChanged(nameof(Notification));
OnPropertyChanged(nameof(NotifyIcon)); OnPropertyChanged(nameof(NotifyIcon));
OnPropertyChanged(nameof(NumericUpDown)); OnPropertyChanged(nameof(NumericUpDown));
OnPropertyChanged(nameof(Off)); OnPropertyChanged(nameof(Off));
OnPropertyChanged(nameof(Ok)); OnPropertyChanged(nameof(Ok));
OnPropertyChanged(nameof(On)); OnPropertyChanged(nameof(On));
OnPropertyChanged(nameof(OpenBlurWindow)); OnPropertyChanged(nameof(OpenBlurWindow));
OnPropertyChanged(nameof(OpenCommonWindow)); OnPropertyChanged(nameof(OpenCommonWindow));
OnPropertyChanged(nameof(OpenCustomContentWindow)); OnPropertyChanged(nameof(OpenCustomContentWindow));
OnPropertyChanged(nameof(OpenCustomMessageWindow)); OnPropertyChanged(nameof(OpenCustomMessageWindow));
OnPropertyChanged(nameof(OpenCustomNonClientAreaWindow)); OnPropertyChanged(nameof(OpenCustomNonClientAreaWindow));
OnPropertyChanged(nameof(OpenGlowWindow)); OnPropertyChanged(nameof(OpenGlowWindow));
OnPropertyChanged(nameof(OpenImageBrowser)); OnPropertyChanged(nameof(OpenImageBrowser));
OnPropertyChanged(nameof(OpenMessageWindow)); OnPropertyChanged(nameof(OpenMessageWindow));
OnPropertyChanged(nameof(OpenMouseFollowWindow)); OnPropertyChanged(nameof(OpenMouseFollowWindow));
OnPropertyChanged(nameof(OpenNativeCommonWindow)); OnPropertyChanged(nameof(OpenNativeCommonWindow));
OnPropertyChanged(nameof(OpenNavigationWindow)); OnPropertyChanged(nameof(OpenNavigationWindow));
OnPropertyChanged(nameof(OpenNoNonClientAreaDragableWindow)); OnPropertyChanged(nameof(OpenNoNonClientAreaDragableWindow));
OnPropertyChanged(nameof(OpenPanel)); OnPropertyChanged(nameof(OpenPanel));
OnPropertyChanged(nameof(OpenSprite)); OnPropertyChanged(nameof(OpenSprite));
OnPropertyChanged(nameof(OutlineText)); OnPropertyChanged(nameof(OutlineText));
OnPropertyChanged(nameof(Pagination)); OnPropertyChanged(nameof(Pagination));
OnPropertyChanged(nameof(PasswordBox)); OnPropertyChanged(nameof(PasswordBox));
OnPropertyChanged(nameof(PinBox)); OnPropertyChanged(nameof(PinBox));
OnPropertyChanged(nameof(PleaseInput)); OnPropertyChanged(nameof(PleaseInput));
OnPropertyChanged(nameof(PleaseWait)); OnPropertyChanged(nameof(PleaseWait));
OnPropertyChanged(nameof(PlsEnterContent)); OnPropertyChanged(nameof(PlsEnterContent));
OnPropertyChanged(nameof(PlsEnterEmail)); OnPropertyChanged(nameof(PlsEnterEmail));
OnPropertyChanged(nameof(PlsEnterKey)); OnPropertyChanged(nameof(PlsEnterKey));
OnPropertyChanged(nameof(Poptip)); OnPropertyChanged(nameof(Poptip));
OnPropertyChanged(nameof(PoptipPositionStr)); OnPropertyChanged(nameof(PoptipPositionStr));
OnPropertyChanged(nameof(PracticalDemos)); OnPropertyChanged(nameof(PracticalDemos));
OnPropertyChanged(nameof(Prev)); OnPropertyChanged(nameof(Prev));
OnPropertyChanged(nameof(PreviewSlider)); OnPropertyChanged(nameof(PreviewSlider));
OnPropertyChanged(nameof(Primary)); OnPropertyChanged(nameof(Primary));
OnPropertyChanged(nameof(ProgressBar)); OnPropertyChanged(nameof(ProgressBar));
OnPropertyChanged(nameof(ProgressButton)); OnPropertyChanged(nameof(ProgressButton));
OnPropertyChanged(nameof(Project)); OnPropertyChanged(nameof(Project));
OnPropertyChanged(nameof(PropertyGrid)); OnPropertyChanged(nameof(PropertyGrid));
OnPropertyChanged(nameof(PushToTalk)); OnPropertyChanged(nameof(PushToTalk));
OnPropertyChanged(nameof(QQGroup)); OnPropertyChanged(nameof(QQGroup));
OnPropertyChanged(nameof(RadioButton)); OnPropertyChanged(nameof(RadioButton));
OnPropertyChanged(nameof(RangeSlider)); OnPropertyChanged(nameof(RangeSlider));
OnPropertyChanged(nameof(Rate)); OnPropertyChanged(nameof(Rate));
OnPropertyChanged(nameof(Recommendation)); OnPropertyChanged(nameof(Recommendation));
OnPropertyChanged(nameof(Register)); OnPropertyChanged(nameof(Register));
OnPropertyChanged(nameof(RelativePanel)); OnPropertyChanged(nameof(RelativePanel));
OnPropertyChanged(nameof(Remark)); OnPropertyChanged(nameof(Remark));
OnPropertyChanged(nameof(RemoveItem)); OnPropertyChanged(nameof(RemoveItem));
OnPropertyChanged(nameof(RepeatButton)); OnPropertyChanged(nameof(RepeatButton));
OnPropertyChanged(nameof(Reply)); OnPropertyChanged(nameof(Reply));
OnPropertyChanged(nameof(Repository)); OnPropertyChanged(nameof(Repository));
OnPropertyChanged(nameof(ResponsiveLayout)); OnPropertyChanged(nameof(ResponsiveLayout));
OnPropertyChanged(nameof(RichTextBox)); OnPropertyChanged(nameof(RichTextBox));
OnPropertyChanged(nameof(RightClickHere)); OnPropertyChanged(nameof(RightClickHere));
OnPropertyChanged(nameof(RunningBlock)); OnPropertyChanged(nameof(RunningBlock));
OnPropertyChanged(nameof(Screenshot)); OnPropertyChanged(nameof(Screenshot));
OnPropertyChanged(nameof(ScrollViewer)); OnPropertyChanged(nameof(ScrollViewer));
OnPropertyChanged(nameof(SearchBar)); OnPropertyChanged(nameof(SearchBar));
OnPropertyChanged(nameof(Second)); OnPropertyChanged(nameof(Second));
OnPropertyChanged(nameof(Selected)); OnPropertyChanged(nameof(Selected));
OnPropertyChanged(nameof(SendNotification)); OnPropertyChanged(nameof(SendNotification));
OnPropertyChanged(nameof(Shield)); OnPropertyChanged(nameof(Shield));
OnPropertyChanged(nameof(ShowInCurrentWindow)); OnPropertyChanged(nameof(ShowInCurrentWindow));
OnPropertyChanged(nameof(ShowInMainWindow)); OnPropertyChanged(nameof(ShowInMainWindow));
OnPropertyChanged(nameof(ShowRowNumber)); OnPropertyChanged(nameof(ShowRowNumber));
OnPropertyChanged(nameof(SideMenu)); OnPropertyChanged(nameof(SideMenu));
OnPropertyChanged(nameof(Slider)); OnPropertyChanged(nameof(Slider));
OnPropertyChanged(nameof(SplitButton)); OnPropertyChanged(nameof(SplitButton));
OnPropertyChanged(nameof(Sprite)); OnPropertyChanged(nameof(Sprite));
OnPropertyChanged(nameof(StartScreenshot)); OnPropertyChanged(nameof(StartScreenshot));
OnPropertyChanged(nameof(StaysOpen)); OnPropertyChanged(nameof(StaysOpen));
OnPropertyChanged(nameof(Step)); OnPropertyChanged(nameof(Step));
OnPropertyChanged(nameof(StepBar)); OnPropertyChanged(nameof(StepBar));
OnPropertyChanged(nameof(Styles)); OnPropertyChanged(nameof(Styles));
OnPropertyChanged(nameof(SubTitle)); OnPropertyChanged(nameof(SubTitle));
OnPropertyChanged(nameof(Success)); OnPropertyChanged(nameof(Success));
OnPropertyChanged(nameof(TabControl)); OnPropertyChanged(nameof(TabControl));
OnPropertyChanged(nameof(Tag)); OnPropertyChanged(nameof(Tag));
OnPropertyChanged(nameof(Text)); OnPropertyChanged(nameof(Text));
OnPropertyChanged(nameof(TextBlock)); OnPropertyChanged(nameof(TextBlock));
OnPropertyChanged(nameof(TextBox)); OnPropertyChanged(nameof(TextBox));
OnPropertyChanged(nameof(TextDialog)); OnPropertyChanged(nameof(TextDialog));
OnPropertyChanged(nameof(TextDialogInControl)); OnPropertyChanged(nameof(TextDialogInControl));
OnPropertyChanged(nameof(TextDialogWithTimer)); OnPropertyChanged(nameof(TextDialogWithTimer));
OnPropertyChanged(nameof(TimeBar)); OnPropertyChanged(nameof(TimeBar));
OnPropertyChanged(nameof(TimePicker)); OnPropertyChanged(nameof(TimePicker));
OnPropertyChanged(nameof(Tip)); OnPropertyChanged(nameof(Tip));
OnPropertyChanged(nameof(Title)); OnPropertyChanged(nameof(Title));
OnPropertyChanged(nameof(TitleDemoStr1)); OnPropertyChanged(nameof(TitleDemoStr1));
OnPropertyChanged(nameof(TitleDemoStr2)); OnPropertyChanged(nameof(TitleDemoStr2));
OnPropertyChanged(nameof(TitleDemoStr3)); OnPropertyChanged(nameof(TitleDemoStr3));
OnPropertyChanged(nameof(ToggleButton)); OnPropertyChanged(nameof(ToggleButton));
OnPropertyChanged(nameof(ToolBar)); OnPropertyChanged(nameof(ToolBar));
OnPropertyChanged(nameof(Tools)); OnPropertyChanged(nameof(Tools));
OnPropertyChanged(nameof(Transfer)); OnPropertyChanged(nameof(Transfer));
OnPropertyChanged(nameof(TransitioningContentControl)); OnPropertyChanged(nameof(TransitioningContentControl));
OnPropertyChanged(nameof(TreeView)); OnPropertyChanged(nameof(TreeView));
OnPropertyChanged(nameof(Try2CloseApp)); OnPropertyChanged(nameof(Try2CloseApp));
OnPropertyChanged(nameof(Type)); OnPropertyChanged(nameof(Type));
OnPropertyChanged(nameof(UploadFile)); OnPropertyChanged(nameof(UploadFile));
OnPropertyChanged(nameof(UploadStr)); OnPropertyChanged(nameof(UploadStr));
OnPropertyChanged(nameof(Visibility)); OnPropertyChanged(nameof(Visibility));
OnPropertyChanged(nameof(Vsix)); OnPropertyChanged(nameof(Vsix));
OnPropertyChanged(nameof(Warning)); OnPropertyChanged(nameof(Warning));
OnPropertyChanged(nameof(WaterfallPanel)); OnPropertyChanged(nameof(WaterfallPanel));
OnPropertyChanged(nameof(Website)); OnPropertyChanged(nameof(Website));
OnPropertyChanged(nameof(Window)); OnPropertyChanged(nameof(Window));
} }
/// <summary> /// <summary>
@@ -61,7 +61,7 @@ namespace HandyControlDemo.Service
Index = j, Index = j,
IsSelected = j % 2 == 0, IsSelected = j % 2 == 0,
Name = $"SubName{j}", Name = $"SubName{j}",
Type = (DemoType)j Type = (DemoType) j
}); });
} }
var model = new DemoDataModel var model = new DemoDataModel
@@ -69,7 +69,7 @@ namespace HandyControlDemo.Service
Index = i, Index = i,
IsSelected = i % 2 == 0, IsSelected = i % 2 == 0,
Name = $"Name{i}", Name = $"Name{i}",
Type = (DemoType)i, Type = (DemoType) i,
DataList = dataList, DataList = dataList,
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{i % 6 + 1}.png", ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{i % 6 + 1}.png",
Remark = new string(i.ToString()[0], 10) Remark = new string(i.ToString()[0], 10)
@@ -91,7 +91,7 @@ namespace HandyControlDemo.Service
Index = i, Index = i,
IsSelected = i % 2 == 0, IsSelected = i % 2 == 0,
Name = $"Name{i}", Name = $"Name{i}",
Type = (DemoType)index, Type = (DemoType) index,
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{index}.png", ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{index}.png",
Remark = new string(i.ToString()[0], 10) Remark = new string(i.ToString()[0], 10)
}; };
@@ -129,7 +129,7 @@ namespace HandyControlDemo.Service
Link = item.html_url Link = item.html_url
})); }));
} }
catch(Exception e) catch (Exception e)
{ {
HandyControl.Controls.MessageBox.Error(e.Message, Lang.Error); HandyControl.Controls.MessageBox.Error(e.Message, Lang.Error);
} }
@@ -396,10 +396,10 @@ namespace HandyControlDemo.Service
foreach (var item in list) foreach (var item in list)
{ {
var name = (string)item[0]; var name = (string) item[0];
string targetCtlName = item[1]; string targetCtlName = item[1];
string imageName = item[2]; string imageName = item[2];
var isNew = !string.IsNullOrEmpty((string)item[3]); var isNew = !string.IsNullOrEmpty((string) item[3]);
resultList.Add(new DemoItemModel resultList.Add(new DemoItemModel
{ {
@@ -20,7 +20,7 @@ namespace HandyControlDemo.Tools.Converter
return strValue; return strValue;
} }
} }
else if(parameter is int intValue) else if (parameter is int intValue)
{ {
num = intValue; num = intValue;
} }
@@ -8,7 +8,7 @@ namespace HandyControlDemo.UserControl
{ {
InitializeComponent(); InitializeComponent();
CoverFlowMain.AddRange(new [] CoverFlowMain.AddRange(new[]
{ {
new Uri(@"pack://application:,,,/Resources/Img/Album/1.jpg"), new Uri(@"pack://application:,,,/Resources/Img/Album/1.jpg"),
new Uri(@"pack://application:,,,/Resources/Img/Album/2.jpg"), new Uri(@"pack://application:,,,/Resources/Img/Album/2.jpg"),
@@ -43,7 +43,7 @@ namespace HandyControlDemo.UserControl
if (tag.Equals(GlobalData.Config.Skin)) return; if (tag.Equals(GlobalData.Config.Skin)) return;
GlobalData.Config.Skin = tag; GlobalData.Config.Skin = tag;
GlobalData.Save(); GlobalData.Save();
((App)Application.Current).UpdateSkin(tag); ((App) Application.Current).UpdateSkin(tag);
} }
} }
@@ -1,6 +1,6 @@
using GalaSoft.MvvmLight.Command; using System;
using System;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls; using HandyControl.Controls;
using HandyControl.Data; using HandyControl.Data;
using HandyControlDemo.UserControl; using HandyControlDemo.UserControl;
@@ -94,7 +94,7 @@ namespace HandyControlDemo.ViewModel
} }
public RelayCommand<object> MouseCmd => new Lazy<RelayCommand<object>>(() => public RelayCommand<object> MouseCmd => new Lazy<RelayCommand<object>>(() =>
new RelayCommand<object>(str=> Growl.Info(str.ToString()))).Value; new RelayCommand<object>(str => Growl.Info(str.ToString()))).Value;
public RelayCommand SendNotificationCmd => new Lazy<RelayCommand>(() => public RelayCommand SendNotificationCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(SendNotification)).Value; new RelayCommand(SendNotification)).Value;
@@ -1,8 +1,8 @@
using System; using System;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls; using HandyControl.Controls;
using HandyControl.Data; using HandyControl.Data;
using GalaSoft.MvvmLight.Command;
namespace HandyControlDemo.ViewModel namespace HandyControlDemo.ViewModel
{ {
@@ -1,7 +1,7 @@
using System; using System;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using HandyControl.Controls;
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using HandyControl.Controls;
namespace HandyControlDemo.ViewModel namespace HandyControlDemo.ViewModel
{ {
@@ -1,13 +1,13 @@
using System; using System;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls; using HandyControl.Controls;
using HandyControlDemo.UserControl; using HandyControlDemo.UserControl;
using GalaSoft.MvvmLight.Command;
namespace HandyControlDemo.ViewModel namespace HandyControlDemo.ViewModel
{ {
public class SpriteDemoViewModel public class SpriteDemoViewModel
{ {
public RelayCommand OpenCmd => new Lazy<RelayCommand>(() => public RelayCommand OpenCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(()=> Sprite.Show(new AppSprite()))).Value; new RelayCommand(() => Sprite.Show(new AppSprite()))).Value;
} }
} }
@@ -1,10 +1,10 @@
using System; using System;
using System.Windows; using System.Windows;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls; using HandyControl.Controls;
using HandyControl.Data; using HandyControl.Data;
using HandyControlDemo.Data; using HandyControlDemo.Data;
using HandyControlDemo.Service; using HandyControlDemo.Service;
using GalaSoft.MvvmLight.Command;
namespace HandyControlDemo.ViewModel namespace HandyControlDemo.ViewModel
{ {
@@ -10,13 +10,13 @@ namespace HandyControl.Controls
public static void SetMouseHoverBackground(DependencyObject element, Brush value) => element.SetValue(MouseHoverBackgroundProperty, value); public static void SetMouseHoverBackground(DependencyObject element, Brush value) => element.SetValue(MouseHoverBackgroundProperty, value);
public static Brush GetMouseHoverBackground(DependencyObject element) => (Brush)element.GetValue(MouseHoverBackgroundProperty); public static Brush GetMouseHoverBackground(DependencyObject element) => (Brush) element.GetValue(MouseHoverBackgroundProperty);
public static readonly DependencyProperty MouseDownBackgroundProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty MouseDownBackgroundProperty = DependencyProperty.RegisterAttached(
"MouseDownBackground", typeof(Brush), typeof(BackgroundSwitchElement), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.Inherits)); "MouseDownBackground", typeof(Brush), typeof(BackgroundSwitchElement), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.Inherits));
public static void SetMouseDownBackground(DependencyObject element, Brush value) => element.SetValue(MouseDownBackgroundProperty, value); public static void SetMouseDownBackground(DependencyObject element, Brush value) => element.SetValue(MouseDownBackgroundProperty, value);
public static Brush GetMouseDownBackground(DependencyObject element) => (Brush)element.GetValue(MouseDownBackgroundProperty); public static Brush GetMouseDownBackground(DependencyObject element) => (Brush) element.GetValue(MouseDownBackgroundProperty);
} }
} }
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
public static void SetCornerRadius(DependencyObject element, CornerRadius value) => element.SetValue(CornerRadiusProperty, value); public static void SetCornerRadius(DependencyObject element, CornerRadius value) => element.SetValue(CornerRadiusProperty, value);
public static CornerRadius GetCornerRadius(DependencyObject element) => (CornerRadius)element.GetValue(CornerRadiusProperty); public static CornerRadius GetCornerRadius(DependencyObject element) => (CornerRadius) element.GetValue(CornerRadiusProperty);
public static readonly DependencyProperty CircularProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty CircularProperty = DependencyProperty.RegisterAttached(
"Circular", typeof(bool), typeof(BorderElement), new PropertyMetadata(ValueBoxes.FalseBox, OnCircularChanged)); "Circular", typeof(bool), typeof(BorderElement), new PropertyMetadata(ValueBoxes.FalseBox, OnCircularChanged));
@@ -22,13 +22,13 @@ namespace HandyControl.Controls
{ {
if (d is Border border) if (d is Border border)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
var binding = new MultiBinding var binding = new MultiBinding
{ {
Converter = new BorderCircularConverter() Converter = new BorderCircularConverter()
}; };
binding.Bindings.Add(new Binding(FrameworkElement.ActualWidthProperty.Name) {Source = border}); binding.Bindings.Add(new Binding(FrameworkElement.ActualWidthProperty.Name) { Source = border });
binding.Bindings.Add(new Binding(FrameworkElement.ActualHeightProperty.Name) { Source = border }); binding.Bindings.Add(new Binding(FrameworkElement.ActualHeightProperty.Name) { Source = border });
border.SetBinding(Border.CornerRadiusProperty, binding); border.SetBinding(Border.CornerRadiusProperty, binding);
} }
@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
@@ -14,8 +14,8 @@ namespace HandyControl.Controls
private static void OnApplyDefaultStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnApplyDefaultStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var grid = (DataGrid)d; var grid = (DataGrid) d;
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
if (grid.AutoGenerateColumns) if (grid.AutoGenerateColumns)
{ {
@@ -35,7 +35,7 @@ namespace HandyControl.Controls
private static void Grid_AutoGeneratedColumns(object sender, System.EventArgs e) private static void Grid_AutoGeneratedColumns(object sender, System.EventArgs e)
{ {
var grid = (DataGrid)sender; var grid = (DataGrid) sender;
UpdateTextColumnStyles(grid); UpdateTextColumnStyles(grid);
UpdateComboBoxColumnStyles(grid); UpdateComboBoxColumnStyles(grid);
UpdateCheckBoxColumnStyles(grid); UpdateCheckBoxColumnStyles(grid);
@@ -52,7 +52,7 @@ namespace HandyControl.Controls
private static void OnTextColumnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnTextColumnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var grid = (DataGrid)d; var grid = (DataGrid) d;
if (e.OldValue == null && e.NewValue != null) if (e.OldValue == null && e.NewValue != null)
{ {
UpdateTextColumnStyles(grid); UpdateTextColumnStyles(grid);
@@ -61,7 +61,7 @@ namespace HandyControl.Controls
public static void SetTextColumnStyle(DependencyObject element, Style value) => element.SetValue(TextColumnStyleProperty, value); public static void SetTextColumnStyle(DependencyObject element, Style value) => element.SetValue(TextColumnStyleProperty, value);
public static Style GetTextColumnStyle(DependencyObject element) => (Style)element.GetValue(TextColumnStyleProperty); public static Style GetTextColumnStyle(DependencyObject element) => (Style) element.GetValue(TextColumnStyleProperty);
public static readonly DependencyProperty EditingTextColumnStyleProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty EditingTextColumnStyleProperty = DependencyProperty.RegisterAttached(
"EditingTextColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnTextColumnStyleChanged)); "EditingTextColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnTextColumnStyleChanged));
@@ -119,7 +119,7 @@ namespace HandyControl.Controls
private static void OnComboBoxColumnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnComboBoxColumnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var grid = (DataGrid)d; var grid = (DataGrid) d;
if (e.OldValue == null && e.NewValue != null) if (e.OldValue == null && e.NewValue != null)
{ {
UpdateComboBoxColumnStyles(grid); UpdateComboBoxColumnStyles(grid);
@@ -186,7 +186,7 @@ namespace HandyControl.Controls
private static void OnCheckBoxColumnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnCheckBoxColumnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var grid = (DataGrid)d; var grid = (DataGrid) d;
if (e.OldValue == null && e.NewValue != null) if (e.OldValue == null && e.NewValue != null)
{ {
UpdateCheckBoxColumnStyles(grid); UpdateCheckBoxColumnStyles(grid);
@@ -195,7 +195,7 @@ namespace HandyControl.Controls
public static void SetCheckBoxColumnStyle(DependencyObject element, Style value) => element.SetValue(CheckBoxColumnStyleProperty, value); public static void SetCheckBoxColumnStyle(DependencyObject element, Style value) => element.SetValue(CheckBoxColumnStyleProperty, value);
public static Style GetCheckBoxColumnStyle(DependencyObject element) => (Style)element.GetValue(CheckBoxColumnStyleProperty); public static Style GetCheckBoxColumnStyle(DependencyObject element) => (Style) element.GetValue(CheckBoxColumnStyleProperty);
public static readonly DependencyProperty EditingCheckBoxColumnStyleProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty EditingCheckBoxColumnStyleProperty = DependencyProperty.RegisterAttached(
"EditingCheckBoxColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnCheckBoxColumnStyleChanged)); "EditingCheckBoxColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnCheckBoxColumnStyleChanged));
@@ -252,14 +252,14 @@ namespace HandyControl.Controls
typeof(bool), typeof(DataGridAttach), typeof(bool), typeof(DataGridAttach),
new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits, OnShowRowNumberChanged)); new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits, OnShowRowNumberChanged));
public static bool GetShowRowNumber(DependencyObject target) => (bool)target.GetValue(ShowRowNumberProperty); public static bool GetShowRowNumber(DependencyObject target) => (bool) target.GetValue(ShowRowNumberProperty);
public static void SetShowRowNumber(DependencyObject target, bool value) => target.SetValue(ShowRowNumberProperty, ValueBoxes.BooleanBox(value)); public static void SetShowRowNumber(DependencyObject target, bool value) => target.SetValue(ShowRowNumberProperty, ValueBoxes.BooleanBox(value));
private static void OnShowRowNumberChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) private static void OnShowRowNumberChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
{ {
if (!(target is DataGrid dataGrid)) return; if (!(target is DataGrid dataGrid)) return;
var show = (bool)e.NewValue; var show = (bool) e.NewValue;
if (show) if (show)
{ {
@@ -287,7 +287,7 @@ namespace HandyControl.Controls
{ {
for (var i = 0; i < itemsCount; i++) for (var i = 0; i < itemsCount; i++)
{ {
var row = (DataGridRow)generator.ContainerFromIndex(i); var row = (DataGridRow) generator.ContainerFromIndex(i);
if (row != null) if (row != null)
{ {
row.Header = (i + 1).ToString(); row.Header = (i + 1).ToString();
@@ -298,7 +298,7 @@ namespace HandyControl.Controls
{ {
for (var i = 0; i < itemsCount; i++) for (var i = 0; i < itemsCount; i++)
{ {
var row = (DataGridRow)generator.ContainerFromIndex(i); var row = (DataGridRow) generator.ContainerFromIndex(i);
if (row != null) if (row != null)
{ {
row.Header = null; row.Header = null;
@@ -316,7 +316,7 @@ namespace HandyControl.Controls
{ {
if (d is DataGrid dataGrid) if (d is DataGrid dataGrid)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
dataGrid.PreviewMouseDown += DataGrid_PreviewMouseDown; dataGrid.PreviewMouseDown += DataGrid_PreviewMouseDown;
} }
@@ -15,7 +15,7 @@ namespace HandyControl.Controls
public static Geometry GetGeometrySelected(DependencyObject element) public static Geometry GetGeometrySelected(DependencyObject element)
{ {
return (Geometry)element.GetValue(GeometrySelectedProperty); return (Geometry) element.GetValue(GeometrySelectedProperty);
} }
} }
} }
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
public static void SetPlaceholder(DependencyObject element, string value) => element.SetValue(PlaceholderProperty, value); public static void SetPlaceholder(DependencyObject element, string value) => element.SetValue(PlaceholderProperty, value);
public static string GetPlaceholder(DependencyObject element) => (string)element.GetValue(PlaceholderProperty); public static string GetPlaceholder(DependencyObject element) => (string) element.GetValue(PlaceholderProperty);
/// <summary> /// <summary>
/// 是否必填 /// 是否必填
@@ -23,7 +23,7 @@ namespace HandyControl.Controls
public static void SetNecessary(DependencyObject element, bool value) => element.SetValue(NecessaryProperty, ValueBoxes.BooleanBox(value)); public static void SetNecessary(DependencyObject element, bool value) => element.SetValue(NecessaryProperty, ValueBoxes.BooleanBox(value));
public static bool GetNecessary(DependencyObject element) => (bool)element.GetValue(NecessaryProperty); public static bool GetNecessary(DependencyObject element) => (bool) element.GetValue(NecessaryProperty);
/// <summary> /// <summary>
/// 标记 /// 标记
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
public static void SetSymbol(DependencyObject element, string value) => element.SetValue(SymbolProperty, value); public static void SetSymbol(DependencyObject element, string value) => element.SetValue(SymbolProperty, value);
public static string GetSymbol(DependencyObject element) => (string)element.GetValue(SymbolProperty); public static string GetSymbol(DependencyObject element) => (string) element.GetValue(SymbolProperty);
/// <summary> /// <summary>
/// 内容高度 /// 内容高度
@@ -43,7 +43,7 @@ namespace HandyControl.Controls
public static void SetContentHeight(DependencyObject element, double value) => element.SetValue(ContentHeightProperty, value); public static void SetContentHeight(DependencyObject element, double value) => element.SetValue(ContentHeightProperty, value);
public static double GetContentHeight(DependencyObject element) => (double)element.GetValue(ContentHeightProperty); public static double GetContentHeight(DependencyObject element) => (double) element.GetValue(ContentHeightProperty);
/// <summary> /// <summary>
/// 最小内容高度 /// 最小内容高度
@@ -28,7 +28,7 @@ namespace HandyControl.Controls
private static void MenuItem_Loaded(object sender, RoutedEventArgs e) private static void MenuItem_Loaded(object sender, RoutedEventArgs e)
{ {
var menuItem = (FrameworkElement)sender; var menuItem = (FrameworkElement) sender;
menuItem.Unloaded += MenuItem_Unloaded; menuItem.Unloaded += MenuItem_Unloaded;
var topLine = GetTopLine(menuItem); var topLine = GetTopLine(menuItem);
var popup = GetPopup(topLine); var popup = GetPopup(topLine);
@@ -40,7 +40,7 @@ namespace HandyControl.Controls
private static void MenuItem_Unloaded(object sender, RoutedEventArgs e) private static void MenuItem_Unloaded(object sender, RoutedEventArgs e)
{ {
var menuItem = (FrameworkElement)sender; var menuItem = (FrameworkElement) sender;
menuItem.Unloaded -= MenuItem_Unloaded; menuItem.Unloaded -= MenuItem_Unloaded;
var topLine = GetTopLine(menuItem); var topLine = GetTopLine(menuItem);
var popup = GetPopup(topLine); var popup = GetPopup(topLine);
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
public static void SetPasswordLength(DependencyObject element, int value) => element.SetValue(PasswordLengthProperty, value); public static void SetPasswordLength(DependencyObject element, int value) => element.SetValue(PasswordLengthProperty, value);
public static int GetPasswordLength(DependencyObject element) => (int)element.GetValue(PasswordLengthProperty); public static int GetPasswordLength(DependencyObject element) => (int) element.GetValue(PasswordLengthProperty);
/// <summary> /// <summary>
/// 是否监测 /// 是否监测
@@ -41,7 +41,7 @@ namespace HandyControl.Controls
public static void SetIsMonitoring(DependencyObject element, bool value) => element.SetValue(IsMonitoringProperty, ValueBoxes.BooleanBox(value)); public static void SetIsMonitoring(DependencyObject element, bool value) => element.SetValue(IsMonitoringProperty, ValueBoxes.BooleanBox(value));
public static bool GetIsMonitoring(DependencyObject element) => (bool)element.GetValue(IsMonitoringProperty); public static bool GetIsMonitoring(DependencyObject element) => (bool) element.GetValue(IsMonitoringProperty);
private static void PasswordChanged(object sender, RoutedEventArgs e) private static void PasswordChanged(object sender, RoutedEventArgs e)
{ {
@@ -15,7 +15,7 @@ namespace HandyControl.Controls
{ {
if (d is Rectangle rectangle) if (d is Rectangle rectangle)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
var binding = new MultiBinding var binding = new MultiBinding
{ {
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
{ {
if (d is TextBlock ctl) if (d is TextBlock ctl)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
ctl.TextTrimming = TextTrimming.WordEllipsis; ctl.TextTrimming = TextTrimming.WordEllipsis;
UpdateTooltip(ctl); UpdateTooltip(ctl);
@@ -56,7 +56,7 @@ namespace HandyControl.Controls
public static void SetTitleWidth(DependencyObject element, GridLength value) => element.SetValue(TitleWidthProperty, value); public static void SetTitleWidth(DependencyObject element, GridLength value) => element.SetValue(TitleWidthProperty, value);
public static GridLength GetTitleWidth(DependencyObject element) => (GridLength)element.GetValue(TitleWidthProperty); public static GridLength GetTitleWidth(DependencyObject element) => (GridLength) element.GetValue(TitleWidthProperty);
public static readonly DependencyProperty HorizontalAlignmentProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty HorizontalAlignmentProperty = DependencyProperty.RegisterAttached(
"HorizontalAlignment", typeof(HorizontalAlignment), typeof(TitleElement), new FrameworkPropertyMetadata(default(HorizontalAlignment), FrameworkPropertyMetadataOptions.Inherits)); "HorizontalAlignment", typeof(HorizontalAlignment), typeof(TitleElement), new FrameworkPropertyMetadata(default(HorizontalAlignment), FrameworkPropertyMetadataOptions.Inherits));
@@ -23,7 +23,7 @@ namespace HandyControl.Controls
{ {
if (d is UIElement ctl) if (d is UIElement ctl)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown; ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown;
} }
@@ -49,7 +49,7 @@ namespace HandyControl.Controls
{ {
if (d is System.Windows.Window window) if (d is System.Windows.Window window)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
window.PreviewKeyDown += Window_PreviewKeyDown; window.PreviewKeyDown += Window_PreviewKeyDown;
} }
@@ -110,7 +110,7 @@ namespace HandyControl.Controls
=> element.SetValue(ShowInTaskManagerProperty, ValueBoxes.BooleanBox(value)); => element.SetValue(ShowInTaskManagerProperty, ValueBoxes.BooleanBox(value));
public static bool GetShowInTaskManager(DependencyObject element) public static bool GetShowInTaskManager(DependencyObject element)
=> (bool)element.GetValue(ShowInTaskManagerProperty); => (bool) element.GetValue(ShowInTaskManagerProperty);
public static readonly DependencyProperty HideWhenClosingProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty HideWhenClosingProperty = DependencyProperty.RegisterAttached(
"HideWhenClosing", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnHideWhenClosingChanged)); "HideWhenClosing", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnHideWhenClosingChanged));
@@ -119,7 +119,7 @@ namespace HandyControl.Controls
{ {
if (d is System.Windows.Window window) if (d is System.Windows.Window window)
{ {
var v = (bool)e.NewValue; var v = (bool) e.NewValue;
if (v) if (v)
{ {
window.Closing += Window_Closing; window.Closing += Window_Closing;
@@ -15,9 +15,9 @@ namespace HandyControl.Controls
private static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (AdornerElement)d; var ctl = (AdornerElement) d;
ctl.OnTargetChanged(ctl.ElementTarget, false); ctl.OnTargetChanged(ctl.ElementTarget, false);
ctl.OnTargetChanged((FrameworkElement)e.NewValue, true); ctl.OnTargetChanged((FrameworkElement) e.NewValue, true);
} }
[Bindable(true), Category("Layout")] [Bindable(true), Category("Layout")]
@@ -34,7 +34,7 @@ namespace HandyControl.Controls
private static void OnInstanceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnInstanceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
if (!(d is FrameworkElement target)) return; if (!(d is FrameworkElement target)) return;
var element = (AdornerElement)e.NewValue; var element = (AdornerElement) e.NewValue;
element.OnInstanceChanged(target); element.OnInstanceChanged(target);
} }
@@ -66,7 +66,7 @@ namespace HandyControl.Controls
public bool IsSelected public bool IsSelected
{ {
get => (bool)GetValue(IsSelectedProperty); get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
} }
@@ -29,7 +29,7 @@ namespace HandyControl.Controls
=> element.SetValue(ToYProperty, value); => element.SetValue(ToYProperty, value);
public static double GetToY(DependencyObject element) public static double GetToY(DependencyObject element)
=> (double)element.GetValue(ToYProperty); => (double) element.GetValue(ToYProperty);
public static readonly DependencyProperty DurationProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty DurationProperty = DependencyProperty.RegisterAttached(
"Duration", typeof(Duration), typeof(FloatingBlock), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(2)))); "Duration", typeof(Duration), typeof(FloatingBlock), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(2))));
@@ -69,7 +69,7 @@ namespace HandyControl.Controls
public DataTemplate ContentTemplate public DataTemplate ContentTemplate
{ {
get => (DataTemplate)GetValue(ContentTemplateProperty); get => (DataTemplate) GetValue(ContentTemplateProperty);
set => SetValue(ContentTemplateProperty, value); set => SetValue(ContentTemplateProperty, value);
} }
@@ -80,7 +80,7 @@ namespace HandyControl.Controls
=> element.SetValue(ReadyToFloatProperty, ValueBoxes.BooleanBox(value)); => element.SetValue(ReadyToFloatProperty, ValueBoxes.BooleanBox(value));
private static bool GetReadyToFloat(DependencyObject element) private static bool GetReadyToFloat(DependencyObject element)
=> (bool)element.GetValue(ReadyToFloatProperty); => (bool) element.GetValue(ReadyToFloatProperty);
public static readonly DependencyProperty ContentProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty ContentProperty = DependencyProperty.RegisterAttached(
"Content", typeof(object), typeof(FloatingBlock), new PropertyMetadata(default, OnDataChanged)); "Content", typeof(object), typeof(FloatingBlock), new PropertyMetadata(default, OnDataChanged));
@@ -48,7 +48,7 @@ namespace HandyControl.Controls
public bool Runaway public bool Runaway
{ {
get => (bool)GetValue(RunawayProperty); get => (bool) GetValue(RunawayProperty);
set => SetValue(RunawayProperty, ValueBoxes.BooleanBox(value)); set => SetValue(RunawayProperty, ValueBoxes.BooleanBox(value));
} }
@@ -57,7 +57,7 @@ namespace HandyControl.Controls
public bool AutoRun public bool AutoRun
{ {
get => (bool)GetValue(AutoRunProperty); get => (bool) GetValue(AutoRunProperty);
set => SetValue(AutoRunProperty, ValueBoxes.BooleanBox(value)); set => SetValue(AutoRunProperty, ValueBoxes.BooleanBox(value));
} }
@@ -66,7 +66,7 @@ namespace HandyControl.Controls
public Orientation Orientation public Orientation Orientation
{ {
get => (Orientation)GetValue(OrientationProperty); get => (Orientation) GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value); set => SetValue(OrientationProperty, value);
} }
@@ -75,7 +75,7 @@ namespace HandyControl.Controls
public Duration Duration public Duration Duration
{ {
get => (Duration)GetValue(DurationProperty); get => (Duration) GetValue(DurationProperty);
set => SetValue(DurationProperty, value); set => SetValue(DurationProperty, value);
} }
@@ -84,15 +84,15 @@ namespace HandyControl.Controls
public double Speed public double Speed
{ {
get => (double)GetValue(SpeedProperty); get => (double) GetValue(SpeedProperty);
set => SetValue(SpeedProperty, value); set => SetValue(SpeedProperty, value);
} }
public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register( public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register(
"IsRunning", typeof(bool), typeof(RunningBlock), new PropertyMetadata(ValueBoxes.TrueBox, (o, args) => "IsRunning", typeof(bool), typeof(RunningBlock), new PropertyMetadata(ValueBoxes.TrueBox, (o, args) =>
{ {
var ctl = (RunningBlock)o; var ctl = (RunningBlock) o;
var v = (bool)args.NewValue; var v = (bool) args.NewValue;
if (v) if (v)
{ {
ctl._storyboard?.Resume(); ctl._storyboard?.Resume();
@@ -105,7 +105,7 @@ namespace HandyControl.Controls
public bool IsRunning public bool IsRunning
{ {
get => (bool)GetValue(IsRunningProperty); get => (bool) GetValue(IsRunningProperty);
set => SetValue(IsRunningProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsRunningProperty, ValueBoxes.BooleanBox(value));
} }
@@ -114,7 +114,7 @@ namespace HandyControl.Controls
public bool AutoReverse public bool AutoReverse
{ {
get => (bool)GetValue(AutoReverseProperty); get => (bool) GetValue(AutoReverseProperty);
set => SetValue(AutoReverseProperty, ValueBoxes.BooleanBox(value)); set => SetValue(AutoReverseProperty, ValueBoxes.BooleanBox(value));
} }
@@ -24,7 +24,7 @@ namespace HandyControl.Controls
// Because Nullable<bool> unboxing is very slow (uses reflection) first we cast to bool // Because Nullable<bool> unboxing is very slow (uses reflection) first we cast to bool
var value = GetValue(IsCheckedProperty); var value = GetValue(IsCheckedProperty);
// ReSharper disable once RedundantExplicitNullableCreation // ReSharper disable once RedundantExplicitNullableCreation
return value == null ? new bool?() : new bool?((bool)value); return value == null ? new bool?() : new bool?((bool) value);
} }
set => SetValue(IsCheckedProperty, value.HasValue ? ValueBoxes.BooleanBox(value.Value) : null); set => SetValue(IsCheckedProperty, value.HasValue ? ValueBoxes.BooleanBox(value.Value) : null);
} }
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
public Orientation Orientation public Orientation Orientation
{ {
get => (Orientation)GetValue(OrientationProperty); get => (Orientation) GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value); set => SetValue(OrientationProperty, value);
} }
@@ -24,7 +24,7 @@ namespace HandyControl.Controls
var count = Items.Count; var count = Items.Count;
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
var item = (ButtonBase)Items[i]; var item = (ButtonBase) Items[i];
item.Style = ItemContainerStyleSelector?.SelectStyle(item, this); item.Style = ItemContainerStyleSelector?.SelectStyle(item, this);
} }
} }
@@ -82,8 +82,8 @@ namespace HandyControl.Controls
public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register( public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
"AutoRun", typeof(bool), typeof(Carousel), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) => "AutoRun", typeof(bool), typeof(Carousel), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) =>
{ {
var ctl = (Carousel)o; var ctl = (Carousel) o;
ctl.TimerSwitch((bool)args.NewValue); ctl.TimerSwitch((bool) args.NewValue);
})); }));
public static readonly DependencyProperty IntervalProperty = DependencyProperty.Register( public static readonly DependencyProperty IntervalProperty = DependencyProperty.Register(
@@ -94,7 +94,7 @@ namespace HandyControl.Controls
public double ExtendWidth public double ExtendWidth
{ {
get => (double)GetValue(ExtendWidthProperty); get => (double) GetValue(ExtendWidthProperty);
set => SetValue(ExtendWidthProperty, value); set => SetValue(ExtendWidthProperty, value);
} }
@@ -103,7 +103,7 @@ namespace HandyControl.Controls
public bool IsCenter public bool IsCenter
{ {
get => (bool)GetValue(IsCenterProperty); get => (bool) GetValue(IsCenterProperty);
set => SetValue(IsCenterProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsCenterProperty, ValueBoxes.BooleanBox(value));
} }
@@ -160,7 +160,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool AutoRun public bool AutoRun
{ {
get => (bool)GetValue(AutoRunProperty); get => (bool) GetValue(AutoRunProperty);
set => SetValue(AutoRunProperty, ValueBoxes.BooleanBox(value)); set => SetValue(AutoRunProperty, ValueBoxes.BooleanBox(value));
} }
@@ -169,7 +169,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public TimeSpan Interval public TimeSpan Interval
{ {
get => (TimeSpan)GetValue(IntervalProperty); get => (TimeSpan) GetValue(IntervalProperty);
set => SetValue(IntervalProperty, value); set => SetValue(IntervalProperty, value);
} }
@@ -278,7 +278,7 @@ namespace HandyControl.Controls
} }
else else
{ {
var ctl = (FrameworkElement)ItemsHost.Children[PageIndex]; var ctl = (FrameworkElement) ItemsHost.Children[PageIndex];
var ctlWidth = ctl.DesiredSize.Width; var ctlWidth = ctl.DesiredSize.Width;
ItemsHost.BeginAnimation(MarginProperty, ItemsHost.BeginAnimation(MarginProperty,
AnimationHelper.CreateAnimation( AnimationHelper.CreateAnimation(
@@ -98,7 +98,7 @@ namespace HandyControl.Controls
{ {
var desk = InteropMethods.GetDesktopWindow(); var desk = InteropMethods.GetDesktopWindow();
var dc = InteropMethods.GetWindowDC(desk); var dc = InteropMethods.GetWindowDC(desk);
var a = (int)InteropMethods.GetPixel(dc, x, y); var a = (int) InteropMethods.GetPixel(dc, x, y);
InteropMethods.ReleaseDC(desk, dc); InteropMethods.ReleaseDC(desk, dc);
return Color.FromArgb(255, (byte) ((a >> 0) & 0xff), (byte) ((a >> 8) & 0xff), (byte) ((a >> 16) & 0xff)); return Color.FromArgb(255, (byte) ((a >> 0) & 0xff), (byte) ((a >> 8) & 0xff), (byte) ((a >> 16) & 0xff));
} }
@@ -219,7 +219,7 @@ namespace HandyControl.Controls
internal int ChannelA internal int ChannelA
{ {
get => (int)GetValue(ChannelAProperty); get => (int) GetValue(ChannelAProperty);
set => SetValue(ChannelAProperty, value); set => SetValue(ChannelAProperty, value);
} }
@@ -228,7 +228,7 @@ namespace HandyControl.Controls
internal int ChannelR internal int ChannelR
{ {
get => (int)GetValue(ChannelRProperty); get => (int) GetValue(ChannelRProperty);
set => SetValue(ChannelRProperty, value); set => SetValue(ChannelRProperty, value);
} }
@@ -237,7 +237,7 @@ namespace HandyControl.Controls
internal int ChannelG internal int ChannelG
{ {
get => (int)GetValue(ChannelGProperty); get => (int) GetValue(ChannelGProperty);
set => SetValue(ChannelGProperty, value); set => SetValue(ChannelGProperty, value);
} }
@@ -246,7 +246,7 @@ namespace HandyControl.Controls
internal int ChannelB internal int ChannelB
{ {
get => (int)GetValue(ChannelBProperty); get => (int) GetValue(ChannelBProperty);
set => SetValue(ChannelBProperty, value); set => SetValue(ChannelBProperty, value);
} }
@@ -254,8 +254,8 @@ namespace HandyControl.Controls
"SelectedBrush", typeof(SolidColorBrush), typeof(ColorPicker), new PropertyMetadata(Brushes.White, "SelectedBrush", typeof(SolidColorBrush), typeof(ColorPicker), new PropertyMetadata(Brushes.White,
(o, args) => (o, args) =>
{ {
var ctl = (ColorPicker)o; var ctl = (ColorPicker) o;
var v = (SolidColorBrush)args.NewValue; var v = (SolidColorBrush) args.NewValue;
if (ctl.IsNeedUpdateInfo) if (ctl.IsNeedUpdateInfo)
{ {
@@ -275,7 +275,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public SolidColorBrush SelectedBrush public SolidColorBrush SelectedBrush
{ {
get => (SolidColorBrush)GetValue(SelectedBrushProperty); get => (SolidColorBrush) GetValue(SelectedBrushProperty);
set => SetValue(SelectedBrushProperty, value); set => SetValue(SelectedBrushProperty, value);
} }
@@ -284,7 +284,7 @@ namespace HandyControl.Controls
internal SolidColorBrush SelectedBrushWithoutOpacity internal SolidColorBrush SelectedBrushWithoutOpacity
{ {
get => (SolidColorBrush)GetValue(SelectedBrushWithoutOpacityProperty); get => (SolidColorBrush) GetValue(SelectedBrushWithoutOpacityProperty);
set => SetValue(SelectedBrushWithoutOpacityProperty, value); set => SetValue(SelectedBrushWithoutOpacityProperty, value);
} }
@@ -293,7 +293,7 @@ namespace HandyControl.Controls
internal SolidColorBrush BackColor internal SolidColorBrush BackColor
{ {
get => (SolidColorBrush)GetValue(BackColorProperty); get => (SolidColorBrush) GetValue(BackColorProperty);
set => SetValue(BackColorProperty, value); set => SetValue(BackColorProperty, value);
} }
@@ -305,7 +305,7 @@ namespace HandyControl.Controls
internal List<bool> ShowList internal List<bool> ShowList
{ {
get => (List<bool>)GetValue(ShowListProperty); get => (List<bool>) GetValue(ShowListProperty);
set => SetValue(ShowListProperty, value); set => SetValue(ShowListProperty, value);
} }
@@ -450,7 +450,7 @@ namespace HandyControl.Controls
private Button CreateColorButton(string colorStr) private Button CreateColorButton(string colorStr)
{ {
var color = ColorConverter.ConvertFromString(colorStr) ?? default(Color); var color = ColorConverter.ConvertFromString(colorStr) ?? default(Color);
var brush = new SolidColorBrush((Color)color); var brush = new SolidColorBrush((Color) color);
var button = new Button var button = new Button
{ {
@@ -527,7 +527,7 @@ namespace HandyControl.Controls
var common = list[commonIndex]; var common = list[commonIndex];
list[maxIndex] = 255; list[maxIndex] = 255;
list[minIndex] = 0; list[minIndex] = 0;
common = (byte)(255 * (min - common) / (double)(min - max)); common = (byte) (255 * (min - common) / (double) (min - max));
list[commonIndex] = common; list[commonIndex] = common;
BackColor = new SolidColorBrush(Color.FromRgb(list[0], list[1], list[2])); BackColor = new SolidColorBrush(Color.FromRgb(list[0], list[1], list[2]));
@@ -575,7 +575,7 @@ namespace HandyControl.Controls
} }
var matrix = _borderPicker.RenderTransform.Value; var matrix = _borderPicker.RenderTransform.Value;
var x = max == 0 ? 0 : (1 - min / (double)max) * ColorPanelWidth; var x = max == 0 ? 0 : (1 - min / (double) max) * ColorPanelWidth;
var y = (1 - max / 255.0) * ColorPanelHeight; var y = (1 - max / 255.0) * ColorPanelHeight;
if (_isNeedUpdatePicker) if (_isNeedUpdatePicker)
{ {
@@ -586,7 +586,7 @@ namespace HandyControl.Controls
private void SliderColor_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) private void SliderColor_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{ {
if (!_appliedTemplate || !IsNeedUpdateInfo) return; if (!_appliedTemplate || !IsNeedUpdateInfo) return;
var index = Math.Min(5, (int)Math.Floor(e.NewValue)); var index = Math.Min(5, (int) Math.Floor(e.NewValue));
var sub = e.NewValue - index; var sub = e.NewValue - index;
var range = _colorRangeList[index]; var range = _colorRangeList[index];
@@ -602,7 +602,7 @@ namespace HandyControl.Controls
{ {
if (!_appliedTemplate || !IsNeedUpdateInfo) return; if (!_appliedTemplate || !IsNeedUpdateInfo) return;
var color = SelectedBrush.Color; var color = SelectedBrush.Color;
SelectedBrush = new SolidColorBrush(Color.FromArgb((byte)_sliderOpacity.Value, color.R, color.G, color.B)); SelectedBrush = new SolidColorBrush(Color.FromArgb((byte) _sliderOpacity.Value, color.R, color.G, color.B));
} }
private void MouseDragElementBehavior_OnDragging(object sender, MouseEventArgs e) private void MouseDragElementBehavior_OnDragging(object sender, MouseEventArgs e)
@@ -646,15 +646,15 @@ namespace HandyControl.Controls
var scaleX = p.X / ColorPanelWidth; var scaleX = p.X / ColorPanelWidth;
var scaleY = 1 - p.Y / ColorPanelHeight; var scaleY = 1 - p.Y / ColorPanelHeight;
var colorYLeft = Color.FromRgb((byte)(255 * scaleY), (byte)(255 * scaleY), (byte)(255 * scaleY)); var colorYLeft = Color.FromRgb((byte) (255 * scaleY), (byte) (255 * scaleY), (byte) (255 * scaleY));
var colorYRight = Color.FromRgb((byte)(BackColor.Color.R * scaleY), (byte)(BackColor.Color.G * scaleY), (byte)(BackColor.Color.B * scaleY)); var colorYRight = Color.FromRgb((byte) (BackColor.Color.R * scaleY), (byte) (BackColor.Color.G * scaleY), (byte) (BackColor.Color.B * scaleY));
var subR = colorYLeft.R - colorYRight.R; var subR = colorYLeft.R - colorYRight.R;
var subG = colorYLeft.G - colorYRight.G; var subG = colorYLeft.G - colorYRight.G;
var subB = colorYLeft.B - colorYRight.B; var subB = colorYLeft.B - colorYRight.B;
var color = Color.FromArgb((byte)_sliderOpacity.Value, (byte)(colorYLeft.R - subR * scaleX), var color = Color.FromArgb((byte) _sliderOpacity.Value, (byte) (colorYLeft.R - subR * scaleX),
(byte)(colorYLeft.G - subG * scaleX), (byte)(colorYLeft.B - subB * scaleX)); (byte) (colorYLeft.G - subG * scaleX), (byte) (colorYLeft.B - subB * scaleX));
SelectedBrush = new SolidColorBrush(color); SelectedBrush = new SolidColorBrush(color);
} }
@@ -675,17 +675,17 @@ namespace HandyControl.Controls
{ {
case "R": case "R":
{ {
SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, (byte)e.Info, color.G, color.B)); SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, (byte) e.Info, color.G, color.B));
break; break;
} }
case "G": case "G":
{ {
SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, color.R, (byte)e.Info, color.B)); SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, color.R, (byte) e.Info, color.B));
break; break;
} }
case "B": case "B":
{ {
SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, (byte)e.Info)); SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, (byte) e.Info));
break; break;
} }
} }
@@ -40,8 +40,8 @@ namespace HandyControl.Controls
private static object CoercePageIndex(DependencyObject d, object baseValue) private static object CoercePageIndex(DependencyObject d, object baseValue)
{ {
var ctl = (CoverFlow)d; var ctl = (CoverFlow) d;
var v = (int)baseValue; var v = (int) baseValue;
if (v < 0) if (v < 0)
{ {
@@ -56,8 +56,8 @@ namespace HandyControl.Controls
private static void OnPageIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnPageIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (CoverFlow)d; var ctl = (CoverFlow) d;
ctl.UpdateIndex((int)e.NewValue); ctl.UpdateIndex((int) e.NewValue);
} }
/// <summary> /// <summary>
@@ -113,7 +113,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public int PageIndex public int PageIndex
{ {
get => (int)GetValue(PageIndexProperty); get => (int) GetValue(PageIndexProperty);
internal set => SetValue(PageIndexProperty, value); internal set => SetValue(PageIndexProperty, value);
} }
@@ -122,7 +122,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool Loop public bool Loop
{ {
get => (bool)GetValue(LoopProperty); get => (bool) GetValue(LoopProperty);
set => SetValue(LoopProperty, ValueBoxes.BooleanBox(value)); set => SetValue(LoopProperty, ValueBoxes.BooleanBox(value));
} }
@@ -217,7 +217,7 @@ namespace HandyControl.Controls
private void Viewport3D_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void Viewport3D_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
var result = (RayMeshGeometry3DHitTestResult)VisualTreeHelper.HitTest(_viewport3D, e.GetPosition(_viewport3D)); var result = (RayMeshGeometry3DHitTestResult) VisualTreeHelper.HitTest(_viewport3D, e.GetPosition(_viewport3D));
if (result != null) if (result != null)
{ {
foreach (var item in _itemShowDic.Values) foreach (var item in _itemShowDic.Values)
@@ -101,7 +101,7 @@ namespace HandyControl.Controls
public Style CoverViewContentStyle public Style CoverViewContentStyle
{ {
get => (Style)GetValue(CoverViewContentStyleProperty); get => (Style) GetValue(CoverViewContentStyleProperty);
set => SetValue(CoverViewContentStyleProperty, value); set => SetValue(CoverViewContentStyleProperty, value);
} }
@@ -120,13 +120,13 @@ namespace HandyControl.Controls
private static bool IsGroupsValid(object value) private static bool IsGroupsValid(object value)
{ {
var v = (int)value; var v = (int) value;
return v >= 1; return v >= 1;
} }
public int Groups public int Groups
{ {
get => (int)GetValue(GroupsProperty); get => (int) GetValue(GroupsProperty);
set => SetValue(GroupsProperty, value); set => SetValue(GroupsProperty, value);
} }
@@ -136,7 +136,7 @@ namespace HandyControl.Controls
public double ItemContentHeight public double ItemContentHeight
{ {
get => (double)GetValue(ItemContentHeightProperty); get => (double) GetValue(ItemContentHeightProperty);
set => SetValue(ItemContentHeightProperty, value); set => SetValue(ItemContentHeightProperty, value);
} }
@@ -145,7 +145,7 @@ namespace HandyControl.Controls
public bool ItemContentHeightFixed public bool ItemContentHeightFixed
{ {
get => (bool)GetValue(ItemContentHeightFixedProperty); get => (bool) GetValue(ItemContentHeightFixedProperty);
set => SetValue(ItemContentHeightFixedProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ItemContentHeightFixedProperty, ValueBoxes.BooleanBox(value));
} }
@@ -162,7 +162,7 @@ namespace HandyControl.Controls
{ {
base.OnRenderSizeChanged(sizeInfo); base.OnRenderSizeChanged(sizeInfo);
Groups = (int)(sizeInfo.NewSize.Width / (ItemWidth + ItemMargin.Left + ItemMargin.Right)); Groups = (int) (sizeInfo.NewSize.Width / (ItemWidth + ItemMargin.Left + ItemMargin.Right));
} }
protected override void Refresh() protected override void Refresh()
@@ -47,7 +47,7 @@ namespace HandyControl.Controls
internal double ManualHeight internal double ManualHeight
{ {
get => (double)GetValue(ManualHeightProperty); get => (double) GetValue(ManualHeightProperty);
set => SetValue(ManualHeightProperty, value); set => SetValue(ManualHeightProperty, value);
} }
@@ -57,7 +57,7 @@ namespace HandyControl.Controls
public double ContentHeight public double ContentHeight
{ {
get => (double)GetValue(ContentHeightProperty); get => (double) GetValue(ContentHeightProperty);
set => SetValue(ContentHeightProperty, value); set => SetValue(ContentHeightProperty, value);
} }
@@ -23,7 +23,7 @@ namespace HandyControl.Controls
public bool IsClosed public bool IsClosed
{ {
get => (bool)GetValue(IsClosedProperty); get => (bool) GetValue(IsClosedProperty);
internal set => SetValue(IsClosedProperty, ValueBoxes.BooleanBox(value)); internal set => SetValue(IsClosedProperty, ValueBoxes.BooleanBox(value));
} }
@@ -49,7 +49,7 @@ namespace HandyControl.Controls
=> element.SetValue(TokenProperty, value); => element.SetValue(TokenProperty, value);
public static string GetToken(DependencyObject element) public static string GetToken(DependencyObject element)
=> (string)element.GetValue(TokenProperty); => (string) element.GetValue(TokenProperty);
public Dialog() public Dialog()
{ {
@@ -179,7 +179,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty GrowlParentProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty GrowlParentProperty = DependencyProperty.RegisterAttached(
"GrowlParent", typeof(bool), typeof(Growl), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) => "GrowlParent", typeof(bool), typeof(Growl), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) =>
{ {
if ((bool)args.NewValue && o is Panel panel) if ((bool) args.NewValue && o is Panel panel)
{ {
SetGrowlPanel(panel); SetGrowlPanel(panel);
} }
@@ -207,57 +207,57 @@ namespace HandyControl.Controls
=> element.SetValue(TokenProperty, value); => element.SetValue(TokenProperty, value);
public static string GetToken(DependencyObject element) public static string GetToken(DependencyObject element)
=> (string)element.GetValue(TokenProperty); => (string) element.GetValue(TokenProperty);
public static void SetGrowlParent(DependencyObject element, bool value) => element.SetValue(GrowlParentProperty, ValueBoxes.BooleanBox(value)); public static void SetGrowlParent(DependencyObject element, bool value) => element.SetValue(GrowlParentProperty, ValueBoxes.BooleanBox(value));
public static bool GetGrowlParent(DependencyObject element) => (bool)element.GetValue(GrowlParentProperty); public static bool GetGrowlParent(DependencyObject element) => (bool) element.GetValue(GrowlParentProperty);
public InfoType Type public InfoType Type
{ {
get => (InfoType)GetValue(TypeProperty); get => (InfoType) GetValue(TypeProperty);
set => SetValue(TypeProperty, value); set => SetValue(TypeProperty, value);
} }
internal string CancelStr internal string CancelStr
{ {
get => (string)GetValue(CancelStrProperty); get => (string) GetValue(CancelStrProperty);
set => SetValue(CancelStrProperty, value); set => SetValue(CancelStrProperty, value);
} }
internal string ConfirmStr internal string ConfirmStr
{ {
get => (string)GetValue(ConfirmStrProperty); get => (string) GetValue(ConfirmStrProperty);
set => SetValue(ConfirmStrProperty, value); set => SetValue(ConfirmStrProperty, value);
} }
public bool ShowDateTime public bool ShowDateTime
{ {
get => (bool)GetValue(ShowDateTimeProperty); get => (bool) GetValue(ShowDateTimeProperty);
set => SetValue(ShowDateTimeProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowDateTimeProperty, ValueBoxes.BooleanBox(value));
} }
public string Message public string Message
{ {
get => (string)GetValue(MessageProperty); get => (string) GetValue(MessageProperty);
set => SetValue(MessageProperty, value); set => SetValue(MessageProperty, value);
} }
public DateTime Time public DateTime Time
{ {
get => (DateTime)GetValue(TimeProperty); get => (DateTime) GetValue(TimeProperty);
set => SetValue(TimeProperty, value); set => SetValue(TimeProperty, value);
} }
public Geometry Icon public Geometry Icon
{ {
get => (Geometry)GetValue(IconProperty); get => (Geometry) GetValue(IconProperty);
set => SetValue(IconProperty, value); set => SetValue(IconProperty, value);
} }
public Brush IconBrush public Brush IconBrush
{ {
get => (Brush)GetValue(IconBrushProperty); get => (Brush) GetValue(IconBrushProperty);
set => SetValue(IconBrushProperty, value); set => SetValue(IconBrushProperty, value);
} }
@@ -44,7 +44,7 @@ namespace HandyControl.Controls
if (e.NewValue != null) if (e.NewValue != null)
{ {
var v = (Uri)e.NewValue; var v = (Uri) e.NewValue;
ctl.GetGifStreamFromPack(v); ctl.GetGifStreamFromPack(v);
ctl.StartAnimate(); ctl.StartAnimate();
} }
@@ -62,8 +62,8 @@ namespace HandyControl.Controls
private static void OnVisibilityChanged(DependencyObject s, DependencyPropertyChangedEventArgs e) private static void OnVisibilityChanged(DependencyObject s, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (GifImage)s; var ctl = (GifImage) s;
var v = (Visibility)e.NewValue; var v = (Visibility) e.NewValue;
if (v != Visibility.Visible) if (v != Visibility.Visible)
{ {
ctl.StopAnimate(); ctl.StopAnimate();
@@ -244,8 +244,8 @@ namespace HandyControl.Controls
created = dataStream = File.OpenRead(filename); created = dataStream = File.OpenRead(filename);
} }
image._rawData = new byte[(int)dataStream.Length]; image._rawData = new byte[(int) dataStream.Length];
dataStream.Read(image._rawData, 0, (int)dataStream.Length); dataStream.Read(image._rawData, 0, (int) dataStream.Length);
} }
finally finally
{ {
@@ -356,7 +356,7 @@ namespace HandyControl.Controls
{ {
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
guids[i] = (Guid)InteropMethods.PtrToStructure((IntPtr)((long)buffer + size * i), typeof(Guid)); guids[i] = (Guid) InteropMethods.PtrToStructure((IntPtr) ((long) buffer + size * i), typeof(Guid));
} }
} }
finally finally
@@ -52,7 +52,7 @@ namespace HandyControl.Controls
private void ImageBlock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) private void ImageBlock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{ {
if(IsVisible) if (IsVisible)
{ {
_dispatcherTimer.Tick += DispatcherTimer_Tick; _dispatcherTimer.Tick += DispatcherTimer_Tick;
if (IsPlaying) if (IsPlaying)
@@ -80,11 +80,11 @@ namespace HandyControl.Controls
private static void OnPositionsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnPositionsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ImageBlock)d; var ctl = (ImageBlock) d;
if (e.Property == ColumnsProperty) if (e.Property == ColumnsProperty)
{ {
ctl._columns = (int)e.NewValue; ctl._columns = (int) e.NewValue;
} }
ctl.UpdateDatas(); ctl.UpdateDatas();
@@ -138,7 +138,7 @@ namespace HandyControl.Controls
private static void OnIsPlayingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIsPlayingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ImageBlock)d; var ctl = (ImageBlock) d;
if ((bool) e.NewValue) if ((bool) e.NewValue)
{ {
ctl._dispatcherTimer.Start(); ctl._dispatcherTimer.Start();
@@ -157,7 +157,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty ColumnsProperty = DependencyProperty.Register( public static readonly DependencyProperty ColumnsProperty = DependencyProperty.Register(
"Columns", typeof(int), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.Int1Box, "Columns", typeof(int), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.Int1Box,
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnPositionsChanged), obj => (int)obj >= 1); FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnPositionsChanged), obj => (int) obj >= 1);
public int Columns public int Columns
{ {
@@ -167,7 +167,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty RowsProperty = DependencyProperty.Register( public static readonly DependencyProperty RowsProperty = DependencyProperty.Register(
"Rows", typeof(int), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.Int1Box, "Rows", typeof(int), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.Int1Box,
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnPositionsChanged), obj => (int)obj >= 1); FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnPositionsChanged), obj => (int) obj >= 1);
public int Rows public int Rows
{ {
@@ -196,14 +196,14 @@ namespace HandyControl.Controls
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ImageBlock)d; var ctl = (ImageBlock) d;
ctl._source = e.NewValue as BitmapSource; ctl._source = e.NewValue as BitmapSource;
ctl.UpdateDatas(); ctl.UpdateDatas();
} }
public ImageSource Source public ImageSource Source
{ {
get => (ImageSource)GetValue(SourceProperty); get => (ImageSource) GetValue(SourceProperty);
set => SetValue(SourceProperty, value); set => SetValue(SourceProperty, value);
} }
@@ -270,19 +270,19 @@ namespace HandyControl.Controls
public bool IsFullScreen public bool IsFullScreen
{ {
get => (bool)GetValue(IsFullScreenProperty); get => (bool) GetValue(IsFullScreenProperty);
set => SetValue(IsFullScreenProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsFullScreenProperty, ValueBoxes.BooleanBox(value));
} }
public bool ShowImgMap public bool ShowImgMap
{ {
get => (bool)GetValue(ShowImgMapProperty); get => (bool) GetValue(ShowImgMapProperty);
set => SetValue(ShowImgMapProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowImgMapProperty, ValueBoxes.BooleanBox(value));
} }
public BitmapFrame ImageSource public BitmapFrame ImageSource
{ {
get => (BitmapFrame)GetValue(ImageSourceProperty); get => (BitmapFrame) GetValue(ImageSourceProperty);
set => SetValue(ImageSourceProperty, value); set => SetValue(ImageSourceProperty, value);
} }
@@ -294,13 +294,13 @@ namespace HandyControl.Controls
internal string ImgPath internal string ImgPath
{ {
get => (string)GetValue(ImgPathProperty); get => (string) GetValue(ImgPathProperty);
set => SetValue(ImgPathProperty, value); set => SetValue(ImgPathProperty, value);
} }
internal long ImgSize internal long ImgSize
{ {
get => (long)GetValue(ImgSizeProperty); get => (long) GetValue(ImgSizeProperty);
set => SetValue(ImgSizeProperty, value); set => SetValue(ImgSizeProperty, value);
} }
@@ -309,49 +309,49 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
internal bool ShowFullScreenButton internal bool ShowFullScreenButton
{ {
get => (bool)GetValue(ShowFullScreenButtonProperty); get => (bool) GetValue(ShowFullScreenButtonProperty);
set => SetValue(ShowFullScreenButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowFullScreenButtonProperty, ValueBoxes.BooleanBox(value));
} }
internal Thickness ImageMargin internal Thickness ImageMargin
{ {
get => (Thickness)GetValue(ImageMarginProperty); get => (Thickness) GetValue(ImageMarginProperty);
set => SetValue(ImageMarginProperty, value); set => SetValue(ImageMarginProperty, value);
} }
internal double ImageWidth internal double ImageWidth
{ {
get => (double)GetValue(ImageWidthProperty); get => (double) GetValue(ImageWidthProperty);
set => SetValue(ImageWidthProperty, value); set => SetValue(ImageWidthProperty, value);
} }
internal double ImageHeight internal double ImageHeight
{ {
get => (double)GetValue(ImageHeightProperty); get => (double) GetValue(ImageHeightProperty);
set => SetValue(ImageHeightProperty, value); set => SetValue(ImageHeightProperty, value);
} }
internal double ImageScale internal double ImageScale
{ {
get => (double)GetValue(ImageScaleProperty); get => (double) GetValue(ImageScaleProperty);
set => SetValue(ImageScaleProperty, value); set => SetValue(ImageScaleProperty, value);
} }
internal string ScaleStr internal string ScaleStr
{ {
get => (string)GetValue(ScaleStrProperty); get => (string) GetValue(ScaleStrProperty);
set => SetValue(ScaleStrProperty, value); set => SetValue(ScaleStrProperty, value);
} }
internal double ImageRotate internal double ImageRotate
{ {
get => (double)GetValue(ImageRotateProperty); get => (double) GetValue(ImageRotateProperty);
set => SetValue(ImageRotateProperty, value); set => SetValue(ImageRotateProperty, value);
} }
internal bool ShowSmallImgInternal internal bool ShowSmallImgInternal
{ {
get => (bool)GetValue(ShowSmallImgInternalProperty); get => (bool) GetValue(ShowSmallImgInternalProperty);
set => SetValue(ShowSmallImgInternalProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowSmallImgInternalProperty, ValueBoxes.BooleanBox(value));
} }
@@ -370,7 +370,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
internal bool ShowCloseButton internal bool ShowCloseButton
{ {
get => (bool)GetValue(ShowCloseButtonProperty); get => (bool) GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -811,7 +811,7 @@ namespace HandyControl.Controls
{ {
_imgActualRotate = rotate; _imgActualRotate = rotate;
_isOblique = ((int)_imgActualRotate - 90) % 180 == 0; _isOblique = ((int) _imgActualRotate - 90) % 180 == 0;
ShowSmallImgInternal = false; ShowSmallImgInternal = false;
Init(); Init();
InitBorderSmall(); InitBorderSmall();
@@ -176,7 +176,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsError public bool IsError
{ {
get => (bool)GetValue(IsErrorProperty); get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
} }
@@ -191,7 +191,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public string ErrorStr public string ErrorStr
{ {
get => (string)GetValue(ErrorStrProperty); get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value); set => SetValue(ErrorStrProperty, value);
} }
@@ -212,7 +212,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public TextType TextType public TextType TextType
{ {
get => (TextType)GetValue(TextTypeProperty); get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value); set => SetValue(TextTypeProperty, value);
} }
@@ -227,7 +227,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool ShowClearButton public bool ShowClearButton
{ {
get => (bool)GetValue(ShowClearButtonProperty); get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -239,7 +239,7 @@ namespace HandyControl.Controls
private static void OnAutoCompleteChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnAutoCompleteChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ComboBox)d; var ctl = (ComboBox) d;
if (ctl._editableTextBox != null) if (ctl._editableTextBox != null)
{ {
ctl.UpdateSearchItems(ctl._editableTextBox.Text); ctl.UpdateSearchItems(ctl._editableTextBox.Text);
@@ -251,7 +251,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool AutoComplete public bool AutoComplete
{ {
get => (bool)GetValue(AutoCompleteProperty); get => (bool) GetValue(AutoCompleteProperty);
set => SetValue(AutoCompleteProperty, ValueBoxes.BooleanBox(value)); set => SetValue(AutoCompleteProperty, ValueBoxes.BooleanBox(value));
} }
@@ -263,7 +263,7 @@ namespace HandyControl.Controls
private static void OnSearchTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSearchTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ComboBox)d; var ctl = (ComboBox) d;
if (ctl._isAutoCompleteAction) if (ctl._isAutoCompleteAction)
{ {
#if NET40 #if NET40
@@ -283,7 +283,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
internal string SearchText internal string SearchText
{ {
get => (string)GetValue(SearchTextProperty); get => (string) GetValue(SearchTextProperty);
set => SetValue(SearchTextProperty, value); set => SetValue(SearchTextProperty, value);
} }
@@ -303,7 +303,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -314,7 +314,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -323,7 +323,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -94,7 +94,7 @@ namespace HandyControl.Controls
public Brush SelectionBrush public Brush SelectionBrush
{ {
get => (Brush)GetValue(SelectionBrushProperty); get => (Brush) GetValue(SelectionBrushProperty);
set => SetValue(SelectionBrushProperty, value); set => SetValue(SelectionBrushProperty, value);
} }
@@ -105,7 +105,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -116,7 +116,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -125,7 +125,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -115,8 +115,8 @@ namespace HandyControl.Controls
private static object CoerceDisplayDateTime(DependencyObject d, object value) private static object CoerceDisplayDateTime(DependencyObject d, object value)
{ {
var dp = (DateTimePicker)d; var dp = (DateTimePicker) d;
dp._calendarWithClock.DisplayDateTime = (DateTime)value; dp._calendarWithClock.DisplayDateTime = (DateTime) value;
return dp._calendarWithClock.DisplayDateTime; return dp._calendarWithClock.DisplayDateTime;
} }
@@ -136,7 +136,7 @@ namespace HandyControl.Controls
{ {
var dp = d as DateTimePicker; var dp = d as DateTimePicker;
var newValue = (bool)e.NewValue; var newValue = (bool) e.NewValue;
if (dp?._popup != null && dp._popup.IsOpen != newValue) if (dp?._popup != null && dp._popup.IsOpen != newValue)
{ {
dp._popup.IsOpen = newValue; dp._popup.IsOpen = newValue;
@@ -144,10 +144,10 @@ namespace HandyControl.Controls
{ {
dp._originalSelectedDateTime = dp.SelectedDateTime; dp._originalSelectedDateTime = dp.SelectedDateTime;
dp.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action)delegate dp.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action) delegate
{ {
dp._calendarWithClock.Focus(); dp._calendarWithClock.Focus();
}); });
} }
} }
} }
@@ -163,8 +163,8 @@ namespace HandyControl.Controls
private static object CoerceSelectedDateTime(DependencyObject d, object value) private static object CoerceSelectedDateTime(DependencyObject d, object value)
{ {
var dp = (DateTimePicker)d; var dp = (DateTimePicker) d;
dp._calendarWithClock.SelectedDateTime = (DateTime?)value; dp._calendarWithClock.SelectedDateTime = (DateTime?) value;
return dp._calendarWithClock.SelectedDateTime; return dp._calendarWithClock.SelectedDateTime;
} }
@@ -275,7 +275,7 @@ namespace HandyControl.Controls
public Brush SelectionBrush public Brush SelectionBrush
{ {
get => (Brush)GetValue(SelectionBrushProperty); get => (Brush) GetValue(SelectionBrushProperty);
set => SetValue(SelectionBrushProperty, value); set => SetValue(SelectionBrushProperty, value);
} }
@@ -286,7 +286,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -297,7 +297,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -306,7 +306,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -645,7 +645,7 @@ namespace HandyControl.Controls
if (d != null) if (d != null)
{ {
SafeSetText(DateTimeToString((DateTime)d)); SafeSetText(DateTimeToString((DateTime) d));
return d; return d;
} }
@@ -711,7 +711,7 @@ namespace HandyControl.Controls
private static void OnGotFocus(object sender, RoutedEventArgs e) private static void OnGotFocus(object sender, RoutedEventArgs e)
{ {
var picker = (DateTimePicker)sender; var picker = (DateTimePicker) sender;
if (!e.Handled && picker._textBox != null) if (!e.Handled && picker._textBox != null)
{ {
if (Equals(e.OriginalSource, picker)) if (Equals(e.OriginalSource, picker))
@@ -1,4 +1,4 @@
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
@@ -187,8 +187,8 @@ namespace HandyControl.Controls
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NumericUpDown)d; var ctl = (NumericUpDown) d;
var v = (double)e.NewValue; var v = (double) e.NewValue;
ctl.SetText(); ctl.SetText();
ctl.OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, ctl) ctl.OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, ctl)
@@ -208,9 +208,9 @@ namespace HandyControl.Controls
private static object CoerceValue(DependencyObject d, object basevalue) private static object CoerceValue(DependencyObject d, object basevalue)
{ {
var ctl = (NumericUpDown)d; var ctl = (NumericUpDown) d;
var minimum = ctl.Minimum; var minimum = ctl.Minimum;
var num = (double)basevalue; var num = (double) basevalue;
if (num < minimum) if (num < minimum)
{ {
ctl.Value = minimum; ctl.Value = minimum;
@@ -230,7 +230,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double Value public double Value
{ {
get => (double)GetValue(ValueProperty); get => (double) GetValue(ValueProperty);
set => SetValue(ValueProperty, value); set => SetValue(ValueProperty, value);
} }
@@ -242,15 +242,15 @@ namespace HandyControl.Controls
private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NumericUpDown)d; var ctl = (NumericUpDown) d;
ctl.CoerceValue(MinimumProperty); ctl.CoerceValue(MinimumProperty);
ctl.CoerceValue(ValueProperty); ctl.CoerceValue(ValueProperty);
} }
private static object CoerceMaximum(DependencyObject d, object basevalue) private static object CoerceMaximum(DependencyObject d, object basevalue)
{ {
var minimum = ((NumericUpDown)d).Minimum; var minimum = ((NumericUpDown) d).Minimum;
return (double)basevalue < minimum ? minimum : basevalue; return (double) basevalue < minimum ? minimum : basevalue;
} }
/// <summary> /// <summary>
@@ -258,7 +258,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double Maximum public double Maximum
{ {
get => (double)GetValue(MaximumProperty); get => (double) GetValue(MaximumProperty);
set => SetValue(MaximumProperty, value); set => SetValue(MaximumProperty, value);
} }
@@ -270,15 +270,15 @@ namespace HandyControl.Controls
private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NumericUpDown)d; var ctl = (NumericUpDown) d;
ctl.CoerceValue(MaximumProperty); ctl.CoerceValue(MaximumProperty);
ctl.CoerceValue(ValueProperty); ctl.CoerceValue(ValueProperty);
} }
private static object CoerceMinimum(DependencyObject d, object basevalue) private static object CoerceMinimum(DependencyObject d, object basevalue)
{ {
var maximum = ((NumericUpDown)d).Maximum; var maximum = ((NumericUpDown) d).Maximum;
return (double)basevalue > maximum ? maximum : basevalue; return (double) basevalue > maximum ? maximum : basevalue;
} }
/// <summary> /// <summary>
@@ -286,7 +286,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double Minimum public double Minimum
{ {
get => (double)GetValue(MinimumProperty); get => (double) GetValue(MinimumProperty);
set => SetValue(MinimumProperty, value); set => SetValue(MinimumProperty, value);
} }
@@ -301,7 +301,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double Increment public double Increment
{ {
get => (double)GetValue(IncrementProperty); get => (double) GetValue(IncrementProperty);
set => SetValue(IncrementProperty, value); set => SetValue(IncrementProperty, value);
} }
@@ -316,7 +316,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public int? DecimalPlaces public int? DecimalPlaces
{ {
get => (int?)GetValue(DecimalPlacesProperty); get => (int?) GetValue(DecimalPlacesProperty);
set => SetValue(DecimalPlacesProperty, value); set => SetValue(DecimalPlacesProperty, value);
} }
@@ -346,7 +346,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
internal bool ShowUpDownButton internal bool ShowUpDownButton
{ {
get => (bool)GetValue(ShowUpDownButtonProperty); get => (bool) GetValue(ShowUpDownButtonProperty);
set => SetValue(ShowUpDownButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowUpDownButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -358,7 +358,7 @@ namespace HandyControl.Controls
public bool IsError public bool IsError
{ {
get => (bool)GetValue(IsErrorProperty); get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
} }
@@ -370,7 +370,7 @@ namespace HandyControl.Controls
public string ErrorStr public string ErrorStr
{ {
get => (string)GetValue(ErrorStrProperty); get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value); set => SetValue(ErrorStrProperty, value);
} }
@@ -385,7 +385,7 @@ namespace HandyControl.Controls
public TextType TextType public TextType TextType
{ {
get => (TextType)GetValue(TextTypeProperty); get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value); set => SetValue(TextTypeProperty, value);
} }
@@ -397,7 +397,7 @@ namespace HandyControl.Controls
public bool ShowClearButton public bool ShowClearButton
{ {
get => (bool)GetValue(ShowClearButtonProperty); get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -412,7 +412,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsReadOnly public bool IsReadOnly
{ {
get => (bool)GetValue(IsReadOnlyProperty); get => (bool) GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
} }
@@ -421,7 +421,7 @@ namespace HandyControl.Controls
public Brush SelectionBrush public Brush SelectionBrush
{ {
get => (Brush)GetValue(SelectionBrushProperty); get => (Brush) GetValue(SelectionBrushProperty);
set => SetValue(SelectionBrushProperty, value); set => SetValue(SelectionBrushProperty, value);
} }
@@ -432,7 +432,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -443,7 +443,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -452,7 +452,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -35,7 +35,7 @@ namespace HandyControl.Controls
public char PasswordChar public char PasswordChar
{ {
get => (char)GetValue(PasswordCharProperty); get => (char) GetValue(PasswordCharProperty);
set => SetValue(PasswordCharProperty, value); set => SetValue(PasswordCharProperty, value);
} }
@@ -47,7 +47,7 @@ namespace HandyControl.Controls
public bool IsError public bool IsError
{ {
get => (bool)GetValue(IsErrorProperty); get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
} }
@@ -59,7 +59,7 @@ namespace HandyControl.Controls
public string ErrorStr public string ErrorStr
{ {
get => (string)GetValue(ErrorStrProperty); get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value); set => SetValue(ErrorStrProperty, value);
} }
@@ -71,7 +71,7 @@ namespace HandyControl.Controls
public TextType TextType public TextType TextType
{ {
get => (TextType)GetValue(TextTypeProperty); get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value); set => SetValue(TextTypeProperty, value);
} }
@@ -83,7 +83,7 @@ namespace HandyControl.Controls
public bool ShowClearButton public bool ShowClearButton
{ {
get => (bool)GetValue(ShowClearButtonProperty); get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -92,7 +92,7 @@ namespace HandyControl.Controls
public bool ShowEyeButton public bool ShowEyeButton
{ {
get => (bool)GetValue(ShowEyeButtonProperty); get => (bool) GetValue(ShowEyeButtonProperty);
set => SetValue(ShowEyeButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowEyeButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
public bool ShowPassword public bool ShowPassword
{ {
get => (bool)GetValue(ShowPasswordProperty); get => (bool) GetValue(ShowPasswordProperty);
set => SetValue(ShowPasswordProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowPasswordProperty, ValueBoxes.BooleanBox(value));
} }
@@ -111,8 +111,8 @@ namespace HandyControl.Controls
private static void OnIsSafeEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIsSafeEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var p = (PasswordBox)d; var p = (PasswordBox) d;
p.SetCurrentValue(UnsafePasswordProperty, !(bool)e.NewValue ? p.Password : string.Empty); p.SetCurrentValue(UnsafePasswordProperty, !(bool) e.NewValue ? p.Password : string.Empty);
} }
public bool IsSafeEnabled public bool IsSafeEnabled
@@ -145,7 +145,7 @@ namespace HandyControl.Controls
public int MaxLength public int MaxLength
{ {
get => (int)GetValue(MaxLengthProperty); get => (int) GetValue(MaxLengthProperty);
set => SetValue(MaxLengthProperty, value); set => SetValue(MaxLengthProperty, value);
} }
@@ -154,7 +154,7 @@ namespace HandyControl.Controls
public Brush SelectionBrush public Brush SelectionBrush
{ {
get => (Brush)GetValue(SelectionBrushProperty); get => (Brush) GetValue(SelectionBrushProperty);
set => SetValue(SelectionBrushProperty, value); set => SetValue(SelectionBrushProperty, value);
} }
@@ -165,7 +165,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -176,7 +176,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -185,7 +185,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -265,9 +265,9 @@ namespace HandyControl.Controls
private static void OnShowPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnShowPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (PasswordBox)d; var ctl = (PasswordBox) d;
if (!ctl.ShowEyeButton) return; if (!ctl.ShowEyeButton) return;
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
ctl._textBox.Text = ctl.ActualPasswordBox.Password; ctl._textBox.Text = ctl.ActualPasswordBox.Password;
ctl._textBox.Select(string.IsNullOrEmpty(ctl._textBox.Text) ? 0 : ctl._textBox.Text.Length, 0); ctl._textBox.Select(string.IsNullOrEmpty(ctl._textBox.Text) ? 0 : ctl._textBox.Text.Length, 0);
@@ -211,7 +211,7 @@ namespace HandyControl.Controls
public char PasswordChar public char PasswordChar
{ {
get => (char)GetValue(PasswordCharProperty); get => (char) GetValue(PasswordCharProperty);
set => SetValue(PasswordCharProperty, value); set => SetValue(PasswordCharProperty, value);
} }
@@ -224,7 +224,7 @@ namespace HandyControl.Controls
ctl.UpdateItems(); ctl.UpdateItems();
} }
private static object CoerceLength(DependencyObject d, object basevalue) => (int)basevalue < 4 ? MinLength : basevalue; private static object CoerceLength(DependencyObject d, object basevalue) => (int) basevalue < 4 ? MinLength : basevalue;
public int Length public int Length
{ {
@@ -264,7 +264,7 @@ namespace HandyControl.Controls
public Brush SelectionBrush public Brush SelectionBrush
{ {
get => (Brush)GetValue(SelectionBrushProperty); get => (Brush) GetValue(SelectionBrushProperty);
set => SetValue(SelectionBrushProperty, value); set => SetValue(SelectionBrushProperty, value);
} }
@@ -275,7 +275,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -286,7 +286,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -295,7 +295,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -76,7 +76,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsRealTime public bool IsRealTime
{ {
get => (bool)GetValue(IsRealTimeProperty); get => (bool) GetValue(IsRealTimeProperty);
set => SetValue(IsRealTimeProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsRealTimeProperty, ValueBoxes.BooleanBox(value));
} }
@@ -85,7 +85,7 @@ namespace HandyControl.Controls
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (SearchBar)d; var ctl = (SearchBar) d;
if (e.OldValue is ICommand oldCommand) if (e.OldValue is ICommand oldCommand)
{ {
oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged; oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged;
@@ -46,7 +46,7 @@ namespace HandyControl.Controls
public string ErrorStr public string ErrorStr
{ {
get => (string)GetValue(ErrorStrProperty); get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value); set => SetValue(ErrorStrProperty, value);
} }
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
public TextType TextType public TextType TextType
{ {
get => (TextType)GetValue(TextTypeProperty); get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value); set => SetValue(TextTypeProperty, value);
} }
@@ -97,7 +97,7 @@ namespace HandyControl.Controls
public string TimeFormat public string TimeFormat
{ {
get => (string)GetValue(TimeFormatProperty); get => (string) GetValue(TimeFormatProperty);
set => SetValue(TimeFormatProperty, value); set => SetValue(TimeFormatProperty, value);
} }
@@ -107,7 +107,7 @@ namespace HandyControl.Controls
public DateTime DisplayTime public DateTime DisplayTime
{ {
get => (DateTime)GetValue(DisplayTimeProperty); get => (DateTime) GetValue(DisplayTimeProperty);
set => SetValue(DisplayTimeProperty, value); set => SetValue(DisplayTimeProperty, value);
} }
@@ -120,8 +120,8 @@ namespace HandyControl.Controls
private static object CoerceDisplayTime(DependencyObject d, object value) private static object CoerceDisplayTime(DependencyObject d, object value)
{ {
var dp = (TimePicker)d; var dp = (TimePicker) d;
dp.Clock.DisplayTime = (DateTime)value; dp.Clock.DisplayTime = (DateTime) value;
return dp.Clock.DisplayTime; return dp.Clock.DisplayTime;
} }
@@ -131,7 +131,7 @@ namespace HandyControl.Controls
public bool IsDropDownOpen public bool IsDropDownOpen
{ {
get => (bool)GetValue(IsDropDownOpenProperty); get => (bool) GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
} }
@@ -148,7 +148,7 @@ namespace HandyControl.Controls
{ {
var dp = d as TimePicker; var dp = d as TimePicker;
var newValue = (bool)e.NewValue; var newValue = (bool) e.NewValue;
if (dp?._popup != null && dp._popup.IsOpen != newValue) if (dp?._popup != null && dp._popup.IsOpen != newValue)
{ {
dp._popup.IsOpen = newValue; dp._popup.IsOpen = newValue;
@@ -156,10 +156,10 @@ namespace HandyControl.Controls
{ {
dp._originalSelectedTime = dp.SelectedTime; dp._originalSelectedTime = dp.SelectedTime;
dp.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action)delegate dp.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action) delegate
{ {
dp.Clock.Focus(); dp.Clock.Focus();
}); });
} }
} }
} }
@@ -170,7 +170,7 @@ namespace HandyControl.Controls
public DateTime? SelectedTime public DateTime? SelectedTime
{ {
get => (DateTime?)GetValue(SelectedTimeProperty); get => (DateTime?) GetValue(SelectedTimeProperty);
set => SetValue(SelectedTimeProperty, value); set => SetValue(SelectedTimeProperty, value);
} }
@@ -199,8 +199,8 @@ namespace HandyControl.Controls
private static object CoerceSelectedTime(DependencyObject d, object value) private static object CoerceSelectedTime(DependencyObject d, object value)
{ {
var dp = (TimePicker)d; var dp = (TimePicker) d;
dp.Clock.SelectedTime = (DateTime?)value; dp.Clock.SelectedTime = (DateTime?) value;
return dp.Clock.SelectedTime; return dp.Clock.SelectedTime;
} }
@@ -210,7 +210,7 @@ namespace HandyControl.Controls
public string Text public string Text
{ {
get => (string)GetValue(TextProperty); get => (string) GetValue(TextProperty);
set => SetValue(TextProperty, value); set => SetValue(TextProperty, value);
} }
@@ -263,7 +263,7 @@ namespace HandyControl.Controls
public bool IsError public bool IsError
{ {
get => (bool)GetValue(IsErrorProperty); get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
} }
@@ -272,7 +272,7 @@ namespace HandyControl.Controls
public string ErrorStr public string ErrorStr
{ {
get => (string)GetValue(ErrorStrProperty); get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value); set => SetValue(ErrorStrProperty, value);
} }
@@ -281,7 +281,7 @@ namespace HandyControl.Controls
public TextType TextType public TextType TextType
{ {
get => (TextType)GetValue(TextTypeProperty); get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value); set => SetValue(TextTypeProperty, value);
} }
@@ -290,7 +290,7 @@ namespace HandyControl.Controls
public bool ShowClearButton public bool ShowClearButton
{ {
get => (bool)GetValue(ShowClearButtonProperty); get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -299,7 +299,7 @@ namespace HandyControl.Controls
public Brush SelectionBrush public Brush SelectionBrush
{ {
get => (Brush)GetValue(SelectionBrushProperty); get => (Brush) GetValue(SelectionBrushProperty);
set => SetValue(SelectionBrushProperty, value); set => SetValue(SelectionBrushProperty, value);
} }
@@ -310,7 +310,7 @@ namespace HandyControl.Controls
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush)GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
@@ -321,7 +321,7 @@ namespace HandyControl.Controls
public double SelectionOpacity public double SelectionOpacity
{ {
get => (double)GetValue(SelectionOpacityProperty); get => (double) GetValue(SelectionOpacityProperty);
set => SetValue(SelectionOpacityProperty, value); set => SetValue(SelectionOpacityProperty, value);
} }
@@ -330,7 +330,7 @@ namespace HandyControl.Controls
public Brush CaretBrush public Brush CaretBrush
{ {
get => (Brush)GetValue(CaretBrushProperty); get => (Brush) GetValue(CaretBrushProperty);
set => SetValue(CaretBrushProperty, value); set => SetValue(CaretBrushProperty, value);
} }
@@ -339,7 +339,7 @@ namespace HandyControl.Controls
private static void OnClockChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnClockChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (TimePicker)d; var ctl = (TimePicker) d;
var oldClock = e.OldValue as ClockBase; var oldClock = e.OldValue as ClockBase;
var newClock = e.NewValue as ClockBase; var newClock = e.NewValue as ClockBase;
@@ -359,7 +359,7 @@ namespace HandyControl.Controls
public ClockBase Clock public ClockBase Clock
{ {
get => (ClockBase)GetValue(ClockProperty); get => (ClockBase) GetValue(ClockProperty);
set => SetValue(ClockProperty, value); set => SetValue(ClockProperty, value);
} }
@@ -469,7 +469,7 @@ namespace HandyControl.Controls
} }
else else
{ {
_textBox.Text = DateTimeToString((DateTime)SelectedTime); _textBox.Text = DateTimeToString((DateTime) SelectedTime);
} }
} }
@@ -685,13 +685,13 @@ namespace HandyControl.Controls
if (d != null) if (d != null)
{ {
SafeSetText(DateTimeToString((DateTime)d)); SafeSetText(DateTimeToString((DateTime) d));
return d; return d;
} }
if (SelectedTime != null) if (SelectedTime != null)
{ {
var newtext = DateTimeToString((DateTime)SelectedTime); var newtext = DateTimeToString((DateTime) SelectedTime);
SafeSetText(newtext); SafeSetText(newtext);
return SelectedTime; return SelectedTime;
} }
@@ -746,7 +746,7 @@ namespace HandyControl.Controls
private static void OnGotFocus(object sender, RoutedEventArgs e) private static void OnGotFocus(object sender, RoutedEventArgs e)
{ {
var picker = (TimePicker)sender; var picker = (TimePicker) sender;
if (!e.Handled && picker._textBox != null) if (!e.Handled && picker._textBox != null)
{ {
if (Equals(e.OriginalSource, picker)) if (Equals(e.OriginalSource, picker))
@@ -125,11 +125,11 @@ namespace HandyControl.Controls
protected virtual Ellipse CreateEllipse(int index) protected virtual Ellipse CreateEllipse(int index)
{ {
var ellipse = new Ellipse(); var ellipse = new Ellipse();
ellipse.SetBinding(WidthProperty, new Binding(DotDiameterProperty.Name) {Source = this}); ellipse.SetBinding(WidthProperty, new Binding(DotDiameterProperty.Name) { Source = this });
ellipse.SetBinding(HeightProperty, new Binding(DotDiameterProperty.Name) {Source = this}); ellipse.SetBinding(HeightProperty, new Binding(DotDiameterProperty.Name) { Source = this });
ellipse.SetBinding(Shape.FillProperty, new Binding(ForegroundProperty.Name) {Source = this}); ellipse.SetBinding(Shape.FillProperty, new Binding(ForegroundProperty.Name) { Source = this });
ellipse.SetBinding(Shape.StrokeThicknessProperty, new Binding(DotBorderThicknessProperty.Name) {Source = this}); ellipse.SetBinding(Shape.StrokeThicknessProperty, new Binding(DotBorderThicknessProperty.Name) { Source = this });
ellipse.SetBinding(Shape.StrokeProperty, new Binding(DotBorderBrushProperty.Name) {Source = this}); ellipse.SetBinding(Shape.StrokeProperty, new Binding(DotBorderBrushProperty.Name) { Source = this });
return ellipse; return ellipse;
} }
} }
@@ -64,7 +64,7 @@ namespace HandyControl.Controls
EasingMode = EasingMode.EaseOut EasingMode = EasingMode.EaseOut
}, },
Value = new Thickness(speedDownLength + ellipse.Margin.Left, 0, 0, 0), Value = new Thickness(speedDownLength + ellipse.Margin.Left, 0, 0, 0),
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(dotSpeed * (1 - UniformScale)/2)) KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(dotSpeed * (1 - UniformScale) / 2))
}; };
//匀速开始到匀速结束 //匀速开始到匀速结束
@@ -42,7 +42,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public Geometry Data public Geometry Data
{ {
get => (Geometry)GetValue(DataProperty); get => (Geometry) GetValue(DataProperty);
set => SetValue(DataProperty, value); set => SetValue(DataProperty, value);
} }
@@ -59,7 +59,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double PathLength public double PathLength
{ {
get => (double)GetValue(PathLengthProperty); get => (double) GetValue(PathLengthProperty);
set => SetValue(PathLengthProperty, value); set => SetValue(PathLengthProperty, value);
} }
@@ -75,15 +75,15 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public Duration Duration public Duration Duration
{ {
get => (Duration)GetValue(DurationProperty); get => (Duration) GetValue(DurationProperty);
set => SetValue(DurationProperty, value); set => SetValue(DurationProperty, value);
} }
public static readonly DependencyProperty IsPlayingProperty = DependencyProperty.Register( public static readonly DependencyProperty IsPlayingProperty = DependencyProperty.Register(
"IsPlaying", typeof(bool), typeof(AnimationPath), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, (o, args) => "IsPlaying", typeof(bool), typeof(AnimationPath), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, (o, args) =>
{ {
var ctl = (AnimationPath)o; var ctl = (AnimationPath) o;
var v = (bool)args.NewValue; var v = (bool) args.NewValue;
if (v) if (v)
{ {
ctl.UpdatePath(); ctl.UpdatePath();
@@ -99,7 +99,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsPlaying public bool IsPlaying
{ {
get => (bool)GetValue(IsPlayingProperty); get => (bool) GetValue(IsPlayingProperty);
set => SetValue(IsPlayingProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsPlayingProperty, ValueBoxes.BooleanBox(value));
} }
@@ -111,7 +111,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public RepeatBehavior RepeatBehavior public RepeatBehavior RepeatBehavior
{ {
get => (RepeatBehavior)GetValue(RepeatBehaviorProperty); get => (RepeatBehavior) GetValue(RepeatBehaviorProperty);
set => SetValue(RepeatBehaviorProperty, value); set => SetValue(RepeatBehaviorProperty, value);
} }
@@ -35,8 +35,8 @@ namespace HandyControl.Controls
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (Badge)d; var ctl = (Badge) d;
var v = (int)e.NewValue; var v = (int) e.NewValue;
ctl.Text = v <= ctl.Maximum ? v.ToString() : $"{ctl.Maximum}+"; ctl.Text = v <= ctl.Maximum ? v.ToString() : $"{ctl.Maximum}+";
if (ctl.IsInitialized) if (ctl.IsInitialized)
{ {
@@ -49,7 +49,7 @@ namespace HandyControl.Controls
public int Value public int Value
{ {
get => (int)GetValue(ValueProperty); get => (int) GetValue(ValueProperty);
set => SetValue(ValueProperty, value); set => SetValue(ValueProperty, value);
} }
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
public BadgeStatus Status public BadgeStatus Status
{ {
get => (BadgeStatus)GetValue(StatusProperty); get => (BadgeStatus) GetValue(StatusProperty);
set => SetValue(StatusProperty, value); set => SetValue(StatusProperty, value);
} }
@@ -67,7 +67,7 @@ namespace HandyControl.Controls
public int Maximum public int Maximum
{ {
get => (int)GetValue(MaximumProperty); get => (int) GetValue(MaximumProperty);
set => SetValue(MaximumProperty, value); set => SetValue(MaximumProperty, value);
} }
@@ -76,7 +76,7 @@ namespace HandyControl.Controls
public Thickness BadgeMargin public Thickness BadgeMargin
{ {
get => (Thickness)GetValue(BadgeMarginProperty); get => (Thickness) GetValue(BadgeMarginProperty);
set => SetValue(BadgeMarginProperty, value); set => SetValue(BadgeMarginProperty, value);
} }
@@ -100,7 +100,7 @@ namespace HandyControl.Controls
public FrameworkElement Content public FrameworkElement Content
{ {
get => (FrameworkElement)GetValue(ContentProperty); get => (FrameworkElement) GetValue(ContentProperty);
set => SetValue(ContentProperty, value); set => SetValue(ContentProperty, value);
} }
@@ -29,7 +29,7 @@ namespace HandyControl.Controls
private static void OnClearPenCache(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnClearPenCache(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var border = (DashedBorder)d; var border = (DashedBorder) d;
border.LeftPenCache = null; border.LeftPenCache = null;
border.RightPenCache = null; border.RightPenCache = null;
border.TopPenCache = null; border.TopPenCache = null;
@@ -73,7 +73,7 @@ namespace HandyControl.Controls
} }
private static void DataContextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => private static void DataContextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) =>
((Drawer)d).OnDataContextPropertyChanged(e); ((Drawer) d).OnDataContextPropertyChanged(e);
private void OnDataContextPropertyChanged(DependencyPropertyChangedEventArgs e) => UpdateDataContext(_animationControl, e.OldValue, e.NewValue); private void OnDataContextPropertyChanged(DependencyPropertyChangedEventArgs e) => UpdateDataContext(_animationControl, e.OldValue, e.NewValue);
@@ -103,7 +103,7 @@ namespace HandyControl.Controls
private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (Drawer) d; var ctl = (Drawer) d;
ctl.OnIsOpenChanged((bool)e.NewValue); ctl.OnIsOpenChanged((bool) e.NewValue);
} }
public bool IsOpen public bool IsOpen
@@ -18,7 +18,7 @@ namespace HandyControl.Controls
public DependencyObject Target public DependencyObject Target
{ {
get => (DependencyObject)GetValue(TargetProperty); get => (DependencyObject) GetValue(TargetProperty);
set => SetValue(TargetProperty, value); set => SetValue(TargetProperty, value);
} }
@@ -23,7 +23,7 @@ namespace HandyControl.Controls
{ {
var ctl = (Gravatar) d; var ctl = (Gravatar) d;
if (ctl.Source != null) return; if (ctl.Source != null) return;
ctl.Content = ctl.Generator.GetGravatar((string)e.NewValue); ctl.Content = ctl.Generator.GetGravatar((string) e.NewValue);
} }
public string Id public string Id
@@ -37,7 +37,7 @@ namespace HandyControl.Controls
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (Gravatar)d; var ctl = (Gravatar) d;
var v = (ImageSource) e.NewValue; var v = (ImageSource) e.NewValue;
ctl.Background = v != null ctl.Background = v != null
@@ -45,11 +45,11 @@ namespace HandyControl.Controls
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register( public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register(
"Scale", typeof(double), typeof(Magnifier), new PropertyMetadata(5.0, OnScaleChanged), ValidateHelper.IsInRangeOfPosDouble); "Scale", typeof(double), typeof(Magnifier), new PropertyMetadata(5.0, OnScaleChanged), ValidateHelper.IsInRangeOfPosDouble);
private static void OnScaleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((Magnifier)d).UpdateViewboxSize(); private static void OnScaleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((Magnifier) d).UpdateViewboxSize();
public double Scale public double Scale
{ {
get => (double)GetValue(ScaleProperty); get => (double) GetValue(ScaleProperty);
set => SetValue(ScaleProperty, value); set => SetValue(ScaleProperty, value);
} }
@@ -76,7 +76,7 @@ namespace HandyControl.Controls
private void UpdateViewboxSize() => _viewboxSize = new Size(ActualWidth / Scale, ActualHeight / Scale); private void UpdateViewboxSize() => _viewboxSize = new Size(ActualWidth / Scale, ActualHeight / Scale);
protected sealed override void OnTargetChanged(FrameworkElement element , bool isNew) protected sealed override void OnTargetChanged(FrameworkElement element, bool isNew)
{ {
base.OnTargetChanged(element, isNew); base.OnTargetChanged(element, isNew);
@@ -129,7 +129,7 @@ namespace HandyControl.Controls
{ {
layer.Remove(_adornerContainer); layer.Remove(_adornerContainer);
} }
else if(_adornerContainer != null && _adornerContainer.Parent is AdornerLayer parent) else if (_adornerContainer != null && _adornerContainer.Parent is AdornerLayer parent)
{ {
parent.Remove(_adornerContainer); parent.Remove(_adornerContainer);
} }
@@ -69,8 +69,8 @@ namespace HandyControl.Controls
private static void OnVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NotifyIcon)d; var ctl = (NotifyIcon) d;
var v = (Visibility)e.NewValue; var v = (Visibility) e.NewValue;
if (v == Visibility.Visible) if (v == Visibility.Visible)
{ {
@@ -97,7 +97,7 @@ namespace HandyControl.Controls
private static void ContextMenuPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void ContextMenuPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NotifyIcon)d; var ctl = (NotifyIcon) d;
ctl.OnContextMenuPropertyChanged(e); ctl.OnContextMenuPropertyChanged(e);
} }
@@ -249,7 +249,7 @@ namespace HandyControl.Controls
public string Token public string Token
{ {
get => (string)GetValue(TokenProperty); get => (string) GetValue(TokenProperty);
set => SetValue(TokenProperty, value); set => SetValue(TokenProperty, value);
} }
@@ -258,7 +258,7 @@ namespace HandyControl.Controls
public string Text public string Text
{ {
get => (string)GetValue(TextProperty); get => (string) GetValue(TextProperty);
set => SetValue(TextProperty, value); set => SetValue(TextProperty, value);
} }
@@ -267,8 +267,8 @@ namespace HandyControl.Controls
private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NotifyIcon)d; var ctl = (NotifyIcon) d;
ctl._icon = (ImageSource)e.NewValue; ctl._icon = (ImageSource) e.NewValue;
ctl.OnIconChanged(); ctl.OnIconChanged();
if (!string.IsNullOrEmpty(ctl._windowClassName) && !ctl.IsBlink && ctl.Visibility == Visibility.Visible) if (!string.IsNullOrEmpty(ctl._windowClassName) && !ctl.IsBlink && ctl.Visibility == Visibility.Visible)
@@ -279,7 +279,7 @@ namespace HandyControl.Controls
public ImageSource Icon public ImageSource Icon
{ {
get => (ImageSource)GetValue(IconProperty); get => (ImageSource) GetValue(IconProperty);
set => SetValue(IconProperty, value); set => SetValue(IconProperty, value);
} }
@@ -297,16 +297,16 @@ namespace HandyControl.Controls
private static void OnBlinkIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnBlinkIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NotifyIcon)d; var ctl = (NotifyIcon) d;
if (ctl._dispatcherTimerBlink != null) if (ctl._dispatcherTimerBlink != null)
{ {
ctl._dispatcherTimerBlink.Interval = (TimeSpan)e.NewValue; ctl._dispatcherTimerBlink.Interval = (TimeSpan) e.NewValue;
} }
} }
public TimeSpan BlinkInterval public TimeSpan BlinkInterval
{ {
get => (TimeSpan)GetValue(BlinkIntervalProperty); get => (TimeSpan) GetValue(BlinkIntervalProperty);
set => SetValue(BlinkIntervalProperty, value); set => SetValue(BlinkIntervalProperty, value);
} }
@@ -315,9 +315,9 @@ namespace HandyControl.Controls
private static void OnIsBlinkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIsBlinkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (NotifyIcon)d; var ctl = (NotifyIcon) d;
if (ctl.Visibility != Visibility.Visible) return; if (ctl.Visibility != Visibility.Visible) return;
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
if (ctl._dispatcherTimerBlink == null) if (ctl._dispatcherTimerBlink == null)
{ {
@@ -339,7 +339,7 @@ namespace HandyControl.Controls
public bool IsBlink public bool IsBlink
{ {
get => (bool)GetValue(IsBlinkProperty); get => (bool) GetValue(IsBlinkProperty);
set => SetValue(IsBlinkProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsBlinkProperty, ValueBoxes.BooleanBox(value));
} }
@@ -436,7 +436,7 @@ namespace HandyControl.Controls
private bool FindNotifyIcon(IntPtr hTrayWnd, ref List<InteropValues.RECT> rectNotifyList) private bool FindNotifyIcon(IntPtr hTrayWnd, ref List<InteropValues.RECT> rectNotifyList)
{ {
InteropMethods.GetWindowRect(hTrayWnd, out var rectTray); InteropMethods.GetWindowRect(hTrayWnd, out var rectTray);
var count = (int)InteropMethods.SendMessage(hTrayWnd, InteropValues.TB_BUTTONCOUNT, 0, IntPtr.Zero); var count = (int) InteropMethods.SendMessage(hTrayWnd, InteropValues.TB_BUTTONCOUNT, 0, IntPtr.Zero);
var isFind = false; var isFind = false;
if (count > 0) if (count > 0)
@@ -463,7 +463,7 @@ namespace HandyControl.Controls
InteropMethods.ReadProcessMemory(hProcess, btnData.dwData, out trayData, Marshal.SizeOf(trayData), out _); InteropMethods.ReadProcessMemory(hProcess, btnData.dwData, out trayData, Marshal.SizeOf(trayData), out _);
InteropMethods.GetWindowThreadProcessId(trayData.hwnd, out var dwProcessId); InteropMethods.GetWindowThreadProcessId(trayData.hwnd, out var dwProcessId);
if (dwProcessId == (uint)handle) if (dwProcessId == (uint) handle)
{ {
var rect = new InteropValues.RECT(); var rect = new InteropValues.RECT();
var lngRect = InteropMethods.VirtualAllocEx(hProcess, IntPtr.Zero, Marshal.SizeOf(typeof(Rect)), InteropValues.AllocationType.Commit, InteropValues.MemoryProtection.ReadWrite); var lngRect = InteropMethods.VirtualAllocEx(hProcess, IntPtr.Zero, Marshal.SizeOf(typeof(Rect)), InteropValues.AllocationType.Commit, InteropValues.MemoryProtection.ReadWrite);
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
}, (o, value) => }, (o, value) =>
{ {
if (!(o is Pagination)) return 1; if (!(o is Pagination)) return 1;
var intValue = (int)value; var intValue = (int) value;
if (intValue < 1) if (intValue < 1)
{ {
return 1; return 1;
@@ -115,7 +115,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public int MaxPageCount public int MaxPageCount
{ {
get => (int)GetValue(MaxPageCountProperty); get => (int) GetValue(MaxPageCountProperty);
set => SetValue(MaxPageCountProperty, value); set => SetValue(MaxPageCountProperty, value);
} }
@@ -136,7 +136,7 @@ namespace HandyControl.Controls
}, (o, value) => }, (o, value) =>
{ {
if (!(o is Pagination)) return 1; if (!(o is Pagination)) return 1;
var intValue = (int)value; var intValue = (int) value;
if (intValue < 1) if (intValue < 1)
{ {
return 1; return 1;
@@ -149,7 +149,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public int DataCountPerPage public int DataCountPerPage
{ {
get => (int)GetValue(DataCountPerPageProperty); get => (int) GetValue(DataCountPerPageProperty);
set => SetValue(DataCountPerPageProperty, value); set => SetValue(DataCountPerPageProperty, value);
} }
@@ -174,7 +174,7 @@ namespace HandyControl.Controls
}, (o, value) => }, (o, value) =>
{ {
if (!(o is Pagination pagination)) return 1; if (!(o is Pagination pagination)) return 1;
var intValue = (int)value; var intValue = (int) value;
if (intValue < 0) if (intValue < 0)
{ {
return 0; return 0;
@@ -188,7 +188,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public int PageIndex public int PageIndex
{ {
get => (int)GetValue(PageIndexProperty); get => (int) GetValue(PageIndexProperty);
set => SetValue(PageIndexProperty, value); set => SetValue(PageIndexProperty, value);
} }
@@ -208,7 +208,7 @@ namespace HandyControl.Controls
} }
}), value => }), value =>
{ {
var intValue = (int)value; var intValue = (int) value;
return intValue >= 0; return intValue >= 0;
}); });
@@ -217,7 +217,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public int MaxPageInterval public int MaxPageInterval
{ {
get => (int)GetValue(MaxPageIntervalProperty); get => (int) GetValue(MaxPageIntervalProperty);
set => SetValue(MaxPageIntervalProperty, value); set => SetValue(MaxPageIntervalProperty, value);
} }
@@ -21,7 +21,7 @@ namespace HandyControl.Controls
Child = this Child = this
}; };
_popup.SetBinding(DataContextProperty, new Binding(DataContextProperty.Name) {Source = this}); _popup.SetBinding(DataContextProperty, new Binding(DataContextProperty.Name) { Source = this });
} }
public static readonly DependencyProperty HitModeProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty HitModeProperty = DependencyProperty.RegisterAttached(
@@ -35,7 +35,7 @@ namespace HandyControl.Controls
public HitMode HitMode public HitMode HitMode
{ {
get => (HitMode)GetValue(HitModeProperty); get => (HitMode) GetValue(HitModeProperty);
set => SetValue(HitModeProperty, value); set => SetValue(HitModeProperty, value);
} }
@@ -69,7 +69,7 @@ namespace HandyControl.Controls
public DataTemplate ContentTemplate public DataTemplate ContentTemplate
{ {
get => (DataTemplate)GetValue(ContentTemplateProperty); get => (DataTemplate) GetValue(ContentTemplateProperty);
set => SetValue(ContentTemplateProperty, value); set => SetValue(ContentTemplateProperty, value);
} }
@@ -78,7 +78,7 @@ namespace HandyControl.Controls
public string ContentStringFormat public string ContentStringFormat
{ {
get => (string)GetValue(ContentStringFormatProperty); get => (string) GetValue(ContentStringFormatProperty);
set => SetValue(ContentStringFormatProperty, value); set => SetValue(ContentStringFormatProperty, value);
} }
@@ -87,7 +87,7 @@ namespace HandyControl.Controls
public DataTemplateSelector ContentTemplateSelector public DataTemplateSelector ContentTemplateSelector
{ {
get => (DataTemplateSelector)GetValue(ContentTemplateSelectorProperty); get => (DataTemplateSelector) GetValue(ContentTemplateSelectorProperty);
set => SetValue(ContentTemplateSelectorProperty, value); set => SetValue(ContentTemplateSelectorProperty, value);
} }
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
public double Offset public double Offset
{ {
get => (double)GetValue(OffsetProperty); get => (double) GetValue(OffsetProperty);
set => SetValue(OffsetProperty, value); set => SetValue(OffsetProperty, value);
} }
@@ -117,7 +117,7 @@ namespace HandyControl.Controls
public PlacementType PlacementType public PlacementType PlacementType
{ {
get => (PlacementType)GetValue(PlacementTypeProperty); get => (PlacementType) GetValue(PlacementTypeProperty);
set => SetValue(PlacementTypeProperty, value); set => SetValue(PlacementTypeProperty, value);
} }
@@ -132,7 +132,7 @@ namespace HandyControl.Controls
} }
else else
{ {
((Poptip)GetInstance(d))?.SwitchPoptip((bool)e.NewValue); ((Poptip) GetInstance(d))?.SwitchPoptip((bool) e.NewValue);
} }
} }
@@ -191,7 +191,7 @@ namespace HandyControl.Controls
var offsetX = .0; var offsetX = .0;
var offsetY = .0; var offsetY = .0;
var poptip = (Poptip)GetInstance(Target); var poptip = (Poptip) GetInstance(Target);
var popupPlacement = poptip.PlacementType; var popupPlacement = poptip.PlacementType;
var popupOffset = poptip.Offset; var popupOffset = poptip.Offset;
@@ -147,7 +147,7 @@ namespace HandyControl.Controls
public static void SetIsInertiaEnabled(DependencyObject element, bool value) => element.SetValue(IsInertiaEnabledProperty, ValueBoxes.BooleanBox(value)); public static void SetIsInertiaEnabled(DependencyObject element, bool value) => element.SetValue(IsInertiaEnabledProperty, ValueBoxes.BooleanBox(value));
public static bool GetIsInertiaEnabled(DependencyObject element) => (bool)element.GetValue(IsInertiaEnabledProperty); public static bool GetIsInertiaEnabled(DependencyObject element) => (bool) element.GetValue(IsInertiaEnabledProperty);
/// <summary> /// <summary>
/// 是否支持惯性 /// 是否支持惯性
@@ -24,7 +24,7 @@ namespace HandyControl.Controls
{ {
_isLeftButtonPressed = true; _isLeftButtonPressed = true;
} }
else if(_isLeftButtonPressed) else if (_isLeftButtonPressed)
{ {
if (Left < 0) if (Left < 0)
{ {
@@ -28,7 +28,7 @@ namespace HandyControl.Controls
=> element.SetValue(OrderProperty, value); => element.SetValue(OrderProperty, value);
public static int GetOrder(DependencyObject element) public static int GetOrder(DependencyObject element)
=> (int)element.GetValue(OrderProperty); => (int) element.GetValue(OrderProperty);
public static readonly DependencyProperty FlexGrowProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty FlexGrowProperty = DependencyProperty.RegisterAttached(
"FlexGrow", typeof(double), typeof(FlexPanel), "FlexGrow", typeof(double), typeof(FlexPanel),
@@ -39,7 +39,7 @@ namespace HandyControl.Controls
=> element.SetValue(FlexGrowProperty, value); => element.SetValue(FlexGrowProperty, value);
public static double GetFlexGrow(DependencyObject element) public static double GetFlexGrow(DependencyObject element)
=> (double)element.GetValue(FlexGrowProperty); => (double) element.GetValue(FlexGrowProperty);
public static readonly DependencyProperty FlexShrinkProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty FlexShrinkProperty = DependencyProperty.RegisterAttached(
"FlexShrink", typeof(double), typeof(FlexPanel), "FlexShrink", typeof(double), typeof(FlexPanel),
@@ -50,7 +50,7 @@ namespace HandyControl.Controls
=> element.SetValue(FlexShrinkProperty, value); => element.SetValue(FlexShrinkProperty, value);
public static double GetFlexShrink(DependencyObject element) public static double GetFlexShrink(DependencyObject element)
=> (double)element.GetValue(FlexShrinkProperty); => (double) element.GetValue(FlexShrinkProperty);
public static readonly DependencyProperty FlexBasisProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty FlexBasisProperty = DependencyProperty.RegisterAttached(
"FlexBasis", typeof(double), typeof(FlexPanel), "FlexBasis", typeof(double), typeof(FlexPanel),
@@ -60,7 +60,7 @@ namespace HandyControl.Controls
=> element.SetValue(FlexBasisProperty, value); => element.SetValue(FlexBasisProperty, value);
public static double GetFlexBasis(DependencyObject element) public static double GetFlexBasis(DependencyObject element)
=> (double)element.GetValue(FlexBasisProperty); => (double) element.GetValue(FlexBasisProperty);
public static readonly DependencyProperty AlignSelfProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty AlignSelfProperty = DependencyProperty.RegisterAttached(
"AlignSelf", typeof(FlexItemAlignment), typeof(FlexPanel), "AlignSelf", typeof(FlexItemAlignment), typeof(FlexPanel),
@@ -74,7 +74,7 @@ namespace HandyControl.Controls
#region Panel #region Panel
public static FlexItemAlignment GetAlignSelf(DependencyObject element) public static FlexItemAlignment GetAlignSelf(DependencyObject element)
=> (FlexItemAlignment)element.GetValue(AlignSelfProperty); => (FlexItemAlignment) element.GetValue(AlignSelfProperty);
public static readonly DependencyProperty FlexDirectionProperty = DependencyProperty.Register( public static readonly DependencyProperty FlexDirectionProperty = DependencyProperty.Register(
"FlexDirection", typeof(FlexDirection), typeof(FlexPanel), "FlexDirection", typeof(FlexDirection), typeof(FlexPanel),
@@ -82,7 +82,7 @@ namespace HandyControl.Controls
public FlexDirection FlexDirection public FlexDirection FlexDirection
{ {
get => (FlexDirection)GetValue(FlexDirectionProperty); get => (FlexDirection) GetValue(FlexDirectionProperty);
set => SetValue(FlexDirectionProperty, value); set => SetValue(FlexDirectionProperty, value);
} }
@@ -92,7 +92,7 @@ namespace HandyControl.Controls
public FlexWrap FlexWrap public FlexWrap FlexWrap
{ {
get => (FlexWrap)GetValue(FlexWrapProperty); get => (FlexWrap) GetValue(FlexWrapProperty);
set => SetValue(FlexWrapProperty, value); set => SetValue(FlexWrapProperty, value);
} }
@@ -103,7 +103,7 @@ namespace HandyControl.Controls
public FlexContentJustify JustifyContent public FlexContentJustify JustifyContent
{ {
get => (FlexContentJustify)GetValue(JustifyContentProperty); get => (FlexContentJustify) GetValue(JustifyContentProperty);
set => SetValue(JustifyContentProperty, value); set => SetValue(JustifyContentProperty, value);
} }
@@ -114,7 +114,7 @@ namespace HandyControl.Controls
public FlexItemsAlignment AlignItems public FlexItemsAlignment AlignItems
{ {
get => (FlexItemsAlignment)GetValue(AlignItemsProperty); get => (FlexItemsAlignment) GetValue(AlignItemsProperty);
set => SetValue(AlignItemsProperty, value); set => SetValue(AlignItemsProperty, value);
} }
@@ -125,7 +125,7 @@ namespace HandyControl.Controls
public FlexContentAlignment AlignContent public FlexContentAlignment AlignContent
{ {
get => (FlexContentAlignment)GetValue(AlignContentProperty); get => (FlexContentAlignment) GetValue(AlignContentProperty);
set => SetValue(AlignContentProperty, value); set => SetValue(AlignContentProperty, value);
} }
@@ -604,7 +604,7 @@ namespace HandyControl.Controls
var v = lineInfo.OffsetV; var v = lineInfo.OffsetV;
var alignSelf = GetAlignSelf(child); var alignSelf = GetAlignSelf(child);
var alignment = alignSelf == FlexItemAlignment.Auto ? alignItems : (FlexItemsAlignment)alignSelf; var alignment = alignSelf == FlexItemAlignment.Auto ? alignItems : (FlexItemsAlignment) alignSelf;
switch (alignment) switch (alignment)
{ {
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
public ColLayout Layout public ColLayout Layout
{ {
get => (ColLayout)GetValue(LayoutProperty); get => (ColLayout) GetValue(LayoutProperty);
set => SetValue(LayoutProperty, value); set => SetValue(LayoutProperty, value);
} }
@@ -22,7 +22,7 @@ namespace HandyControl.Controls
public int Offset public int Offset
{ {
get => (int)GetValue(OffsetProperty); get => (int) GetValue(OffsetProperty);
set => SetValue(OffsetProperty, value); set => SetValue(OffsetProperty, value);
} }
@@ -31,7 +31,7 @@ namespace HandyControl.Controls
private static bool OnSpanValidate(object value) private static bool OnSpanValidate(object value)
{ {
var v = (int)value; var v = (int) value;
return v >= 1 && v <= 24; return v >= 1 && v <= 24;
} }
@@ -1,9 +1,9 @@
using HandyControl.Tools.Extension; using System.Linq;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using HandyControl.Data; using HandyControl.Data;
using HandyControl.Tools; using HandyControl.Tools;
using HandyControl.Tools.Extension;
namespace HandyControl.Controls namespace HandyControl.Controls
{ {
@@ -22,7 +22,7 @@ namespace HandyControl.Controls
public double Gutter public double Gutter
{ {
get => (double)GetValue(GutterProperty); get => (double) GetValue(GutterProperty);
set => SetValue(GutterProperty, value); set => SetValue(GutterProperty, value);
} }
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
count -= 1; count -= 1;
var index = (int)Math.Floor(Math.Pow(count / 3.0 + 0.25, 0.5) - 0.5); var index = (int) Math.Floor(Math.Pow(count / 3.0 + 0.25, 0.5) - 0.5);
var valeIndex = 3 * index * index + 3 * index; var valeIndex = 3 * index * index + 3 * index;
return count > valeIndex return count > valeIndex
@@ -112,7 +112,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(NameReferenceConverter))] [TypeConverter(typeof(NameReferenceConverter))]
public static UIElement GetLeftOf(DependencyObject element) public static UIElement GetLeftOf(DependencyObject element)
=> (UIElement)element.GetValue(LeftOfProperty); => (UIElement) element.GetValue(LeftOfProperty);
public static readonly DependencyProperty AboveProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty AboveProperty = DependencyProperty.RegisterAttached(
"Above", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender)); "Above", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
@@ -122,7 +122,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(NameReferenceConverter))] [TypeConverter(typeof(NameReferenceConverter))]
public static UIElement GetAbove(DependencyObject element) public static UIElement GetAbove(DependencyObject element)
=> (UIElement)element.GetValue(AboveProperty); => (UIElement) element.GetValue(AboveProperty);
public static readonly DependencyProperty RightOfProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty RightOfProperty = DependencyProperty.RegisterAttached(
"RightOf", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender)); "RightOf", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
@@ -132,7 +132,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(NameReferenceConverter))] [TypeConverter(typeof(NameReferenceConverter))]
public static UIElement GetRightOf(DependencyObject element) public static UIElement GetRightOf(DependencyObject element)
=> (UIElement)element.GetValue(RightOfProperty); => (UIElement) element.GetValue(RightOfProperty);
public static readonly DependencyProperty BelowProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty BelowProperty = DependencyProperty.RegisterAttached(
"Below", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender)); "Below", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
@@ -155,7 +155,7 @@ namespace HandyControl.Controls
=> element.SetValue(AlignHorizontalCenterWithPanelProperty, ValueBoxes.BooleanBox(value)); => element.SetValue(AlignHorizontalCenterWithPanelProperty, ValueBoxes.BooleanBox(value));
public static bool GetAlignHorizontalCenterWithPanel(DependencyObject element) public static bool GetAlignHorizontalCenterWithPanel(DependencyObject element)
=> (bool)element.GetValue(AlignHorizontalCenterWithPanelProperty); => (bool) element.GetValue(AlignHorizontalCenterWithPanelProperty);
public static readonly DependencyProperty AlignVerticalCenterWithPanelProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty AlignVerticalCenterWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignVerticalCenterWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender)); "AlignVerticalCenterWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
@@ -164,7 +164,7 @@ namespace HandyControl.Controls
=> element.SetValue(AlignVerticalCenterWithPanelProperty, ValueBoxes.BooleanBox(value)); => element.SetValue(AlignVerticalCenterWithPanelProperty, ValueBoxes.BooleanBox(value));
public static bool GetAlignVerticalCenterWithPanel(DependencyObject element) public static bool GetAlignVerticalCenterWithPanel(DependencyObject element)
=> (bool)element.GetValue(AlignVerticalCenterWithPanelProperty); => (bool) element.GetValue(AlignVerticalCenterWithPanelProperty);
public static readonly DependencyProperty AlignHorizontalCenterWithProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty AlignHorizontalCenterWithProperty = DependencyProperty.RegisterAttached(
"AlignHorizontalCenterWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender)); "AlignHorizontalCenterWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
@@ -174,7 +174,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(NameReferenceConverter))] [TypeConverter(typeof(NameReferenceConverter))]
public static UIElement GetAlignHorizontalCenterWith(DependencyObject element) public static UIElement GetAlignHorizontalCenterWith(DependencyObject element)
=> (UIElement)element.GetValue(AlignHorizontalCenterWithProperty); => (UIElement) element.GetValue(AlignHorizontalCenterWithProperty);
public static readonly DependencyProperty AlignVerticalCenterWithProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty AlignVerticalCenterWithProperty = DependencyProperty.RegisterAttached(
"AlignVerticalCenterWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender)); "AlignVerticalCenterWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
@@ -184,7 +184,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(NameReferenceConverter))] [TypeConverter(typeof(NameReferenceConverter))]
public static UIElement GetAlignVerticalCenterWith(DependencyObject element) public static UIElement GetAlignVerticalCenterWith(DependencyObject element)
=> (UIElement)element.GetValue(AlignVerticalCenterWithProperty); => (UIElement) element.GetValue(AlignVerticalCenterWithProperty);
#endregion #endregion
@@ -17,7 +17,7 @@ namespace HandyControl.Controls
set => SetValue(GroupsProperty, value); set => SetValue(GroupsProperty, value);
} }
private static bool IsGroupsValid(object value) => (int)value >= 1; private static bool IsGroupsValid(object value) => (int) value >= 1;
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register( public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(WaterfallPanel), new FrameworkPropertyMetadata( "Orientation", typeof(Orientation), typeof(WaterfallPanel), new FrameworkPropertyMetadata(
@@ -54,7 +54,7 @@ namespace HandyControl.Controls
public bool IsIndeterminate public bool IsIndeterminate
{ {
get => (bool)GetValue(IsIndeterminateProperty); get => (bool) GetValue(IsIndeterminateProperty);
set => SetValue(IsIndeterminateProperty, value); set => SetValue(IsIndeterminateProperty, value);
} }
@@ -66,7 +66,7 @@ namespace HandyControl.Controls
_translateTransformYRange = clipElement.Height - TranslateTransformMinY; _translateTransformYRange = clipElement.Height - TranslateTransformMinY;
_waveElement.RenderTransform = new TransformGroup _waveElement.RenderTransform = new TransformGroup
{ {
Children = {_translateTransform} Children = { _translateTransform }
}; };
} }
} }
@@ -76,7 +76,7 @@ namespace HandyControl.Controls
public string Text public string Text
{ {
get => (string)GetValue(TextProperty); get => (string) GetValue(TextProperty);
set => SetValue(TextProperty, value); set => SetValue(TextProperty, value);
} }
@@ -85,7 +85,7 @@ namespace HandyControl.Controls
public bool ShowText public bool ShowText
{ {
get => (bool)GetValue(ShowTextProperty); get => (bool) GetValue(ShowTextProperty);
set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value));
} }
@@ -31,7 +31,7 @@ namespace HandyControl.Controls
"Uri", typeof(Uri), typeof(ImagePropertyEditor), new PropertyMetadata(default(Uri), OnUriChangedCallback)); "Uri", typeof(Uri), typeof(ImagePropertyEditor), new PropertyMetadata(default(Uri), OnUriChangedCallback));
private static void OnUriChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) => private static void OnUriChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) =>
((ImagePropertyEditor)d).Source = e.NewValue is Uri uri ? BitmapFrame.Create(uri) : null; ((ImagePropertyEditor) d).Source = e.NewValue is Uri uri ? BitmapFrame.Create(uri) : null;
internal Uri Uri internal Uri Uri
{ {
@@ -30,7 +30,7 @@ namespace HandyControl.Controls
public PropertyGrid() public PropertyGrid()
{ {
CommandBindings.Add(new CommandBinding(ControlCommands.SortByCategory, SortByCategory, (s, e) => e.CanExecute = ShowSortButton)); CommandBindings.Add(new CommandBinding(ControlCommands.SortByCategory, SortByCategory, (s, e) => e.CanExecute = ShowSortButton));
CommandBindings.Add(new CommandBinding(ControlCommands.SortByName, SortByName, (s, e)=> e.CanExecute = ShowSortButton)); CommandBindings.Add(new CommandBinding(ControlCommands.SortByName, SortByName, (s, e) => e.CanExecute = ShowSortButton));
} }
public virtual PropertyResolver PropertyResolver { get; } = new PropertyResolver(); public virtual PropertyResolver PropertyResolver { get; } = new PropertyResolver();
@@ -50,7 +50,7 @@ namespace HandyControl.Controls
private static void OnSelectedObjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSelectedObjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (PropertyGrid)d; var ctl = (PropertyGrid) d;
ctl.OnSelectedObjectChanged(e.OldValue, e.NewValue); ctl.OnSelectedObjectChanged(e.OldValue, e.NewValue);
} }
@@ -71,7 +71,7 @@ namespace HandyControl.Controls
public string Description public string Description
{ {
get => (string)GetValue(DescriptionProperty); get => (string) GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value); set => SetValue(DescriptionProperty, value);
} }
@@ -22,7 +22,7 @@ namespace HandyControl.Controls
public string DisplayName public string DisplayName
{ {
get => (string)GetValue(DisplayNameProperty); get => (string) GetValue(DisplayNameProperty);
set => SetValue(DisplayNameProperty, value); set => SetValue(DisplayNameProperty, value);
} }
@@ -31,7 +31,7 @@ namespace HandyControl.Controls
public string PropertyName public string PropertyName
{ {
get => (string)GetValue(PropertyNameProperty); get => (string) GetValue(PropertyNameProperty);
set => SetValue(PropertyNameProperty, value); set => SetValue(PropertyNameProperty, value);
} }
@@ -49,7 +49,7 @@ namespace HandyControl.Controls
public string PropertyTypeName public string PropertyTypeName
{ {
get => (string)GetValue(PropertyTypeNameProperty); get => (string) GetValue(PropertyTypeNameProperty);
set => SetValue(PropertyTypeNameProperty, value); set => SetValue(PropertyTypeNameProperty, value);
} }
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
public string Description public string Description
{ {
get => (string)GetValue(DescriptionProperty); get => (string) GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value); set => SetValue(DescriptionProperty, value);
} }
@@ -67,7 +67,7 @@ namespace HandyControl.Controls
public bool IsReadOnly public bool IsReadOnly
{ {
get => (bool)GetValue(IsReadOnlyProperty); get => (bool) GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
} }
@@ -85,7 +85,7 @@ namespace HandyControl.Controls
public string Category public string Category
{ {
get => (string)GetValue(CategoryProperty); get => (string) GetValue(CategoryProperty);
set => SetValue(CategoryProperty, value); set => SetValue(CategoryProperty, value);
} }
@@ -94,7 +94,7 @@ namespace HandyControl.Controls
public PropertyEditorBase Editor public PropertyEditorBase Editor
{ {
get => (PropertyEditorBase)GetValue(EditorProperty); get => (PropertyEditorBase) GetValue(EditorProperty);
set => SetValue(EditorProperty, value); set => SetValue(EditorProperty, value);
} }
@@ -103,7 +103,7 @@ namespace HandyControl.Controls
public FrameworkElement EditorElement public FrameworkElement EditorElement
{ {
get => (FrameworkElement)GetValue(EditorElementProperty); get => (FrameworkElement) GetValue(EditorElementProperty);
set => SetValue(EditorElementProperty, value); set => SetValue(EditorElementProperty, value);
} }
@@ -112,7 +112,7 @@ namespace HandyControl.Controls
public bool IsExpandedEnabled public bool IsExpandedEnabled
{ {
get => (bool)GetValue(IsExpandedEnabledProperty); get => (bool) GetValue(IsExpandedEnabledProperty);
set => SetValue(IsExpandedEnabledProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsExpandedEnabledProperty, ValueBoxes.BooleanBox(value));
} }
@@ -37,7 +37,7 @@ namespace HandyControl.Controls
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) =>
((Rate) d).OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, d) ((Rate) d).OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, d)
{ {
Info = (double)e.NewValue Info = (double) e.NewValue
}); });
protected virtual void OnValueChanged(FunctionEventArgs<double> e) protected virtual void OnValueChanged(FunctionEventArgs<double> e)
@@ -154,7 +154,7 @@ namespace HandyControl.Controls
public bool IsReadOnly public bool IsReadOnly
{ {
get => (bool)GetValue(IsReadOnlyProperty); get => (bool) GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
} }
@@ -81,7 +81,7 @@ namespace HandyControl.Controls
public bool IsReadOnly public bool IsReadOnly
{ {
get => (bool)GetValue(IsReadOnlyProperty); get => (bool) GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
} }
@@ -163,7 +163,7 @@ namespace HandyControl.Controls
if (IsReadOnly) return; if (IsReadOnly) return;
_isSentValue = false; _isSentValue = false;
IsSelected = true; IsSelected = true;
RaiseEvent(new RoutedEventArgs(SelectedChangedEvent) {Source = this}); RaiseEvent(new RoutedEventArgs(SelectedChangedEvent) { Source = this });
} }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
@@ -192,7 +192,7 @@ namespace HandyControl.Controls
{ {
if (!_isSentValue) if (!_isSentValue)
{ {
RaiseEvent(new RoutedEventArgs(ValueChangedEvent) {Source = this}); RaiseEvent(new RoutedEventArgs(ValueChangedEvent) { Source = this });
_isMouseLeftButtonDown = false; _isMouseLeftButtonDown = false;
_isSentValue = true; _isSentValue = true;
return; return;
@@ -213,7 +213,7 @@ namespace HandyControl.Controls
} }
} }
RaiseEvent(new RoutedEventArgs(ValueChangedEvent) {Source = this}); RaiseEvent(new RoutedEventArgs(ValueChangedEvent) { Source = this });
_isMouseLeftButtonDown = false; _isMouseLeftButtonDown = false;
} }
} }
@@ -124,7 +124,7 @@ namespace HandyControl.Controls
public bool IsDrawing public bool IsDrawing
{ {
get => (bool)GetValue(IsDrawingProperty); get => (bool) GetValue(IsDrawingProperty);
internal set => SetValue(IsDrawingProperty, ValueBoxes.BooleanBox(value)); internal set => SetValue(IsDrawingProperty, ValueBoxes.BooleanBox(value));
} }
@@ -133,7 +133,7 @@ namespace HandyControl.Controls
public bool IsSelecting public bool IsSelecting
{ {
get => (bool)GetValue(IsSelectingProperty); get => (bool) GetValue(IsSelectingProperty);
internal set => SetValue(IsSelectingProperty, ValueBoxes.BooleanBox(value)); internal set => SetValue(IsSelectingProperty, ValueBoxes.BooleanBox(value));
} }
@@ -279,8 +279,8 @@ namespace HandyControl.Controls
} }
var newPoint = Mouse.GetPosition(this); var newPoint = Mouse.GetPosition(this);
var offsetX = (int)(newPoint.X - _mousePointOld.X); var offsetX = (int) (newPoint.X - _mousePointOld.X);
var offsetY = (int)(newPoint.Y - _mousePointOld.Y); var offsetY = (int) (newPoint.Y - _mousePointOld.Y);
if (IsDrawing) if (IsDrawing)
{ {
@@ -320,10 +320,10 @@ namespace HandyControl.Controls
magnifierPos.Y = _pointFloating.Y - 1; magnifierPos.Y = _pointFloating.Y - 1;
} }
rect.Left = (int)Math.Min(_pointFixed.X, _pointFloating.X); rect.Left = (int) Math.Min(_pointFixed.X, _pointFloating.X);
rect.Top = (int)Math.Min(_pointFixed.Y, _pointFloating.Y); rect.Top = (int) Math.Min(_pointFixed.Y, _pointFloating.Y);
rect.Right = (int)Math.Max(_pointFixed.X, _pointFloating.X); rect.Right = (int) Math.Max(_pointFixed.X, _pointFloating.X);
rect.Bottom = (int)Math.Max(_pointFixed.Y, _pointFloating.Y); rect.Bottom = (int) Math.Max(_pointFixed.Y, _pointFloating.Y);
_magnifier.Show(); _magnifier.Show();
MoveMagnifier(magnifierPos); MoveMagnifier(magnifierPos);
@@ -334,10 +334,10 @@ namespace HandyControl.Controls
} }
else if (IsSelecting) else if (IsSelecting)
{ {
var minX = (int)Math.Min(_mousePointOld.X, newPoint.X); var minX = (int) Math.Min(_mousePointOld.X, newPoint.X);
var maxX = (int)Math.Max(_mousePointOld.X, newPoint.X); var maxX = (int) Math.Max(_mousePointOld.X, newPoint.X);
var minY = (int)Math.Min(_mousePointOld.Y, newPoint.Y); var minY = (int) Math.Min(_mousePointOld.Y, newPoint.Y);
var maxY = (int)Math.Max(_mousePointOld.Y, newPoint.Y); var maxY = (int) Math.Max(_mousePointOld.Y, newPoint.Y);
MoveTargetArea(new InteropValues.RECT(minX, minY, maxX, maxY)); MoveTargetArea(new InteropValues.RECT(minX, minY, maxX, maxY));
} }
@@ -91,7 +91,7 @@ namespace HandyControl.Controls
{ {
_isItemSelected = false; _isItemSelected = false;
} }
else if(_selectedHeader != null) else if (_selectedHeader != null)
{ {
if (AutoSelect) if (AutoSelect)
{ {
@@ -170,7 +170,7 @@ namespace HandyControl.Controls
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (SideMenuItem)d; var ctl = (SideMenuItem) d;
if (e.OldValue is ICommand oldCommand) if (e.OldValue is ICommand oldCommand)
{ {
oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged; oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged;
@@ -18,7 +18,7 @@ namespace HandyControl.Controls
[TemplatePart(Name = ElementTrack, Type = typeof(Track))] [TemplatePart(Name = ElementTrack, Type = typeof(Track))]
public class RangeSlider : TwoWayRangeBase public class RangeSlider : TwoWayRangeBase
{ {
private const string ElementTrack= "PART_Track"; private const string ElementTrack = "PART_Track";
private RangeTrack _track; private RangeTrack _track;
@@ -136,7 +136,7 @@ namespace HandyControl.Controls
public Orientation Orientation public Orientation Orientation
{ {
get => (Orientation)GetValue(OrientationProperty); get => (Orientation) GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value); set => SetValue(OrientationProperty, value);
} }
@@ -145,7 +145,7 @@ namespace HandyControl.Controls
public bool IsDirectionReversed public bool IsDirectionReversed
{ {
get => (bool)GetValue(IsDirectionReversedProperty); get => (bool) GetValue(IsDirectionReversedProperty);
set => SetValue(IsDirectionReversedProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsDirectionReversedProperty, ValueBoxes.BooleanBox(value));
} }
@@ -153,7 +153,7 @@ namespace HandyControl.Controls
public int Delay public int Delay
{ {
get => (int)GetValue(DelayProperty); get => (int) GetValue(DelayProperty);
set => SetValue(DelayProperty, value); set => SetValue(DelayProperty, value);
} }
@@ -169,7 +169,7 @@ namespace HandyControl.Controls
public int Interval public int Interval
{ {
get => (int)GetValue(IntervalProperty); get => (int) GetValue(IntervalProperty);
set => SetValue(IntervalProperty, value); set => SetValue(IntervalProperty, value);
} }
@@ -186,7 +186,7 @@ namespace HandyControl.Controls
public AutoToolTipPlacement AutoToolTipPlacement public AutoToolTipPlacement AutoToolTipPlacement
{ {
get => (AutoToolTipPlacement)GetValue(AutoToolTipPlacementProperty); get => (AutoToolTipPlacement) GetValue(AutoToolTipPlacementProperty);
set => SetValue(AutoToolTipPlacementProperty, value); set => SetValue(AutoToolTipPlacementProperty, value);
} }
@@ -196,7 +196,7 @@ namespace HandyControl.Controls
public int AutoToolTipPrecision public int AutoToolTipPrecision
{ {
get => (int)GetValue(AutoToolTipPrecisionProperty); get => (int) GetValue(AutoToolTipPrecisionProperty);
set => SetValue(AutoToolTipPrecisionProperty, value); set => SetValue(AutoToolTipPrecisionProperty, value);
} }
@@ -205,7 +205,7 @@ namespace HandyControl.Controls
public bool IsSnapToTickEnabled public bool IsSnapToTickEnabled
{ {
get => (bool)GetValue(IsSnapToTickEnabledProperty); get => (bool) GetValue(IsSnapToTickEnabledProperty);
set => SetValue(IsSnapToTickEnabledProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsSnapToTickEnabledProperty, ValueBoxes.BooleanBox(value));
} }
@@ -214,7 +214,7 @@ namespace HandyControl.Controls
public TickPlacement TickPlacement public TickPlacement TickPlacement
{ {
get => (TickPlacement)GetValue(TickPlacementProperty); get => (TickPlacement) GetValue(TickPlacementProperty);
set => SetValue(TickPlacementProperty, value); set => SetValue(TickPlacementProperty, value);
} }
@@ -224,7 +224,7 @@ namespace HandyControl.Controls
public double TickFrequency public double TickFrequency
{ {
get => (double)GetValue(TickFrequencyProperty); get => (double) GetValue(TickFrequencyProperty);
set => SetValue(TickFrequencyProperty, value); set => SetValue(TickFrequencyProperty, value);
} }
@@ -233,7 +233,7 @@ namespace HandyControl.Controls
public DoubleCollection Ticks public DoubleCollection Ticks
{ {
get => (DoubleCollection)GetValue(TicksProperty); get => (DoubleCollection) GetValue(TicksProperty);
set => SetValue(TicksProperty, value); set => SetValue(TicksProperty, value);
} }
@@ -242,7 +242,7 @@ namespace HandyControl.Controls
public bool IsMoveToPointEnabled public bool IsMoveToPointEnabled
{ {
get => (bool)GetValue(IsMoveToPointEnabledProperty); get => (bool) GetValue(IsMoveToPointEnabledProperty);
set => SetValue(IsMoveToPointEnabledProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsMoveToPointEnabledProperty, ValueBoxes.BooleanBox(value));
} }
@@ -522,7 +522,7 @@ namespace HandyControl.Controls
private string GetAutoToolTipNumber(bool isStart) private string GetAutoToolTipNumber(bool isStart)
{ {
var format = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone(); var format = (NumberFormatInfo) NumberFormatInfo.CurrentInfo.Clone();
format.NumberDecimalDigits = AutoToolTipPrecision; format.NumberDecimalDigits = AutoToolTipPrecision;
return isStart ? ValueStart.ToString("N", format) : ValueEnd.ToString("N", format); return isStart ? ValueStart.ToString("N", format) : ValueEnd.ToString("N", format);
} }
@@ -603,7 +603,7 @@ namespace HandyControl.Controls
{ {
if (e.ChangedButton != MouseButton.Left) return; if (e.ChangedButton != MouseButton.Left) return;
var slider = (RangeSlider)sender; var slider = (RangeSlider) sender;
// When someone click on the Slider's part, and it's not focusable // When someone click on the Slider's part, and it's not focusable
// Slider need to take the focus in order to process keyboard correctly // Slider need to take the focus in order to process keyboard correctly
@@ -364,7 +364,7 @@ namespace HandyControl.Controls
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
if ((bool)e.NewValue) if ((bool) e.NewValue)
{ {
Mouse.Synchronize(); Mouse.Synchronize();
} }
@@ -1,9 +1,9 @@
// Adapted from https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Primitives/RangeBase.cs // Adapted from https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Primitives/RangeBase.cs
using HandyControl.Data;
using HandyControl.Tools;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using HandyControl.Data;
using HandyControl.Tools;
namespace HandyControl.Controls namespace HandyControl.Controls
{ {
@@ -15,12 +15,12 @@ namespace HandyControl.Controls
private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctrl = (TwoWayRangeBase)d; var ctrl = (TwoWayRangeBase) d;
ctrl.CoerceValue(MaximumProperty); ctrl.CoerceValue(MaximumProperty);
ctrl.CoerceValue(ValueStartProperty); ctrl.CoerceValue(ValueStartProperty);
ctrl.CoerceValue(ValueEndProperty); ctrl.CoerceValue(ValueEndProperty);
ctrl.OnMinimumChanged((double)e.OldValue, (double)e.NewValue); ctrl.OnMinimumChanged((double) e.OldValue, (double) e.NewValue);
} }
protected virtual void OnMinimumChanged(double oldMinimum, double newMinimum) protected virtual void OnMinimumChanged(double oldMinimum, double newMinimum)
@@ -29,7 +29,7 @@ namespace HandyControl.Controls
public double Minimum public double Minimum
{ {
get => (double)GetValue(MinimumProperty); get => (double) GetValue(MinimumProperty);
set => SetValue(MinimumProperty, value); set => SetValue(MinimumProperty, value);
} }
@@ -40,9 +40,9 @@ namespace HandyControl.Controls
private static object CoerceMaximum(DependencyObject d, object basevalue) private static object CoerceMaximum(DependencyObject d, object basevalue)
{ {
var ctrl = (TwoWayRangeBase)d; var ctrl = (TwoWayRangeBase) d;
var min = ctrl.Minimum; var min = ctrl.Minimum;
if ((double)basevalue < min) if ((double) basevalue < min)
{ {
return min; return min;
} }
@@ -51,11 +51,11 @@ namespace HandyControl.Controls
private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctrl = (TwoWayRangeBase)d; var ctrl = (TwoWayRangeBase) d;
ctrl.CoerceValue(ValueStartProperty); ctrl.CoerceValue(ValueStartProperty);
ctrl.CoerceValue(ValueEndProperty); ctrl.CoerceValue(ValueEndProperty);
ctrl.OnMaximumChanged((double)e.OldValue, (double)e.NewValue); ctrl.OnMaximumChanged((double) e.OldValue, (double) e.NewValue);
} }
protected virtual void OnMaximumChanged(double oldMaximum, double newMaximum) protected virtual void OnMaximumChanged(double oldMaximum, double newMaximum)
@@ -64,7 +64,7 @@ namespace HandyControl.Controls
public double Maximum public double Maximum
{ {
get => (double)GetValue(MaximumProperty); get => (double) GetValue(MaximumProperty);
set => SetValue(MaximumProperty, value); set => SetValue(MaximumProperty, value);
} }
@@ -76,24 +76,24 @@ namespace HandyControl.Controls
private static void OnValueStartChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnValueStartChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctrl = (TwoWayRangeBase)d; var ctrl = (TwoWayRangeBase) d;
ctrl.OnValueChanged(new DoubleRange ctrl.OnValueChanged(new DoubleRange
{ {
Start = (double)e.OldValue, Start = (double) e.OldValue,
End = ctrl.ValueEnd End = ctrl.ValueEnd
}, new DoubleRange }, new DoubleRange
{ {
Start = (double)e.NewValue, Start = (double) e.NewValue,
End = ctrl.ValueEnd End = ctrl.ValueEnd
}); });
} }
protected virtual void OnValueChanged(DoubleRange oldValue, DoubleRange newValue) => RaiseEvent( protected virtual void OnValueChanged(DoubleRange oldValue, DoubleRange newValue) => RaiseEvent(
new RoutedPropertyChangedEventArgs<DoubleRange>(oldValue, newValue) {RoutedEvent = ValueChangedEvent}); new RoutedPropertyChangedEventArgs<DoubleRange>(oldValue, newValue) { RoutedEvent = ValueChangedEvent });
public double ValueStart public double ValueStart
{ {
get => (double)GetValue(ValueStartProperty); get => (double) GetValue(ValueStartProperty);
set => SetValue(ValueStartProperty, value); set => SetValue(ValueStartProperty, value);
} }
@@ -105,29 +105,29 @@ namespace HandyControl.Controls
private static void OnValueEndChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnValueEndChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctrl = (TwoWayRangeBase)d; var ctrl = (TwoWayRangeBase) d;
ctrl.OnValueChanged(new DoubleRange ctrl.OnValueChanged(new DoubleRange
{ {
Start = ctrl.ValueStart, Start = ctrl.ValueStart,
End = (double)e.OldValue End = (double) e.OldValue
}, new DoubleRange }, new DoubleRange
{ {
Start = ctrl.ValueStart, Start = ctrl.ValueStart,
End = (double)e.NewValue End = (double) e.NewValue
}); });
} }
public double ValueEnd public double ValueEnd
{ {
get => (double)GetValue(ValueEndProperty); get => (double) GetValue(ValueEndProperty);
set => SetValue(ValueEndProperty, value); set => SetValue(ValueEndProperty, value);
} }
internal static object ConstrainToRange(DependencyObject d, object value) internal static object ConstrainToRange(DependencyObject d, object value)
{ {
var ctrl = (TwoWayRangeBase)d; var ctrl = (TwoWayRangeBase) d;
var min = ctrl.Minimum; var min = ctrl.Minimum;
var v = (double)value; var v = (double) value;
if (v < min) if (v < min)
{ {
return min; return min;
@@ -148,7 +148,7 @@ namespace HandyControl.Controls
public double LargeChange public double LargeChange
{ {
get => (double)GetValue(LargeChangeProperty); get => (double) GetValue(LargeChangeProperty);
set => SetValue(LargeChangeProperty, value); set => SetValue(LargeChangeProperty, value);
} }
@@ -158,7 +158,7 @@ namespace HandyControl.Controls
public double SmallChange public double SmallChange
{ {
get => (double)GetValue(SmallChangeProperty); get => (double) GetValue(SmallChangeProperty);
set => SetValue(SmallChangeProperty, value); set => SetValue(SmallChangeProperty, value);
} }
@@ -87,7 +87,7 @@ namespace HandyControl.Controls
private static object CoerceStepIndex(DependencyObject d, object basevalue) private static object CoerceStepIndex(DependencyObject d, object basevalue)
{ {
var ctl = (StepBar)d; var ctl = (StepBar) d;
var stepIndex = (int) basevalue; var stepIndex = (int) basevalue;
if (ctl.Items.Count == 0 && stepIndex > 0) if (ctl.Items.Count == 0 && stepIndex > 0)
{ {
@@ -105,7 +105,7 @@ namespace HandyControl.Controls
private static void OnStepIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnStepIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (StepBar) d; var ctl = (StepBar) d;
ctl.OnStepIndexChanged((int)e.NewValue); ctl.OnStepIndexChanged((int) e.NewValue);
} }
private void OnStepIndexChanged(int stepIndex) private void OnStepIndexChanged(int stepIndex)
@@ -138,7 +138,7 @@ namespace HandyControl.Controls
public int StepIndex public int StepIndex
{ {
get => (int)GetValue(StepIndexProperty); get => (int) GetValue(StepIndexProperty);
set => SetValue(StepIndexProperty, value); set => SetValue(StepIndexProperty, value);
} }
@@ -147,7 +147,7 @@ namespace HandyControl.Controls
public Dock Dock public Dock Dock
{ {
get => (Dock)GetValue(DockProperty); get => (Dock) GetValue(DockProperty);
set => SetValue(DockProperty, value); set => SetValue(DockProperty, value);
} }
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsAnimationEnabled public bool IsAnimationEnabled
{ {
get => (bool)GetValue(IsAnimationEnabledProperty); get => (bool) GetValue(IsAnimationEnabledProperty);
set => SetValue(IsAnimationEnabledProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsAnimationEnabledProperty, ValueBoxes.BooleanBox(value));
} }
@@ -73,7 +73,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsDraggable public bool IsDraggable
{ {
get => (bool)GetValue(IsDraggableProperty); get => (bool) GetValue(IsDraggableProperty);
set => SetValue(IsDraggableProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsDraggableProperty, ValueBoxes.BooleanBox(value));
} }
@@ -94,7 +94,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool ShowCloseButton public bool ShowCloseButton
{ {
get => (bool)GetValue(ShowCloseButtonProperty); get => (bool) GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, value); set => SetValue(ShowCloseButtonProperty, value);
} }
@@ -115,7 +115,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool ShowContextMenu public bool ShowContextMenu
{ {
get => (bool)GetValue(ShowContextMenuProperty); get => (bool) GetValue(ShowContextMenuProperty);
set => SetValue(ShowContextMenuProperty, value); set => SetValue(ShowContextMenuProperty, value);
} }
@@ -130,7 +130,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsTabFillEnabled public bool IsTabFillEnabled
{ {
get => (bool)GetValue(IsTabFillEnabledProperty); get => (bool) GetValue(IsTabFillEnabledProperty);
set => SetValue(IsTabFillEnabledProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsTabFillEnabledProperty, ValueBoxes.BooleanBox(value));
} }
@@ -145,7 +145,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double TabItemWidth public double TabItemWidth
{ {
get => (double)GetValue(TabItemWidthProperty); get => (double) GetValue(TabItemWidthProperty);
set => SetValue(TabItemWidthProperty, value); set => SetValue(TabItemWidthProperty, value);
} }
@@ -160,7 +160,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double TabItemHeight public double TabItemHeight
{ {
get => (double)GetValue(TabItemHeightProperty); get => (double) GetValue(TabItemHeightProperty);
set => SetValue(TabItemHeightProperty, value); set => SetValue(TabItemHeightProperty, value);
} }
@@ -299,7 +299,7 @@ namespace HandyControl.Controls
{ {
if (!IsTabFillEnabled) if (!IsTabFillEnabled)
{ {
_itemShowCount = (int)(ActualWidth / TabItemWidth); _itemShowCount = (int) (ActualWidth / TabItemWidth);
_buttonOverflow?.Show(ShowOverflowButton && Items.Count > 0 && Items.Count >= _itemShowCount); _buttonOverflow?.Show(ShowOverflowButton && Items.Count > 0 && Items.Count >= _itemShowCount);
} }
} }
@@ -321,7 +321,7 @@ namespace HandyControl.Controls
_buttonOverflow.Menu.Items.Clear(); _buttonOverflow.Menu.Items.Clear();
for (var i = 0; i < Items.Count; i++) for (var i = 0; i < Items.Count; i++)
{ {
if(!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) continue; if (!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) continue;
var menuItem = new MenuItem var menuItem = new MenuItem
{ {
@@ -140,7 +140,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool ShowCloseButton public bool ShowCloseButton
{ {
get => (bool)GetValue(ShowCloseButtonProperty); get => (bool) GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, value); set => SetValue(ShowCloseButtonProperty, value);
} }
@@ -148,7 +148,7 @@ namespace HandyControl.Controls
=> element.SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value)); => element.SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value));
public static bool GetShowCloseButton(DependencyObject element) public static bool GetShowCloseButton(DependencyObject element)
=> (bool)element.GetValue(ShowCloseButtonProperty); => (bool) element.GetValue(ShowCloseButtonProperty);
/// <summary> /// <summary>
/// 是否显示上下文菜单 /// 是否显示上下文菜单
@@ -161,7 +161,7 @@ namespace HandyControl.Controls
var ctl = (TabItem) d; var ctl = (TabItem) d;
if (ctl.Menu != null) if (ctl.Menu != null)
{ {
var show = (bool)e.NewValue; var show = (bool) e.NewValue;
ctl.Menu.IsEnabled = show; ctl.Menu.IsEnabled = show;
ctl.Menu.Show(show); ctl.Menu.Show(show);
} }
@@ -180,7 +180,7 @@ namespace HandyControl.Controls
=> element.SetValue(ShowContextMenuProperty, ValueBoxes.BooleanBox(value)); => element.SetValue(ShowContextMenuProperty, ValueBoxes.BooleanBox(value));
public static bool GetShowContextMenu(DependencyObject element) public static bool GetShowContextMenu(DependencyObject element)
=> (bool)element.GetValue(ShowContextMenuProperty); => (bool) element.GetValue(ShowContextMenuProperty);
public static readonly DependencyProperty MenuProperty = DependencyProperty.Register( public static readonly DependencyProperty MenuProperty = DependencyProperty.Register(
"Menu", typeof(ContextMenu), typeof(TabItem), new PropertyMetadata(default(ContextMenu), OnMenuChanged)); "Menu", typeof(ContextMenu), typeof(TabItem), new PropertyMetadata(default(ContextMenu), OnMenuChanged));
@@ -450,7 +450,7 @@ namespace HandyControl.Controls
} }
var maxIndex = TabControlParent.Items.Count - 1; var maxIndex = TabControlParent.Items.Count - 1;
var div = (int)(left / ItemWidth); var div = (int) (left / ItemWidth);
var rest = left % ItemWidth; var rest = left % ItemWidth;
var result = rest / ItemWidth > .5 ? div + 1 : div; var result = rest / ItemWidth > .5 ? div + 1 : div;
@@ -37,7 +37,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public Duration FluidMoveDuration public Duration FluidMoveDuration
{ {
get => (Duration)GetValue(FluidMoveDurationProperty); get => (Duration) GetValue(FluidMoveDurationProperty);
set => SetValue(FluidMoveDurationProperty, value); set => SetValue(FluidMoveDurationProperty, value);
} }
@@ -52,7 +52,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool IsTabFillEnabled public bool IsTabFillEnabled
{ {
get => (bool)GetValue(IsTabFillEnabledProperty); get => (bool) GetValue(IsTabFillEnabledProperty);
set => SetValue(IsTabFillEnabledProperty, ValueBoxes.BooleanBox(value)); set => SetValue(IsTabFillEnabledProperty, ValueBoxes.BooleanBox(value));
} }
@@ -67,7 +67,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double TabItemWidth public double TabItemWidth
{ {
get => (double)GetValue(TabItemWidthProperty); get => (double) GetValue(TabItemWidthProperty);
set => SetValue(TabItemWidthProperty, value); set => SetValue(TabItemWidthProperty, value);
} }
@@ -82,7 +82,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public double TabItemHeight public double TabItemHeight
{ {
get => (double)GetValue(TabItemHeightProperty); get => (double) GetValue(TabItemHeightProperty);
set => SetValue(TabItemHeightProperty, value); set => SetValue(TabItemHeightProperty, value);
} }
@@ -127,7 +127,7 @@ namespace HandyControl.Controls
{ {
if (TemplatedParent is TabControl tabControl) if (TemplatedParent is TabControl tabControl)
{ {
arr = ArithmeticHelper.DivideInt2Arr((int)tabControl.ActualWidth + InternalChildren.Count, count); arr = ArithmeticHelper.DivideInt2Arr((int) tabControl.ActualWidth + InternalChildren.Count, count);
} }
} }
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctrl = (Tag)d; var ctrl = (Tag) d;
ctrl.SetValue(HasHeaderPropertyKey, e.NewValue != null ? ValueBoxes.TrueBox : ValueBoxes.FalseBox); ctrl.SetValue(HasHeaderPropertyKey, e.NewValue != null ? ValueBoxes.TrueBox : ValueBoxes.FalseBox);
ctrl.OnHeaderChanged(e.OldValue, e.NewValue); ctrl.OnHeaderChanged(e.OldValue, e.NewValue);
@@ -108,7 +108,7 @@ namespace HandyControl.Controls
public FontFamily FontFamily public FontFamily FontFamily
{ {
get => (FontFamily)GetValue(FontFamilyProperty); get => (FontFamily) GetValue(FontFamilyProperty);
set => SetValue(FontFamilyProperty, value); set => SetValue(FontFamilyProperty, value);
} }
@@ -119,7 +119,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(FontSizeConverter))] [TypeConverter(typeof(FontSizeConverter))]
public double FontSize public double FontSize
{ {
get => (double)GetValue(FontSizeProperty); get => (double) GetValue(FontSizeProperty);
set => SetValue(FontSizeProperty, value); set => SetValue(FontSizeProperty, value);
} }
@@ -129,7 +129,7 @@ namespace HandyControl.Controls
public FontStretch FontStretch public FontStretch FontStretch
{ {
get => (FontStretch)GetValue(FontStretchProperty); get => (FontStretch) GetValue(FontStretchProperty);
set => SetValue(FontStretchProperty, value); set => SetValue(FontStretchProperty, value);
} }
@@ -139,7 +139,7 @@ namespace HandyControl.Controls
public FontStyle FontStyle public FontStyle FontStyle
{ {
get => (FontStyle)GetValue(FontStyleProperty); get => (FontStyle) GetValue(FontStyleProperty);
set => SetValue(FontStyleProperty, value); set => SetValue(FontStyleProperty, value);
} }
@@ -149,7 +149,7 @@ namespace HandyControl.Controls
public FontWeight FontWeight public FontWeight FontWeight
{ {
get => (FontWeight)GetValue(FontWeightProperty); get => (FontWeight) GetValue(FontWeightProperty);
set => SetValue(FontWeightProperty, value); set => SetValue(FontWeightProperty, value);
} }
@@ -264,7 +264,7 @@ namespace HandyControl.Controls
private static void OnFormattedTextUpdated(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnFormattedTextUpdated(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var outlinedTextBlock = (OutlineText)d; var outlinedTextBlock = (OutlineText) d;
outlinedTextBlock.UpdateFormattedText(); outlinedTextBlock.UpdateFormattedText();
outlinedTextBlock._textGeometry = null; outlinedTextBlock._textGeometry = null;
@@ -274,7 +274,7 @@ namespace HandyControl.Controls
private static void OnFormattedTextInvalidated(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnFormattedTextInvalidated(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var outlinedTextBlock = (OutlineText)d; var outlinedTextBlock = (OutlineText) d;
outlinedTextBlock._formattedText = null; outlinedTextBlock._formattedText = null;
outlinedTextBlock._textGeometry = null; outlinedTextBlock._textGeometry = null;
@@ -26,7 +26,7 @@ namespace HandyControl.Controls
public string Text public string Text
{ {
get => (string)GetValue(TextProperty); get => (string) GetValue(TextProperty);
set => SetValue(TextProperty, value); set => SetValue(TextProperty, value);
} }
@@ -36,7 +36,7 @@ namespace HandyControl.Controls
public TextAlignment TextAlignment public TextAlignment TextAlignment
{ {
get => (TextAlignment)GetValue(TextAlignmentProperty); get => (TextAlignment) GetValue(TextAlignmentProperty);
set => SetValue(TextAlignmentProperty, value); set => SetValue(TextAlignmentProperty, value);
} }
@@ -46,7 +46,7 @@ namespace HandyControl.Controls
public TextTrimming TextTrimming public TextTrimming TextTrimming
{ {
get => (TextTrimming)GetValue(TextTrimmingProperty); get => (TextTrimming) GetValue(TextTrimmingProperty);
set => SetValue(TextTrimmingProperty, value); set => SetValue(TextTrimmingProperty, value);
} }
@@ -56,7 +56,7 @@ namespace HandyControl.Controls
public TextWrapping TextWrapping public TextWrapping TextWrapping
{ {
get => (TextWrapping)GetValue(TextWrappingProperty); get => (TextWrapping) GetValue(TextWrappingProperty);
set => SetValue(TextWrappingProperty, value); set => SetValue(TextWrappingProperty, value);
} }
@@ -75,7 +75,7 @@ namespace HandyControl.Controls
public FontFamily FontFamily public FontFamily FontFamily
{ {
get => (FontFamily)GetValue(FontFamilyProperty); get => (FontFamily) GetValue(FontFamilyProperty);
set => SetValue(FontFamilyProperty, value); set => SetValue(FontFamilyProperty, value);
} }
@@ -86,7 +86,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(FontSizeConverter))] [TypeConverter(typeof(FontSizeConverter))]
public double FontSize public double FontSize
{ {
get => (double)GetValue(FontSizeProperty); get => (double) GetValue(FontSizeProperty);
set => SetValue(FontSizeProperty, value); set => SetValue(FontSizeProperty, value);
} }
@@ -96,7 +96,7 @@ namespace HandyControl.Controls
public FontStretch FontStretch public FontStretch FontStretch
{ {
get => (FontStretch)GetValue(FontStretchProperty); get => (FontStretch) GetValue(FontStretchProperty);
set => SetValue(FontStretchProperty, value); set => SetValue(FontStretchProperty, value);
} }
@@ -106,7 +106,7 @@ namespace HandyControl.Controls
public FontStyle FontStyle public FontStyle FontStyle
{ {
get => (FontStyle)GetValue(FontStyleProperty); get => (FontStyle) GetValue(FontStyleProperty);
set => SetValue(FontStyleProperty, value); set => SetValue(FontStyleProperty, value);
} }
@@ -116,7 +116,7 @@ namespace HandyControl.Controls
public FontWeight FontWeight public FontWeight FontWeight
{ {
get => (FontWeight)GetValue(FontWeightProperty); get => (FontWeight) GetValue(FontWeightProperty);
set => SetValue(FontWeightProperty, value); set => SetValue(FontWeightProperty, value);
} }
@@ -175,7 +175,7 @@ namespace HandyControl.Controls
private static void OnFormattedTextUpdated(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnFormattedTextUpdated(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var outlinedTextBlock = (SimpleText)d; var outlinedTextBlock = (SimpleText) d;
outlinedTextBlock.UpdateFormattedText(); outlinedTextBlock.UpdateFormattedText();
outlinedTextBlock.InvalidateMeasure(); outlinedTextBlock.InvalidateMeasure();
@@ -184,7 +184,7 @@ namespace HandyControl.Controls
private static void OnFormattedTextInvalidated(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnFormattedTextInvalidated(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var outlinedTextBlock = (SimpleText)d; var outlinedTextBlock = (SimpleText) d;
outlinedTextBlock._formattedText = null; outlinedTextBlock._formattedText = null;
outlinedTextBlock.InvalidateMeasure(); outlinedTextBlock.InvalidateMeasure();
@@ -77,7 +77,7 @@ namespace HandyControl.Controls
public string DateTimeFormat public string DateTimeFormat
{ {
get => (string)GetValue(DateTimeFormatProperty); get => (string) GetValue(DateTimeFormatProperty);
set => SetValue(DateTimeFormatProperty, value); set => SetValue(DateTimeFormatProperty, value);
} }
@@ -86,7 +86,7 @@ namespace HandyControl.Controls
public bool ShowConfirmButton public bool ShowConfirmButton
{ {
get => (bool)GetValue(ShowConfirmButtonProperty); get => (bool) GetValue(ShowConfirmButtonProperty);
set => SetValue(ShowConfirmButtonProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowConfirmButtonProperty, ValueBoxes.BooleanBox(value));
} }
@@ -95,8 +95,8 @@ namespace HandyControl.Controls
private static void OnSelectedDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSelectedDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (CalendarWithClock)d; var ctl = (CalendarWithClock) d;
var v = (DateTime?)e.NewValue; var v = (DateTime?) e.NewValue;
ctl.OnSelectedDateTimeChanged(new FunctionEventArgs<DateTime?>(SelectedDateTimeChangedEvent, ctl) ctl.OnSelectedDateTimeChanged(new FunctionEventArgs<DateTime?>(SelectedDateTimeChangedEvent, ctl)
{ {
Info = v Info = v
@@ -105,7 +105,7 @@ namespace HandyControl.Controls
public DateTime? SelectedDateTime public DateTime? SelectedDateTime
{ {
get => (DateTime?)GetValue(SelectedDateTimeProperty); get => (DateTime?) GetValue(SelectedDateTimeProperty);
set => SetValue(SelectedDateTimeProperty, value); set => SetValue(SelectedDateTimeProperty, value);
} }
@@ -114,9 +114,9 @@ namespace HandyControl.Controls
private static void OnDisplayDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnDisplayDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (CalendarWithClock)d; var ctl = (CalendarWithClock) d;
if (ctl.IsHandlerSuspended(DisplayDateTimeProperty)) return; if (ctl.IsHandlerSuspended(DisplayDateTimeProperty)) return;
var v = (DateTime)e.NewValue; var v = (DateTime) e.NewValue;
ctl._clock.SelectedTime = v; ctl._clock.SelectedTime = v;
ctl._calendar.SelectedDate = v; ctl._calendar.SelectedDate = v;
ctl.OnDisplayDateTimeChanged(new FunctionEventArgs<DateTime>(v)); ctl.OnDisplayDateTimeChanged(new FunctionEventArgs<DateTime>(v));
@@ -124,7 +124,7 @@ namespace HandyControl.Controls
public DateTime DisplayDateTime public DateTime DisplayDateTime
{ {
get => (DateTime)GetValue(DisplayDateTimeProperty); get => (DateTime) GetValue(DisplayDateTimeProperty);
set => SetValue(DisplayDateTimeProperty, value); set => SetValue(DisplayDateTimeProperty, value);
} }
@@ -203,7 +203,7 @@ namespace HandyControl.Controls
private void Canvas_OnMouseWheel(object sender, MouseWheelEventArgs e) private void Canvas_OnMouseWheel(object sender, MouseWheelEventArgs e)
{ {
var value = (int)_rotateTransformClock.Angle; var value = (int) _rotateTransformClock.Angle;
if (e.Delta < 0) if (e.Delta < 0)
{ {
value += 6; value += 6;
@@ -297,7 +297,7 @@ namespace HandyControl.Controls
var hRest = h % 12; var hRest = h % 12;
if (hRest == 0) hRest = 12; if (hRest == 0) hRest = 12;
var ctl = _radioButtonList[hRest-1]; var ctl = _radioButtonList[hRest - 1];
ctl.IsChecked = true; ctl.IsChecked = true;
ctl.RaiseEvent(new RoutedEventArgs { RoutedEvent = ButtonBase.ClickEvent }); ctl.RaiseEvent(new RoutedEventArgs { RoutedEvent = ButtonBase.ClickEvent });
@@ -322,7 +322,7 @@ namespace HandyControl.Controls
hValue = 0; hValue = 0;
} }
var now = DateTime.Now; var now = DateTime.Now;
return new DateTime(now.Year, now.Month, now.Day, hValue, (int)Math.Abs(_rotateTransformClock.Angle) % 360 / 6, _secValue); return new DateTime(now.Year, now.Month, now.Day, hValue, (int) Math.Abs(_rotateTransformClock.Angle) % 360 / 6, _secValue);
} }
private void ButtonAm_OnClick(object sender, RoutedEventArgs e) => Update(); private void ButtonAm_OnClick(object sender, RoutedEventArgs e) => Update();
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
public string TimeFormat public string TimeFormat
{ {
get => (string)GetValue(TimeFormatProperty); get => (string) GetValue(TimeFormatProperty);
set => SetValue(TimeFormatProperty, value); set => SetValue(TimeFormatProperty, value);
} }
@@ -42,8 +42,8 @@ namespace HandyControl.Controls
private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ClockBase)d; var ctl = (ClockBase) d;
var v = (DateTime?)e.NewValue; var v = (DateTime?) e.NewValue;
ctl.DisplayTime = v ?? DateTime.Now; ctl.DisplayTime = v ?? DateTime.Now;
ctl.OnSelectedTimeChanged(new FunctionEventArgs<DateTime?>(SelectedTimeChangedEvent, ctl) ctl.OnSelectedTimeChanged(new FunctionEventArgs<DateTime?>(SelectedTimeChangedEvent, ctl)
{ {
@@ -64,15 +64,15 @@ namespace HandyControl.Controls
private static void OnDisplayTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnDisplayTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var ctl = (ClockBase)d; var ctl = (ClockBase) d;
var v = (DateTime)e.NewValue; var v = (DateTime) e.NewValue;
ctl.Update(v); ctl.Update(v);
ctl.OnDisplayTimeChanged(new FunctionEventArgs<DateTime>(v)); ctl.OnDisplayTimeChanged(new FunctionEventArgs<DateTime>(v));
} }
public DateTime DisplayTime public DateTime DisplayTime
{ {
get => (DateTime)GetValue(DisplayTimeProperty); get => (DateTime) GetValue(DisplayTimeProperty);
set => SetValue(DisplayTimeProperty, value); set => SetValue(DisplayTimeProperty, value);
} }
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
private bool _isDisposed; private bool _isDisposed;
public static readonly DependencyProperty NumberListProperty = DependencyProperty.Register( public static readonly DependencyProperty NumberListProperty = DependencyProperty.Register(
"NumberList", typeof(List<int>), typeof(FlipClock), new PropertyMetadata(new List<int> {0, 0, 0, 0, 0, 0})); "NumberList", typeof(List<int>), typeof(FlipClock), new PropertyMetadata(new List<int> { 0, 0, 0, 0, 0, 0 }));
public List<int> NumberList public List<int> NumberList
{ {
@@ -40,7 +40,7 @@ namespace HandyControl.Controls
public CornerRadius CornerRadius public CornerRadius CornerRadius
{ {
get => (CornerRadius)GetValue(CornerRadiusProperty); get => (CornerRadius) GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value); set => SetValue(CornerRadiusProperty, value);
} }
@@ -49,7 +49,7 @@ namespace HandyControl.Controls
public Brush Background public Brush Background
{ {
get => (Brush)GetValue(BackgroundProperty); get => (Brush) GetValue(BackgroundProperty);
set => SetValue(BackgroundProperty, value); set => SetValue(BackgroundProperty, value);
} }
@@ -58,7 +58,7 @@ namespace HandyControl.Controls
public Brush Foreground public Brush Foreground
{ {
get => (Brush)GetValue(ForegroundProperty); get => (Brush) GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value); set => SetValue(ForegroundProperty, value);
} }
@@ -68,7 +68,7 @@ namespace HandyControl.Controls
[TypeConverter(typeof(FontSizeConverter))] [TypeConverter(typeof(FontSizeConverter))]
public double FontSize public double FontSize
{ {
get => (double)GetValue(FontSizeProperty); get => (double) GetValue(FontSizeProperty);
set => SetValue(FontSizeProperty, value); set => SetValue(FontSizeProperty, value);
} }
@@ -76,11 +76,11 @@ namespace HandyControl.Controls
"Number", typeof(int), typeof(FlipNumber), new PropertyMetadata(ValueBoxes.Int0Box, OnNumberChanged)); "Number", typeof(int), typeof(FlipNumber), new PropertyMetadata(ValueBoxes.Int0Box, OnNumberChanged));
private static void OnNumberChanged(DependencyObject s, DependencyPropertyChangedEventArgs e) => private static void OnNumberChanged(DependencyObject s, DependencyPropertyChangedEventArgs e) =>
((FlipNumber)s).OnNumberChanged(); ((FlipNumber) s).OnNumberChanged();
public int Number public int Number
{ {
get => (int)GetValue(NumberProperty); get => (int) GetValue(NumberProperty);
set => SetValue(NumberProperty, value); set => SetValue(NumberProperty, value);
} }
@@ -78,7 +78,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public bool ShowSpeStr public bool ShowSpeStr
{ {
get => (bool)GetValue(ShowSpeStrProperty); get => (bool) GetValue(ShowSpeStrProperty);
set => SetValue(ShowSpeStrProperty, ValueBoxes.BooleanBox(value)); set => SetValue(ShowSpeStrProperty, ValueBoxes.BooleanBox(value));
} }
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
internal string SpeStr internal string SpeStr
{ {
get => (string)GetValue(SpeStrProperty); get => (string) GetValue(SpeStrProperty);
set => SetValue(SpeStrProperty, value); set => SetValue(SpeStrProperty, value);
} }
@@ -116,7 +116,7 @@ namespace HandyControl.Controls
{ {
if (d is TimeBar timeBar && timeBar._textBlockSelected != null) if (d is TimeBar timeBar && timeBar._textBlockSelected != null)
{ {
timeBar.OnSelectedTimeChanged((DateTime)e.NewValue); timeBar.OnSelectedTimeChanged((DateTime) e.NewValue);
} }
} }
@@ -125,7 +125,7 @@ namespace HandyControl.Controls
/// </summary> /// </summary>
public DateTime SelectedTime public DateTime SelectedTime
{ {
get => (DateTime)GetValue(SelectedTimeProperty); get => (DateTime) GetValue(SelectedTimeProperty);
set => SetValue(SelectedTimeProperty, value); set => SetValue(SelectedTimeProperty, value);
} }
@@ -237,7 +237,7 @@ namespace HandyControl.Controls
_dateTimeRanges.Add(item); _dateTimeRanges.Add(item);
} }
} }
else if(e.Action == NotifyCollectionChangedAction.Remove) else if (e.Action == NotifyCollectionChangedAction.Remove)
{ {
foreach (DateTimeRange item in e.OldItems) foreach (DateTimeRange item in e.OldItems)
{ {
@@ -300,7 +300,7 @@ namespace HandyControl.Controls
private void CheckNull() private void CheckNull()
{ {
if (_borderTop == null || _textBlockMove == null|| _textBlockSelected == null || _canvasSpe == null) throw new Exception(); if (_borderTop == null || _textBlockMove == null || _textBlockSelected == null || _canvasSpe == null) throw new Exception();
} }
/// <summary> /// <summary>
@@ -477,7 +477,7 @@ namespace HandyControl.Controls
_speBlockList.Clear(); _speBlockList.Clear();
_canvasSpe.Children.Clear(); _canvasSpe.Children.Clear();
_speCount = (int)(ActualWidth / 800 * 9) | 1; _speCount = (int) (ActualWidth / 800 * 9) | 1;
var itemWidthOld = _itemWidth; var itemWidthOld = _itemWidth;
_itemWidth = ActualWidth / _speCount; _itemWidth = ActualWidth / _speCount;
@@ -57,7 +57,7 @@ namespace HandyControl.Controls
public IList SelectedItems public IList SelectedItems
{ {
get => (IList)GetValue(SelectedItemsProperty); get => (IList) GetValue(SelectedItemsProperty);
set => SetValue(SelectedItemsProperty, value); set => SetValue(SelectedItemsProperty, value);
} }
@@ -17,9 +17,9 @@ namespace HandyControl.Controls
private static SystemVersionInfo GetSystemVersionInfo() private static SystemVersionInfo GetSystemVersionInfo()
{ {
var osv = new InteropValues.RTL_OSVERSIONINFOEX(); var osv = new InteropValues.RTL_OSVERSIONINFOEX();
osv.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osv); osv.dwOSVersionInfoSize = (uint) Marshal.SizeOf(osv);
InteropMethods.Gdip.RtlGetVersion(out osv); InteropMethods.Gdip.RtlGetVersion(out osv);
return new SystemVersionInfo((int)osv.dwMajorVersion, (int)osv.dwMinorVersion, (int)osv.dwBuildNumber); return new SystemVersionInfo((int) osv.dwMajorVersion, (int) osv.dwMinorVersion, (int) osv.dwBuildNumber);
} }
internal static void EnableBlur(Window window) internal static void EnableBlur(Window window)
@@ -35,7 +35,7 @@ namespace HandyControl.Controls
public Color ActiveGlowColor public Color ActiveGlowColor
{ {
get => (Color)GetValue(ActiveGlowColorProperty); get => (Color) GetValue(ActiveGlowColorProperty);
set => SetValue(ActiveGlowColorProperty, value); set => SetValue(ActiveGlowColorProperty, value);
} }
@@ -44,7 +44,7 @@ namespace HandyControl.Controls
public Color InactiveGlowColor public Color InactiveGlowColor
{ {
get => (Color)GetValue(InactiveGlowColorProperty); get => (Color) GetValue(InactiveGlowColorProperty);
set => SetValue(InactiveGlowColorProperty, value); set => SetValue(InactiveGlowColorProperty, value);
} }
@@ -195,7 +195,7 @@ namespace HandyControl.Controls
private GlowEdge GetOrCreateGlowWindow(int direction) private GlowEdge GetOrCreateGlowWindow(int direction)
{ {
return _glowEdges[direction] ?? (_glowEdges[direction] = new GlowEdge(this, (Dock)direction) return _glowEdges[direction] ?? (_glowEdges[direction] = new GlowEdge(this, (Dock) direction)
{ {
ActiveGlowColor = ActiveGlowColor, ActiveGlowColor = ActiveGlowColor,
InactiveGlowColor = InactiveGlowColor, InactiveGlowColor = InactiveGlowColor,
@@ -205,11 +205,11 @@ namespace HandyControl.Controls
private static void OnResizeModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) private static void OnResizeModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{ {
var customChromeWindow = (GlowWindow)obj; var customChromeWindow = (GlowWindow) obj;
customChromeWindow.UpdateGlowVisibility(false); customChromeWindow.UpdateGlowVisibility(false);
} }
private static void OnGlowColorChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) => ((GlowWindow)obj).UpdateGlowColors(); private static void OnGlowColorChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) => ((GlowWindow) obj).UpdateGlowColors();
private void UpdateGlowColors() private void UpdateGlowColors()
{ {
@@ -303,7 +303,7 @@ namespace HandyControl.Controls
private void WmWindowPosChanging(IntPtr lParam) private void WmWindowPosChanging(IntPtr lParam)
{ {
var windowpos = (InteropValues.WINDOWPOS)Marshal.PtrToStructure(lParam, typeof(InteropValues.WINDOWPOS)); var windowpos = (InteropValues.WINDOWPOS) Marshal.PtrToStructure(lParam, typeof(InteropValues.WINDOWPOS));
if ((windowpos.flags & 2u) == 0u && (windowpos.flags & 1u) == 0u && windowpos.cx > 0 && windowpos.cy > 0) if ((windowpos.flags & 2u) == 0u && (windowpos.flags & 1u) == 0u && windowpos.cx > 0 && windowpos.cy > 0)
{ {
var rect = new Rect(windowpos.x, windowpos.y, windowpos.cx, windowpos.cy); var rect = new Rect(windowpos.x, windowpos.y, windowpos.cx, windowpos.cy);
@@ -317,8 +317,8 @@ namespace HandyControl.Controls
var logicalRect = GetOnScreenPosition(rect); var logicalRect = GetOnScreenPosition(rect);
logicalRect = logicalRect.LogicalToDeviceUnits(); logicalRect = logicalRect.LogicalToDeviceUnits();
windowpos.x = (int)logicalRect.X; windowpos.x = (int) logicalRect.X;
windowpos.y = (int)logicalRect.Y; windowpos.y = (int) logicalRect.Y;
Marshal.StructureToPtr(windowpos, lParam, true); Marshal.StructureToPtr(windowpos, lParam, true);
} }
} }
@@ -364,7 +364,7 @@ namespace HandyControl.Controls
{ {
try try
{ {
var windowpos = (InteropValues.WINDOWPOS)Marshal.PtrToStructure(lParam, typeof(InteropValues.WINDOWPOS)); var windowpos = (InteropValues.WINDOWPOS) Marshal.PtrToStructure(lParam, typeof(InteropValues.WINDOWPOS));
UpdateGlowWindowPositions((windowpos.flags & 64u) == 0u); UpdateGlowWindowPositions((windowpos.flags & 64u) == 0u);
UpdateZOrderOfThisAndOwner(); UpdateZOrderOfThisAndOwner();
@@ -399,7 +399,7 @@ namespace HandyControl.Controls
{ {
var hMonitor = InteropMethods.MonitorFromWindow(hWnd, 2); var hMonitor = InteropMethods.MonitorFromWindow(hWnd, 2);
var result = default(InteropValues.MONITORINFO); var result = default(InteropValues.MONITORINFO);
result.cbSize = (uint)Marshal.SizeOf(typeof(InteropValues.MONITORINFO)); result.cbSize = (uint) Marshal.SizeOf(typeof(InteropValues.MONITORINFO));
InteropMethods.GetMonitorInfo(hMonitor, ref result); InteropMethods.GetMonitorInfo(hMonitor, ref result);
return result; return result;
} }
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff. Show more