This commit is contained in:
NaBian committed 2022-03-15 00:01:04 +08:00
commit 04b01db546
34 files changed
+253 -253

No files matched your search

@@ -27,13 +27,13 @@ public partial class App
public App() public App()
{ {
#if !NET40 #if !NET40
var cachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache"; var cachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache";
if (!Directory.Exists(cachePath)) if (!Directory.Exists(cachePath))
{ {
Directory.CreateDirectory(cachePath); Directory.CreateDirectory(cachePath);
} }
ProfileOptimization.SetProfileRoot(cachePath); ProfileOptimization.SetProfileRoot(cachePath);
ProfileOptimization.StartProfile("Profile"); ProfileOptimization.StartProfile("Profile");
#endif #endif
} }
@@ -80,7 +80,7 @@ public partial class App
#if NET40 #if NET40
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
#else #else
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif #endif
} }
} }
@@ -23,7 +23,7 @@ public class DemoItemModel : ObservableObject
#if NET40 #if NET40
set => Set(nameof(QueriesText), ref _queriesText, value); set => Set(nameof(QueriesText), ref _queriesText, value);
#else #else
set => Set(ref _queriesText, value); set => Set(ref _queriesText, value);
#endif #endif
} }
@@ -33,7 +33,7 @@ public class DemoItemModel : ObservableObject
#if NET40 #if NET40
set => Set(nameof(IsVisible), ref _isVisible, value); set => Set(nameof(IsVisible), ref _isVisible, value);
#else #else
set => Set(ref _isVisible, value); set => Set(ref _isVisible, value);
#endif #endif
} }
} }
@@ -35,7 +35,7 @@ internal class VersionHelper
#elif NET6_0 #elif NET6_0
var netVersion = "NET 60"; var netVersion = "NET 60";
#elif NETCOREAPP3_0 #elif NETCOREAPP3_0
var netVersion = "CORE 30"; var netVersion = "CORE 30";
#elif NETCOREAPP3_1 #elif NETCOREAPP3_1
var netVersion = "CORE 31"; var netVersion = "CORE 31";
#endif #endif
@@ -46,7 +46,7 @@ public class ChatBoxViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(ChatString), ref _chatString, value); set => Set(nameof(ChatString), ref _chatString, value);
#else #else
set => Set(ref _chatString, value); set => Set(ref _chatString, value);
#endif #endif
} }
@@ -17,7 +17,7 @@ public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable<strin
#if NET40 #if NET40
set => Set(nameof(Result), ref _result, value); set => Set(nameof(Result), ref _result, value);
#else #else
set => Set(ref _result, value); set => Set(ref _result, value);
#endif #endif
} }
@@ -29,7 +29,7 @@ public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable<strin
#if NET40 #if NET40
set => Set(nameof(Message), ref _message, value); set => Set(nameof(Message), ref _message, value);
#else #else
set => Set(ref _message, value); set => Set(ref _message, value);
#endif #endif
} }
@@ -20,11 +20,11 @@ public class AutoCompleteTextBoxDemoViewModel : ViewModelBase
FilterItems(value); FilterItems(value);
} }
#else #else
set set
{ {
Set(ref _searchText, value); Set(ref _searchText, value);
FilterItems(value); FilterItems(value);
} }
#endif #endif
} }
@@ -13,7 +13,7 @@ public class BadgeDemoViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(Count), ref _count, value); set => Set(nameof(Count), ref _count, value);
#else #else
set => Set(ref _count, value); set => Set(ref _count, value);
#endif #endif
} }
@@ -23,7 +23,7 @@ public class DialogDemoViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(DialogResult), ref _dialogResult, value); set => Set(nameof(DialogResult), ref _dialogResult, value);
#else #else
set => Set(ref _dialogResult, value); set => Set(ref _dialogResult, value);
#endif #endif
} }
@@ -58,21 +58,21 @@ public class DialogDemoViewModel : ViewModelBase
} }
} }
#else #else
public RelayCommand<bool> ShowInteractiveDialogCmd => new(async withTimer => await ShowInteractiveDialog(withTimer)); public RelayCommand<bool> ShowInteractiveDialogCmd => new(async withTimer => await ShowInteractiveDialog(withTimer));
private async Task ShowInteractiveDialog(bool withTimer) private async Task ShowInteractiveDialog(bool withTimer)
{
if (!withTimer)
{ {
if (!withTimer) DialogResult = await Dialog.Show<InteractiveDialog>()
{ .Initialize<InteractiveDialogViewModel>(vm => vm.Message = DialogResult)
DialogResult = await Dialog.Show<InteractiveDialog>() .GetResultAsync<string>();
.Initialize<InteractiveDialogViewModel>(vm => vm.Message = DialogResult)
.GetResultAsync<string>();
}
else
{
await Dialog.Show<TextDialogWithTimer>(MessageToken.MainWindow).GetResultAsync<string>();
}
} }
else
{
await Dialog.Show<TextDialogWithTimer>(MessageToken.MainWindow).GetResultAsync<string>();
}
}
#endif #endif
public RelayCommand NewWindowCmd => new(() => new DialogDemoWindow public RelayCommand NewWindowCmd => new(() => new DialogDemoWindow
@@ -18,7 +18,7 @@ public class NotificationDemoViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(ShowAnimation) ,ref _showAnimation, value); set => Set(nameof(ShowAnimation) ,ref _showAnimation, value);
#else #else
set => Set(ref _showAnimation, value); set => Set(ref _showAnimation, value);
#endif #endif
} }
@@ -30,7 +30,7 @@ public class NotificationDemoViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(StaysOpen) ,ref _staysOpen, value); set => Set(nameof(StaysOpen) ,ref _staysOpen, value);
#else #else
set => Set(ref _staysOpen, value); set => Set(ref _staysOpen, value);
#endif #endif
} }
} }
@@ -19,7 +19,7 @@ public class StepBarDemoViewModel : DemoViewModelBase<StepBarDemoModel>
#if NET40 #if NET40
set => Set(nameof(StepIndex), ref _stepIndex, value); set => Set(nameof(StepIndex), ref _stepIndex, value);
#else #else
set => Set(ref _stepIndex, value); set => Set(ref _stepIndex, value);
#endif #endif
} }
@@ -25,7 +25,7 @@ public class TagDemoViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(TagName), ref _tagName, value); set => Set(nameof(TagName), ref _tagName, value);
#else #else
set => Set(ref _tagName, value); set => Set(ref _tagName, value);
#endif #endif
} }
@@ -19,7 +19,7 @@ public class DemoViewModelBase<T> : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(DataList), ref _dataList, value); set => Set(nameof(DataList), ref _dataList, value);
#else #else
set => Set(ref _dataList, value); set => Set(ref _dataList, value);
#endif #endif
} }
} }
@@ -60,7 +60,7 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
#if NET40 #if NET40
set => Set(nameof(SubContent), ref _subContent, value); set => Set(nameof(SubContent), ref _subContent, value);
#else #else
set => Set(ref _subContent, value); set => Set(ref _subContent, value);
#endif #endif
} }
@@ -73,7 +73,7 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
#if NET40 #if NET40
set => Set(nameof(ContentTitle), ref _contentTitle, value); set => Set(nameof(ContentTitle), ref _contentTitle, value);
#else #else
set => Set(ref _contentTitle, value); set => Set(ref _contentTitle, value);
#endif #endif
} }
@@ -141,7 +141,7 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
#if NET40 #if NET40
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
#else #else
Task.Run(() => Task.Run(() =>
#endif #endif
{ {
DataList = _dataService.GetDemoDataList(); DataList = _dataService.GetDemoDataList();
@@ -30,7 +30,7 @@ public class NonClientAreaViewModel : ViewModelBase
#if NET40 #if NET40
set => Set(nameof(VersionInfo), ref _versionInfo, value); set => Set(nameof(VersionInfo), ref _versionInfo, value);
#else #else
set => Set(ref _versionInfo, value); set => Set(ref _versionInfo, value);
#endif #endif
} }
} }
@@ -72,7 +72,7 @@ public class ComboBox : System.Windows.Controls.ComboBox, IDataInput
_editableTextBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); _editableTextBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
_editableTextBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); _editableTextBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
_editableTextBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); _editableTextBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
_editableTextBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); _editableTextBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -93,7 +93,7 @@ public class ComboBox : System.Windows.Controls.ComboBox, IDataInput
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Mode = BindingMode.OneWayToSource, Mode = BindingMode.OneWayToSource,
#if !NET40 #if !NET40
Delay = 500, Delay = 500,
#endif #endif
Source = this Source = this
}); });
@@ -128,12 +128,12 @@ public class ComboBox : System.Windows.Controls.ComboBox, IDataInput
} }
#if !NET40 #if !NET40
protected override void OnDropDownClosed(EventArgs e) protected override void OnDropDownClosed(EventArgs e)
{ {
base.OnDropDownClosed(e); base.OnDropDownClosed(e);
_isAutoCompleteAction = false; _isAutoCompleteAction = false;
} }
#endif #endif
private void EditableTextBox_GotFocus(object sender, RoutedEventArgs e) private void EditableTextBox_GotFocus(object sender, RoutedEventArgs e)
@@ -271,7 +271,7 @@ public class ComboBox : System.Windows.Controls.ComboBox, IDataInput
ctl._autoCompleteTimer.Stop(); ctl._autoCompleteTimer.Stop();
ctl._autoCompleteTimer.Start(); ctl._autoCompleteTimer.Start();
#else #else
ctl.UpdateSearchItems(e.NewValue as string); ctl.UpdateSearchItems(e.NewValue as string);
#endif #endif
} }
@@ -298,14 +298,14 @@ public class ComboBox : System.Windows.Controls.ComboBox, IDataInput
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(ComboBox)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(ComboBox));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -40,7 +40,7 @@ public class DatePicker : System.Windows.Controls.DatePicker, IDataInput
{ {
_textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
_textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
_textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); _textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
_textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); _textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -100,14 +100,14 @@ public class DatePicker : System.Windows.Controls.DatePicker, IDataInput
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(DatePicker)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(DatePicker));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -289,14 +289,14 @@ public class DateTimePicker : Control, IDataInput
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(DateTimePicker)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(DateTimePicker));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -378,7 +378,7 @@ public class DateTimePicker : Control, IDataInput
_textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
_textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
_textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); _textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
_textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); _textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -542,29 +542,29 @@ public class DateTimePicker : Control, IDataInput
switch (e.Key) switch (e.Key)
{ {
case Key.System: case Key.System:
{
switch (e.SystemKey)
{ {
case Key.Down: switch (e.SystemKey)
{ {
if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) case Key.Down:
{ {
TogglePopup(); if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
return true; {
} TogglePopup();
return true;
}
break; break;
}
} }
break;
} }
break;
}
case Key.Enter: case Key.Enter:
{ {
SetSelectedDateTime(); SetSelectedDateTime();
return true; return true;
} }
} }
return false; return false;
@@ -53,7 +53,7 @@ public class NumericUpDown : Control
{ {
_textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
_textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
_textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); _textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
_textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); _textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -311,14 +311,14 @@ public class NumericUpDown : Control
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(NumericUpDown)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(NumericUpDown));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -160,14 +160,14 @@ public class PasswordBox : Control, IDataInput
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(PasswordBox)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(PasswordBox));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -191,10 +191,10 @@ public class PasswordBox : Control, IDataInput
#if !NET40 #if !NET40
public static readonly DependencyProperty IsSelectionActiveProperty = public static readonly DependencyProperty IsSelectionActiveProperty =
TextBoxBase.IsSelectionActiveProperty.AddOwner(typeof(PasswordBox)); TextBoxBase.IsSelectionActiveProperty.AddOwner(typeof(PasswordBox));
public bool IsSelectionActive => ActualPasswordBox != null && (bool) ActualPasswordBox.GetValue(IsSelectionActiveProperty); public bool IsSelectionActive => ActualPasswordBox != null && (bool) ActualPasswordBox.GetValue(IsSelectionActiveProperty);
#endif #endif
@@ -314,7 +314,7 @@ public class PasswordBox : Control, IDataInput
ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.MaxLengthProperty, new Binding(MaxLengthProperty.Name) { Source = this }); ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.MaxLengthProperty, new Binding(MaxLengthProperty.Name) { Source = this });
ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); ActualPasswordBox.SetBinding(System.Windows.Controls.PasswordBox.CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -292,14 +292,14 @@ public class PinBox : Control
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(PinBox)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(PinBox));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -361,7 +361,7 @@ public class PinBox : Control
passwordBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); passwordBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
passwordBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); passwordBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
passwordBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); passwordBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
passwordBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); passwordBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -311,14 +311,14 @@ public class TimePicker : Control, IDataInput
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
public static readonly DependencyProperty SelectionTextBrushProperty = public static readonly DependencyProperty SelectionTextBrushProperty =
TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(TimePicker)); TextBoxBase.SelectionTextBrushProperty.AddOwner(typeof(TimePicker));
public Brush SelectionTextBrush public Brush SelectionTextBrush
{ {
get => (Brush) GetValue(SelectionTextBrushProperty); get => (Brush) GetValue(SelectionTextBrushProperty);
set => SetValue(SelectionTextBrushProperty, value); set => SetValue(SelectionTextBrushProperty, value);
} }
#endif #endif
@@ -473,7 +473,7 @@ public class TimePicker : Control, IDataInput
_textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
_textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); _textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this });
#endif #endif
_textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); _textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this });
_textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); _textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this });
@@ -574,29 +574,29 @@ public class TimePicker : Control, IDataInput
switch (e.Key) switch (e.Key)
{ {
case Key.System: case Key.System:
{
switch (e.SystemKey)
{ {
case Key.Down: switch (e.SystemKey)
{ {
if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) case Key.Down:
{ {
TogglePopup(); if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
return true; {
} TogglePopup();
return true;
}
break; break;
}
} }
break;
} }
break;
}
case Key.Enter: case Key.Enter:
{ {
SetSelectedTime(); SetSelectedTime();
return true; return true;
} }
} }
return false; return false;
@@ -97,31 +97,31 @@ public sealed class Notification : System.Windows.Window
case ShowAnimation.None: case ShowAnimation.None:
break; break;
case ShowAnimation.HorizontalMove: case ShowAnimation.HorizontalMove:
{ {
var animation = AnimationHelper.CreateAnimation(desktopWorkingArea.Width); var animation = AnimationHelper.CreateAnimation(desktopWorkingArea.Width);
animation.Completed += Animation_Completed; animation.Completed += Animation_Completed;
BeginAnimation(LeftProperty, animation); BeginAnimation(LeftProperty, animation);
e.Cancel = true; e.Cancel = true;
_shouldBeClosed = true; _shouldBeClosed = true;
} }
break; break;
case ShowAnimation.VerticalMove: case ShowAnimation.VerticalMove:
{ {
var animation = AnimationHelper.CreateAnimation(desktopWorkingArea.Height); var animation = AnimationHelper.CreateAnimation(desktopWorkingArea.Height);
animation.Completed += Animation_Completed; animation.Completed += Animation_Completed;
BeginAnimation(TopProperty, animation); BeginAnimation(TopProperty, animation);
e.Cancel = true; e.Cancel = true;
_shouldBeClosed = true; _shouldBeClosed = true;
} }
break; break;
case ShowAnimation.Fade: case ShowAnimation.Fade:
{ {
var animation = AnimationHelper.CreateAnimation(0); var animation = AnimationHelper.CreateAnimation(0);
animation.Completed += Animation_Completed; animation.Completed += Animation_Completed;
BeginAnimation(OpacityProperty, animation); BeginAnimation(OpacityProperty, animation);
e.Cancel = true; e.Cancel = true;
_shouldBeClosed = true; _shouldBeClosed = true;
} }
break; break;
} }
} }
@@ -9,8 +9,8 @@ public class PropertyItemsControl : ListBox
public PropertyItemsControl() public PropertyItemsControl()
{ {
#if !NET40 #if !NET40
VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true); VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true);
VirtualizingPanel.SetScrollUnit(this, ScrollUnit.Pixel); VirtualizingPanel.SetScrollUnit(this, ScrollUnit.Pixel);
#endif #endif
} }
} }
@@ -233,24 +233,24 @@ public class ScreenshotWindow : System.Windows.Window
switch (e.Key) switch (e.Key)
{ {
case Key.Left: case Key.Left:
{ {
MoveTargetArea(MoveRect(_targetWindowRect, -1, rightFlag: -1)); MoveTargetArea(MoveRect(_targetWindowRect, -1, rightFlag: -1));
} }
break; break;
case Key.Up: case Key.Up:
{ {
MoveTargetArea(MoveRect(_targetWindowRect, bottomFlag: -1, topFlag: -1)); MoveTargetArea(MoveRect(_targetWindowRect, bottomFlag: -1, topFlag: -1));
} }
break; break;
case Key.Right: case Key.Right:
{ {
MoveTargetArea(MoveRect(_targetWindowRect, 1, rightFlag: 1)); MoveTargetArea(MoveRect(_targetWindowRect, 1, rightFlag: 1));
} }
break; break;
case Key.Down: case Key.Down:
{ {
MoveTargetArea(MoveRect(_targetWindowRect, bottomFlag: 1, topFlag: 1)); MoveTargetArea(MoveRect(_targetWindowRect, bottomFlag: 1, topFlag: 1));
} }
break; break;
case Key.Enter: case Key.Enter:
_saveScreenshot = true; _saveScreenshot = true;
@@ -86,8 +86,8 @@ public class HighlightTextBlock : TextBlock
var sourceText = SourceText; var sourceText = SourceText;
var queries = QueriesText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var queries = QueriesText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
var intervals = from query in queries.Distinct() var intervals = from query in queries.Distinct()
from interval in GetQueryIntervals(sourceText, query) from interval in GetQueryIntervals(sourceText, query)
select interval; select interval;
var mergedIntervals = MergeIntervals(intervals.ToList()); var mergedIntervals = MergeIntervals(intervals.ToList());
var fragments = SplitTextByOrderedDisjointIntervals(sourceText, mergedIntervals); var fragments = SplitTextByOrderedDisjointIntervals(sourceText, mergedIntervals);
@@ -97,9 +97,9 @@ public class HighlightTextBlock : TextBlock
private IEnumerable GenerateRunElement(IEnumerable<Fragment> fragments) private IEnumerable GenerateRunElement(IEnumerable<Fragment> fragments)
{ {
return from item in fragments return from item in fragments
select item.IsQuery select item.IsQuery
? GetHighlightRun(item.Text) ? GetHighlightRun(item.Text)
: new Run(item.Text); : new Run(item.Text);
} }
private Run GetHighlightRun(string highlightText) private Run GetHighlightRun(string highlightText)
@@ -203,12 +203,12 @@ internal class GlowEdge : HwndWrapper
case 169: case 169:
case 171: case 171:
case 173: case 173:
{ {
var targetWindowHandle = TargetWindowHandle; var targetWindowHandle = TargetWindowHandle;
InteropMethods.SendMessage(targetWindowHandle, 6, new IntPtr(2), IntPtr.Zero); InteropMethods.SendMessage(targetWindowHandle, 6, new IntPtr(2), IntPtr.Zero);
InteropMethods.SendMessage(targetWindowHandle, msg, wParam, IntPtr.Zero); InteropMethods.SendMessage(targetWindowHandle, msg, wParam, IntPtr.Zero);
return IntPtr.Zero; return IntPtr.Zero;
} }
} }
} }
else else
@@ -57,37 +57,37 @@ public class LangExtension : MarkupExtension
switch (Key) switch (Key)
{ {
case string key: case string key:
{ {
var binding = CreateLangBinding(key); var binding = CreateLangBinding(key);
BindingOperations.SetBinding(targetObject, targetProperty, binding); BindingOperations.SetBinding(targetObject, targetProperty, binding);
return binding.ProvideValue(serviceProvider); return binding.ProvideValue(serviceProvider);
} }
case Binding keyBinding when targetObject is FrameworkElement element: case Binding keyBinding when targetObject is FrameworkElement element:
{
if (element.DataContext != null)
{ {
var binding = SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); if (element.DataContext != null)
return binding.ProvideValue(serviceProvider); {
var binding = SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext);
return binding.ProvideValue(serviceProvider);
}
SetTargetProperty(element, targetProperty);
element.DataContextChanged += LangExtension_DataContextChanged;
break;
} }
SetTargetProperty(element, targetProperty);
element.DataContextChanged += LangExtension_DataContextChanged;
break;
}
case Binding keyBinding when targetObject is FrameworkContentElement element: case Binding keyBinding when targetObject is FrameworkContentElement element:
{
if (element.DataContext != null)
{ {
var binding = SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); if (element.DataContext != null)
return binding.ProvideValue(serviceProvider); {
var binding = SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext);
return binding.ProvideValue(serviceProvider);
}
SetTargetProperty(element, targetProperty);
element.DataContextChanged += LangExtension_DataContextChanged;
break;
} }
SetTargetProperty(element, targetProperty);
element.DataContextChanged += LangExtension_DataContextChanged;
break;
}
} }
return string.Empty; return string.Empty;
@@ -98,25 +98,25 @@ public class LangExtension : MarkupExtension
switch (sender) switch (sender)
{ {
case FrameworkElement element: case FrameworkElement element:
{ {
element.DataContextChanged -= LangExtension_DataContextChanged; element.DataContextChanged -= LangExtension_DataContextChanged;
if (!(Key is Binding keyBinding)) return; if (!(Key is Binding keyBinding)) return;
var targetProperty = GetTargetProperty(element); var targetProperty = GetTargetProperty(element);
SetTargetProperty(element, null); SetTargetProperty(element, null);
SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext);
break; break;
} }
case FrameworkContentElement element: case FrameworkContentElement element:
{ {
element.DataContextChanged -= LangExtension_DataContextChanged; element.DataContextChanged -= LangExtension_DataContextChanged;
if (!(Key is Binding keyBinding)) return; if (!(Key is Binding keyBinding)) return;
var targetProperty = GetTargetProperty(element); var targetProperty = GetTargetProperty(element);
SetTargetProperty(element, null); SetTargetProperty(element, null);
SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext);
break; break;
} }
} }
} }
@@ -79,9 +79,9 @@ public class ConfigHelper : INotifyPropertyChanged
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
#else #else
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
#endif #endif
} }
@@ -16,12 +16,12 @@ internal class TextHelper
typeface, typeface,
fontSize, Brushes.Black); fontSize, Brushes.Black);
#else #else
var formattedText = new FormattedText( var formattedText = new FormattedText(
text, text,
CultureInfo.CurrentUICulture, CultureInfo.CurrentUICulture,
flowDirection, flowDirection,
typeface, typeface,
fontSize, Brushes.Black, DpiHelper.DeviceDpiX); fontSize, Brushes.Black, DpiHelper.DeviceDpiX);
#endif #endif
return formattedText; return formattedText;
@@ -140,10 +140,10 @@ public static class WindowHelper
#if NET40 #if NET40
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -8 : 0)); return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -8 : 0));
#elif NETCOREAPP #elif NETCOREAPP
var hdc = InteropMethods.GetDC(IntPtr.Zero); var hdc = InteropMethods.GetDC(IntPtr.Zero);
var scale = InteropMethods.GetDeviceCaps(hdc, InteropValues.DESKTOPVERTRES) / (float) InteropMethods.GetDeviceCaps(hdc, InteropValues.VERTRES); var scale = InteropMethods.GetDeviceCaps(hdc, InteropValues.DESKTOPVERTRES) / (float) InteropMethods.GetDeviceCaps(hdc, InteropValues.VERTRES);
InteropMethods.ReleaseDC(IntPtr.Zero, hdc); InteropMethods.ReleaseDC(IntPtr.Zero, hdc);
return WindowResizeBorderThickness.Add(new Thickness((autoHide ? -4 : 4) * scale)); return WindowResizeBorderThickness.Add(new Thickness((autoHide ? -4 : 4) * scale));
#else #else
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -4 : 4)); return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -4 : 4));
#endif #endif
@@ -45,12 +45,12 @@ public sealed class SketchGeometryEffect : GeometryEffect
{ {
var startPoint = pathFigure.StartPoint; var startPoint = pathFigure.StartPoint;
foreach (var iteratorVariable1 in pathFigure.AllSegments()) foreach (var iteratorVariable1 in pathFigure.AllSegments())
foreach (var iteratorVariable2 in iteratorVariable1.PathSegment.GetSimpleSegments( foreach (var iteratorVariable2 in iteratorVariable1.PathSegment.GetSimpleSegments(
iteratorVariable1.StartPoint)) iteratorVariable1.StartPoint))
{ {
yield return iteratorVariable2; yield return iteratorVariable2;
startPoint = iteratorVariable2.Points.Last(); startPoint = iteratorVariable2.Points.Last();
} }
if (pathFigure.IsClosed) yield return SimpleSegment.Create(startPoint, pathFigure.StartPoint); if (pathFigure.IsClosed) yield return SimpleSegment.Create(startPoint, pathFigure.StartPoint);
} }
@@ -603,7 +603,7 @@ internal static class Utility
urlDecoder.AddChar(c); urlDecoder.AddChar(c);
} }
} }
IL_12D:; IL_12D:;
} }
return urlDecoder.GetString(); return urlDecoder.GetString();
} }
@@ -201,7 +201,7 @@ public class SystemParameters2 : INotifyPropertyChanged
} }
} }
windowCornerRadius = new CornerRadius(0.0); windowCornerRadius = new CornerRadius(0.0);
IL_E6: IL_E6:
this.WindowCornerRadius = windowCornerRadius; this.WindowCornerRadius = windowCornerRadius;
} }
@@ -506,7 +506,7 @@ public sealed class TaskbarItemInfo : Freezable
default: default:
goto IL_A5; goto IL_A5;
} }
IL_146: IL_146:
array[(int) ((UIntPtr) num)] = thumbbutton; array[(int) ((UIntPtr) num)] = thumbbutton;
num += 1u; num += 1u;
if (num != 7u) if (num != 7u)
@@ -514,7 +514,7 @@ public sealed class TaskbarItemInfo : Freezable
continue; continue;
} }
break; break;
IL_A5: IL_A5:
thumbbutton.szTip = (thumbButtonInfo.Description ?? ""); thumbbutton.szTip = (thumbButtonInfo.Description ?? "");
thumbbutton.hIcon = this._GetHICONFromImageSource(thumbButtonInfo.ImageSource, this._overlaySize); thumbbutton.hIcon = this._GetHICONFromImageSource(thumbButtonInfo.ImageSource, this._overlaySize);
if (!thumbButtonInfo.IsBackgroundVisible) if (!thumbButtonInfo.IsBackgroundVisible)
@@ -542,7 +542,7 @@ public sealed class TaskbarItemInfo : Freezable
} }
goto IL_1AE; goto IL_1AE;
} }
IL_179: IL_179:
array[(int) ((UIntPtr) num)] = new THUMBBUTTON array[(int) ((UIntPtr) num)] = new THUMBBUTTON
{ {
iId = num, iId = num,
@@ -550,7 +550,7 @@ public sealed class TaskbarItemInfo : Freezable
dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS)
}; };
num += 1u; num += 1u;
IL_1AE: IL_1AE:
if (num < 7u) if (num < 7u)
{ {
goto IL_179; goto IL_179;