code formatting
This commit is contained in:
1 parent
6a3711e6e0
commit
5afb569d11
43 files changed
+200
-287
No files matched your search
@@ -2333,7 +2333,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
<Style x:Key="GroupBoxOriginalBaseStyle" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
|
<Style x:Key="GroupBoxOriginalBaseStyle" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
|
||||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
@@ -9578,7 +9577,6 @@
|
|||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
|
<Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
|
||||||
<Setter Property="Padding" Value="10" />
|
<Setter Property="Padding" Value="10" />
|
||||||
<Setter Property="hc:BorderElement.CornerRadius" Value="2" />
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ToolTip">
|
<ControlTemplate TargetType="ToolTip">
|
||||||
@@ -11342,7 +11340,7 @@
|
|||||||
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" Grid.ColumnSpan="3" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Name="PART_BorderTitle">
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" Grid.ColumnSpan="3" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Name="PART_BorderTitle">
|
||||||
<TextBlock x:Name="PART_TimeStr" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="{DynamicResource TextIconBrush}" />
|
<TextBlock x:Name="PART_TimeStr" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="{DynamicResource TextIconBrush}" />
|
||||||
</Border>
|
</Border>
|
||||||
<Canvas Grid.Row="1" Grid.ColumnSpan="3" Margin="0,16,0,0" VerticalAlignment="Top" Name="PART_Canvas" Width="178" Height="178">
|
<Canvas Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,16,0,0" VerticalAlignment="Top" Name="PART_Canvas" Width="178" Height="178">
|
||||||
<Border Background="{DynamicResource SecondaryRegionBrush}" Width="178" Height="178" CornerRadius="89" />
|
<Border Background="{DynamicResource SecondaryRegionBrush}" Width="178" Height="178" CornerRadius="89" />
|
||||||
<hc:CirclePanel Diameter="130" x:Name="PART_PanelNum" KeepVertical="True" Margin="24,24,0,0" OffsetAngle="-60" />
|
<hc:CirclePanel Diameter="130" x:Name="PART_PanelNum" KeepVertical="True" Margin="24,24,0,0" OffsetAngle="-60" />
|
||||||
<Border Focusable="False" Name="PART_BorderClock" Background="{DynamicResource PrimaryBrush}" RenderTransformOrigin="0.5,1" Height="63" Width="2" Canvas.Left="88" Canvas.Top="26" />
|
<Border Focusable="False" Name="PART_BorderClock" Background="{DynamicResource PrimaryBrush}" RenderTransformOrigin="0.5,1" Height="63" Width="2" Canvas.Left="88" Canvas.Top="26" />
|
||||||
|
|||||||
@@ -517,7 +517,7 @@
|
|||||||
<value>TextDialog</value>
|
<value>TextDialog</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="PleaseWait" xml:space="preserve">
|
<data name="PleaseWait" xml:space="preserve">
|
||||||
<value>Proszę czekać</value>
|
<value>Proszę czekać...</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GrowlDemo" xml:space="preserve">
|
<data name="GrowlDemo" xml:space="preserve">
|
||||||
<value>Growl demo</value>
|
<value>Growl demo</value>
|
||||||
@@ -792,4 +792,7 @@
|
|||||||
<data name="Success" xml:space="preserve">
|
<data name="Success" xml:space="preserve">
|
||||||
<value>Success</value>
|
<value>Success</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Empty" xml:space="preserve">
|
||||||
|
<value>Empty</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
|
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
|
||||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
|
||||||
DataContext="{Binding SplitButtonDemo,Source={StaticResource Locator}}">
|
DataContext="{Binding SplitButtonDemo,Source={StaticResource Locator}}">
|
||||||
<hc:TransitioningContentControl>
|
<hc:TransitioningContentControl>
|
||||||
<StackPanel Margin="32" VerticalAlignment="Center">
|
<StackPanel Margin="32" VerticalAlignment="Center">
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
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 not DataGrid dataGrid) return;
|
||||||
var show = (bool) e.NewValue;
|
var show = (bool) e.NewValue;
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
@@ -277,7 +277,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private static void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
|
private static void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(sender is ItemContainerGenerator generator)) return;
|
if (sender is not ItemContainerGenerator generator) return;
|
||||||
UpdateItems(generator, e.ItemCount);
|
UpdateItems(generator, e.ItemCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,10 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
var topLine = (FrameworkElement) d;
|
var topLine = (FrameworkElement) d;
|
||||||
|
|
||||||
if (e.NewValue is Popup popup)
|
if (e.NewValue is Popup {TemplatedParent: MenuItem menuItem})
|
||||||
{
|
{
|
||||||
if (popup.TemplatedParent is MenuItem menuItem)
|
SetTopLine(menuItem, topLine);
|
||||||
{
|
menuItem.Loaded += MenuItem_Loaded;
|
||||||
SetTopLine(menuItem, topLine);
|
|
||||||
menuItem.Loaded += MenuItem_Loaded;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,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 not FrameworkElement target) return;
|
||||||
var element = (AdornerElement) e.NewValue;
|
var element = (AdornerElement) e.NewValue;
|
||||||
element.OnInstanceChanged(target);
|
element.OnInstanceChanged(target);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private static void OnDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(d is UIElement target)) return;
|
if (d is not UIElement target) return;
|
||||||
|
|
||||||
target.PreviewMouseLeftButtonDown -= Target_PreviewMouseLeftButtonDown;
|
target.PreviewMouseLeftButtonDown -= Target_PreviewMouseLeftButtonDown;
|
||||||
target.PreviewMouseLeftButtonUp -= Target_PreviewMouseLeftButtonUp;
|
target.PreviewMouseLeftButtonUp -= Target_PreviewMouseLeftButtonUp;
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ namespace HandyControl.Controls
|
|||||||
var cIndex = _colorSeparateList.IndexOf(Color.FromRgb(list[0], list[1], list[2]));
|
var cIndex = _colorSeparateList.IndexOf(Color.FromRgb(list[0], list[1], list[2]));
|
||||||
int sub;
|
int sub;
|
||||||
var direc = 0;
|
var direc = 0;
|
||||||
if (cIndex < 5 && cIndex > 0)
|
if (cIndex is < 5 and > 0)
|
||||||
{
|
{
|
||||||
var nextColorList = _colorSeparateList[cIndex + 1].ToList();
|
var nextColorList = _colorSeparateList[cIndex + 1].ToList();
|
||||||
var prevColorList = _colorSeparateList[cIndex - 1].ToList();
|
var prevColorList = _colorSeparateList[cIndex - 1].ToList();
|
||||||
@@ -666,29 +666,18 @@ namespace HandyControl.Controls
|
|||||||
private void NumericUpDownRgb_OnValueChanged(object sender, FunctionEventArgs<double> e)
|
private void NumericUpDownRgb_OnValueChanged(object sender, FunctionEventArgs<double> e)
|
||||||
{
|
{
|
||||||
if (!_appliedTemplate || !IsNeedUpdateInfo) return;
|
if (!_appliedTemplate || !IsNeedUpdateInfo) return;
|
||||||
if (e.OriginalSource is NumericUpDown ctl && ctl.Tag is string tag)
|
if (e.OriginalSource is NumericUpDown {Tag: string tag})
|
||||||
{
|
{
|
||||||
var color = SelectedBrush.Color;
|
var color = SelectedBrush.Color;
|
||||||
IsNeedUpdateInfo = false;
|
IsNeedUpdateInfo = false;
|
||||||
|
|
||||||
switch (tag)
|
SelectedBrush = tag switch
|
||||||
{
|
{
|
||||||
case "R":
|
"R" => new SolidColorBrush(Color.FromArgb(color.A, (byte) e.Info, color.G, color.B)),
|
||||||
{
|
"G" => new SolidColorBrush(Color.FromArgb(color.A, color.R, (byte) e.Info, color.B)),
|
||||||
SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, (byte) e.Info, color.G, color.B));
|
"B" => new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, (byte) e.Info)),
|
||||||
break;
|
_ => SelectedBrush
|
||||||
}
|
};
|
||||||
case "G":
|
|
||||||
{
|
|
||||||
SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, color.R, (byte) e.Info, color.B));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "B":
|
|
||||||
{
|
|
||||||
SelectedBrush = new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, (byte) e.Info));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IsNeedUpdateInfo = true;
|
IsNeedUpdateInfo = true;
|
||||||
}
|
}
|
||||||
@@ -704,10 +693,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void ToggleButtonDropper_Click(object sender, RoutedEventArgs e)
|
private void ToggleButtonDropper_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_colorDropper == null)
|
_colorDropper ??= new ColorDropper(this);
|
||||||
{
|
|
||||||
_colorDropper = new ColorDropper(this);
|
|
||||||
}
|
|
||||||
// ReSharper disable once PossibleInvalidOperationException
|
// ReSharper disable once PossibleInvalidOperationException
|
||||||
_colorDropper.Update(_toggleButtonDropper.IsChecked.Value);
|
_colorDropper.Update(_toggleButtonDropper.IsChecked.Value);
|
||||||
}
|
}
|
||||||
@@ -730,7 +716,6 @@ namespace HandyControl.Controls
|
|||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanDispose { get; } = true;
|
public bool CanDispose => true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void Tags_OnClosed(object sender, RoutedEventArgs e)
|
private void Tags_OnClosed(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.OriginalSource is Tag tag && tag.Tag is CheckComboBoxItem checkComboBoxItem)
|
if (e.OriginalSource is Tag {Tag: CheckComboBoxItem checkComboBoxItem})
|
||||||
{
|
{
|
||||||
checkComboBoxItem.SetCurrentValue(IsSelectedProperty, false);
|
checkComboBoxItem.SetCurrentValue(IsSelectedProperty, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,13 @@ namespace HandyControl.Controls
|
|||||||
public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register(
|
||||||
"IsDropDownOpen", typeof(bool), typeof(DateTimePicker), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsDropDownOpenChanged, OnCoerceIsDropDownOpen));
|
"IsDropDownOpen", typeof(bool), typeof(DateTimePicker), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsDropDownOpenChanged, OnCoerceIsDropDownOpen));
|
||||||
|
|
||||||
private static object OnCoerceIsDropDownOpen(DependencyObject d, object baseValue) => d is DateTimePicker dp && !dp.IsEnabled ? false : baseValue;
|
private static object OnCoerceIsDropDownOpen(DependencyObject d, object baseValue) =>
|
||||||
|
d is DateTimePicker
|
||||||
|
{
|
||||||
|
IsEnabled: false
|
||||||
|
}
|
||||||
|
? false
|
||||||
|
: baseValue;
|
||||||
|
|
||||||
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -172,7 +178,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private static void OnSelectedDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnSelectedDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(d is DateTimePicker dp)) return;
|
if (d is not DateTimePicker dp) return;
|
||||||
|
|
||||||
if (dp.SelectedDateTime.HasValue)
|
if (dp.SelectedDateTime.HasValue)
|
||||||
{
|
{
|
||||||
@@ -555,7 +561,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void PopupPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void PopupPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is Popup popup && !popup.StaysOpen)
|
if (sender is Popup {StaysOpen: false})
|
||||||
{
|
{
|
||||||
if (_dropDownButton?.InputHitTest(e.GetPosition(_dropDownButton)) != null)
|
if (_dropDownButton?.InputHitTest(e.GetPosition(_dropDownButton)) != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -302,21 +302,18 @@ namespace HandyControl.Controls
|
|||||||
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 });
|
||||||
|
|
||||||
if (_password != null)
|
if (_password is {Length: > 0})
|
||||||
{
|
{
|
||||||
if (_password.Length > 0)
|
var valuePtr = IntPtr.Zero;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var valuePtr = IntPtr.Zero;
|
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(_password);
|
||||||
try
|
ActualPasswordBox.Password = Marshal.PtrToStringUni(valuePtr) ?? throw new InvalidOperationException();
|
||||||
{
|
}
|
||||||
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(_password);
|
finally
|
||||||
ActualPasswordBox.Password = Marshal.PtrToStringUni(valuePtr) ?? throw new InvalidOperationException();
|
{
|
||||||
}
|
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
|
||||||
finally
|
_password.Clear();
|
||||||
{
|
|
||||||
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
|
|
||||||
_password.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,13 @@ namespace HandyControl.Controls
|
|||||||
typeof(TimePicker),
|
typeof(TimePicker),
|
||||||
new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsDropDownOpenChanged, OnCoerceIsDropDownOpen));
|
new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsDropDownOpenChanged, OnCoerceIsDropDownOpen));
|
||||||
|
|
||||||
private static object OnCoerceIsDropDownOpen(DependencyObject d, object baseValue) => d is TimePicker dp && !dp.IsEnabled ? false : baseValue;
|
private static object OnCoerceIsDropDownOpen(DependencyObject d, object baseValue) =>
|
||||||
|
d is TimePicker
|
||||||
|
{
|
||||||
|
IsEnabled: false
|
||||||
|
}
|
||||||
|
? false
|
||||||
|
: baseValue;
|
||||||
|
|
||||||
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -183,7 +189,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(d is TimePicker dp)) return;
|
if (d is not TimePicker dp) return;
|
||||||
|
|
||||||
if (dp.SelectedTime.HasValue)
|
if (dp.SelectedTime.HasValue)
|
||||||
{
|
{
|
||||||
@@ -340,16 +346,14 @@ 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 newClock = e.NewValue as ClockBase;
|
|
||||||
|
|
||||||
if (oldClock != null)
|
if (e.OldValue is ClockBase oldClock)
|
||||||
{
|
{
|
||||||
oldClock.SelectedTimeChanged -= ctl.Clock_SelectedTimeChanged;
|
oldClock.SelectedTimeChanged -= ctl.Clock_SelectedTimeChanged;
|
||||||
oldClock.Confirmed -= ctl.Clock_Confirmed;
|
oldClock.Confirmed -= ctl.Clock_Confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newClock != null)
|
if (e.NewValue is ClockBase newClock)
|
||||||
{
|
{
|
||||||
newClock.ShowConfirmButton = true;
|
newClock.ShowConfirmButton = true;
|
||||||
newClock.SelectedTimeChanged += ctl.Clock_SelectedTimeChanged;
|
newClock.SelectedTimeChanged += ctl.Clock_SelectedTimeChanged;
|
||||||
@@ -589,7 +593,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void PopupPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void PopupPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is Popup popup && !popup.StaysOpen)
|
if (sender is Popup {StaysOpen: false})
|
||||||
{
|
{
|
||||||
if (_dropDownButton?.InputHitTest(e.GetPosition(_dropDownButton)) != null)
|
if (_dropDownButton?.InputHitTest(e.GetPosition(_dropDownButton)) != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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 is {Parent: AdornerLayer parent})
|
||||||
{
|
{
|
||||||
parent.Remove(_adornerContainer);
|
parent.Remove(_adornerContainer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,21 +192,14 @@ namespace HandyControl.Controls
|
|||||||
szInfo = content ?? string.Empty
|
szInfo = content ?? string.Empty
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (infoType)
|
data.dwInfoFlags = infoType switch
|
||||||
{
|
{
|
||||||
case NotifyIconInfoType.Info:
|
NotifyIconInfoType.Info => InteropValues.NIIF_INFO,
|
||||||
data.dwInfoFlags = InteropValues.NIIF_INFO;
|
NotifyIconInfoType.Warning => InteropValues.NIIF_WARNING,
|
||||||
break;
|
NotifyIconInfoType.Error => InteropValues.NIIF_ERROR,
|
||||||
case NotifyIconInfoType.Warning:
|
NotifyIconInfoType.None => InteropValues.NIIF_NONE,
|
||||||
data.dwInfoFlags = InteropValues.NIIF_WARNING;
|
_ => data.dwInfoFlags
|
||||||
break;
|
};
|
||||||
case NotifyIconInfoType.Error:
|
|
||||||
data.dwInfoFlags = InteropValues.NIIF_ERROR;
|
|
||||||
break;
|
|
||||||
case NotifyIconInfoType.None:
|
|
||||||
data.dwInfoFlags = InteropValues.NIIF_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
InteropMethods.Shell_NotifyIcon(InteropValues.NIM_MODIFY, data);
|
InteropMethods.Shell_NotifyIcon(InteropValues.NIM_MODIFY, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private static object CoercePageIndex(DependencyObject d, object basevalue)
|
private static object CoercePageIndex(DependencyObject d, object basevalue)
|
||||||
{
|
{
|
||||||
if (!(d is Pagination pagination)) return 1;
|
if (d is not Pagination pagination) return 1;
|
||||||
|
|
||||||
var intValue = (int) basevalue;
|
var intValue = (int) basevalue;
|
||||||
return intValue < 1
|
return intValue < 1
|
||||||
@@ -392,7 +392,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
|
private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(e.OriginalSource is RadioButton button)) return;
|
if (e.OriginalSource is not RadioButton button) return;
|
||||||
if (button.IsChecked == false) return;
|
if (button.IsChecked == false) return;
|
||||||
PageIndex = int.Parse(button.Content.ToString());
|
PageIndex = int.Parse(button.Content.ToString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ namespace HandyControl.Controls
|
|||||||
private void Element_MouseEnter(object sender, MouseEventArgs e)
|
private void Element_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
||||||
if (hitMode != HitMode.Hover || hitMode == HitMode.None) return;
|
if (hitMode != HitMode.Hover) return;
|
||||||
|
|
||||||
SwitchPoptip(true);
|
SwitchPoptip(true);
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ namespace HandyControl.Controls
|
|||||||
private void Element_MouseLeave(object sender, MouseEventArgs e)
|
private void Element_MouseLeave(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
||||||
if (hitMode != HitMode.Hover || hitMode == HitMode.None) return;
|
if (hitMode != HitMode.Hover) return;
|
||||||
|
|
||||||
SwitchPoptip(false);
|
SwitchPoptip(false);
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ namespace HandyControl.Controls
|
|||||||
private void Element_GotFocus(object sender, RoutedEventArgs e)
|
private void Element_GotFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
||||||
if (hitMode != HitMode.Focus || hitMode == HitMode.None) return;
|
if (hitMode != HitMode.Focus) return;
|
||||||
|
|
||||||
SwitchPoptip(true);
|
SwitchPoptip(true);
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ namespace HandyControl.Controls
|
|||||||
private void Element_LostFocus(object sender, RoutedEventArgs e)
|
private void Element_LostFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
|
||||||
if (hitMode != HitMode.Focus || hitMode == HitMode.None) return;
|
if (hitMode != HitMode.Focus) return;
|
||||||
|
|
||||||
SwitchPoptip(false);
|
SwitchPoptip(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,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 is >= 1 and <= 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Span
|
public int Span
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace HandyControl.Controls
|
|||||||
_ => new ReadOnlyTextPropertyEditor()
|
_ => new ReadOnlyTextPropertyEditor()
|
||||||
}
|
}
|
||||||
: type.IsSubclassOf(typeof(Enum))
|
: type.IsSubclassOf(typeof(Enum))
|
||||||
? (PropertyEditorBase) new EnumPropertyEditor()
|
? new EnumPropertyEditor()
|
||||||
: new ReadOnlyTextPropertyEditor();
|
: new ReadOnlyTextPropertyEditor();
|
||||||
|
|
||||||
public virtual PropertyEditorBase CreateEditor(Type type) => Activator.CreateInstance(type) as PropertyEditorBase ?? new ReadOnlyTextPropertyEditor();
|
public virtual PropertyEditorBase CreateEditor(Type type) => Activator.CreateInstance(type) as PropertyEditorBase ?? new ReadOnlyTextPropertyEditor();
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace HandyControl.Controls
|
|||||||
if (Role == SideMenuItemRole.Header && ItemsHost.Children.Count > 0)
|
if (Role == SideMenuItemRole.Header && ItemsHost.Children.Count > 0)
|
||||||
{
|
{
|
||||||
var item = ItemsHost.Children.OfType<SideMenuItem>().FirstOrDefault();
|
var item = ItemsHost.Children.OfType<SideMenuItem>().FirstOrDefault();
|
||||||
if (item != null && !item.IsSelected)
|
if (item is {IsSelected: false})
|
||||||
{
|
{
|
||||||
item.OnSelected(new RoutedEventArgs(SelectedEvent, item));
|
item.OnSelected(new RoutedEventArgs(SelectedEvent, item));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
layer.Remove(_adorner);
|
layer.Remove(_adorner);
|
||||||
}
|
}
|
||||||
else if (_adorner != null && _adorner.Parent is AdornerLayer parent)
|
else if (_adorner is {Parent: AdornerLayer parent})
|
||||||
{
|
{
|
||||||
parent.Remove(_adorner);
|
parent.Remove(_adorner);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
|
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (IsMoveToPointEnabled && _track.ThumbStart != null && !_track.ThumbStart.IsMouseOver && _track.ThumbEnd != null && !_track.ThumbEnd.IsMouseOver)
|
if (IsMoveToPointEnabled && _track.ThumbStart is {IsMouseOver: false} && _track.ThumbEnd is {IsMouseOver: false})
|
||||||
{
|
{
|
||||||
// Here we need to determine whether it's closer to the starting point or the end point.
|
// Here we need to determine whether it's closer to the starting point or the end point.
|
||||||
var pt = e.MouseDevice.GetPosition(_track);
|
var pt = e.MouseDevice.GetPosition(_track);
|
||||||
@@ -301,7 +301,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
// If ticks collection is available, use it.
|
// If ticks collection is available, use it.
|
||||||
// Note that ticks may be unsorted.
|
// Note that ticks may be unsorted.
|
||||||
if (Ticks != null && Ticks.Count > 0)
|
if (Ticks is {Count: > 0})
|
||||||
{
|
{
|
||||||
foreach (var tick in Ticks)
|
foreach (var tick in Ticks)
|
||||||
{
|
{
|
||||||
@@ -341,7 +341,7 @@ namespace HandyControl.Controls
|
|||||||
var previous = Minimum;
|
var previous = Minimum;
|
||||||
var next = Maximum;
|
var next = Maximum;
|
||||||
|
|
||||||
if (Ticks != null && Ticks.Count > 0)
|
if (Ticks is {Count: > 0})
|
||||||
{
|
{
|
||||||
foreach (var tick in Ticks)
|
foreach (var tick in Ticks)
|
||||||
{
|
{
|
||||||
@@ -429,7 +429,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
// Show AutoToolTip if needed.
|
// Show AutoToolTip if needed.
|
||||||
|
|
||||||
if (!(e.OriginalSource is RangeThumb thumb)) return;
|
if (e.OriginalSource is not RangeThumb thumb) return;
|
||||||
_thumbCurrent = thumb;
|
_thumbCurrent = thumb;
|
||||||
_originThumbPoint = Mouse.GetPosition(_thumbCurrent);
|
_originThumbPoint = Mouse.GetPosition(_thumbCurrent);
|
||||||
_thumbCurrent.StartDrag();
|
_thumbCurrent.StartDrag();
|
||||||
@@ -531,7 +531,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
protected virtual void OnThumbDragDelta(DragDeltaEventArgs e)
|
protected virtual void OnThumbDragDelta(DragDeltaEventArgs e)
|
||||||
{
|
{
|
||||||
if (!(e.OriginalSource is Thumb thumb)) return;
|
if (e.OriginalSource is not Thumb thumb) return;
|
||||||
var isStart = thumb.Equals(_track.ThumbStart);
|
var isStart = thumb.Equals(_track.ThumbStart);
|
||||||
if (!isStart)
|
if (!isStart)
|
||||||
{
|
{
|
||||||
@@ -579,7 +579,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
// Show AutoToolTip if needed.
|
// Show AutoToolTip if needed.
|
||||||
|
|
||||||
if (!(e.OriginalSource is Thumb thumb) || AutoToolTipPlacement == AutoToolTipPlacement.None)
|
if (e.OriginalSource is not Thumb thumb || AutoToolTipPlacement == AutoToolTipPlacement.None)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -397,10 +397,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if (oldValue != newValue)
|
if (oldValue != newValue)
|
||||||
{
|
{
|
||||||
if (_visualChildren == null)
|
_visualChildren ??= new Visual[5];
|
||||||
{
|
|
||||||
_visualChildren = new Visual[5];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oldValue != null)
|
if (oldValue != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
for (var i = 0; i < Items.Count; i++)
|
for (var i = 0; i < Items.Count; i++)
|
||||||
{
|
{
|
||||||
if (!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) return;
|
if (ItemContainerGenerator.ContainerFromIndex(i) is not TabItem item) return;
|
||||||
item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||||
item.TabPanel = HeaderPanel;
|
item.TabPanel = HeaderPanel;
|
||||||
}
|
}
|
||||||
@@ -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 not TabItem item) continue;
|
||||||
|
|
||||||
var menuItem = new MenuItem
|
var menuItem = new MenuItem
|
||||||
{
|
{
|
||||||
@@ -350,14 +350,10 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
list.Remove(actualItem);
|
list.Remove(actualItem);
|
||||||
list.Insert(0, actualItem);
|
list.Insert(0, actualItem);
|
||||||
if (IsAnimationEnabled)
|
HeaderPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey,
|
||||||
{
|
IsAnimationEnabled
|
||||||
HeaderPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, new Duration(TimeSpan.FromMilliseconds(200)));
|
? new Duration(TimeSpan.FromMilliseconds(200))
|
||||||
}
|
: new Duration(TimeSpan.FromMilliseconds(0)));
|
||||||
else
|
|
||||||
{
|
|
||||||
HeaderPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, new Duration(TimeSpan.FromMilliseconds(0)));
|
|
||||||
}
|
|
||||||
HeaderPanel.ForceUpdate = true;
|
HeaderPanel.ForceUpdate = true;
|
||||||
HeaderPanel.Measure(new Size(HeaderPanel.DesiredSize.Width, ActualHeight));
|
HeaderPanel.Measure(new Size(HeaderPanel.DesiredSize.Width, ActualHeight));
|
||||||
HeaderPanel.ForceUpdate = false;
|
HeaderPanel.ForceUpdate = false;
|
||||||
@@ -396,7 +392,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
var argsClosing = new CancelRoutedEventArgs(TabItem.ClosingEvent, item);
|
var argsClosing = new CancelRoutedEventArgs(TabItem.ClosingEvent, item);
|
||||||
|
|
||||||
if (!(ItemContainerGenerator.ContainerFromItem(item) is TabItem tabItem)) continue;
|
if (ItemContainerGenerator.ContainerFromItem(item) is not TabItem tabItem) continue;
|
||||||
|
|
||||||
tabItem.RaiseEvent(argsClosing);
|
tabItem.RaiseEvent(argsClosing);
|
||||||
if (argsClosing.Cancel) return;
|
if (argsClosing.Cancel) return;
|
||||||
|
|||||||
@@ -173,11 +173,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
if (_isHandlerSuspended == null)
|
_isHandlerSuspended ??= new Dictionary<DependencyProperty, bool>(2);
|
||||||
{
|
|
||||||
_isHandlerSuspended = new Dictionary<DependencyProperty, bool>(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
_isHandlerSuspended[property] = true;
|
_isHandlerSuspended[property] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ namespace HandyControl.Controls
|
|||||||
selector.ItemsSource = list;
|
selector.ItemsSource = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "MergeIntoPattern")]
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (_hourList.SelectedIndex >= 0 && _hourList.SelectedIndex < 24 &&
|
if (_hourList.SelectedIndex >= 0 && _hourList.SelectedIndex < 24 &&
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (d is TimeBar timeBar && timeBar._textBlockSelected != null)
|
if (d is TimeBar {_textBlockSelected: { }} timeBar)
|
||||||
{
|
{
|
||||||
timeBar.OnSelectedTimeChanged((DateTime) e.NewValue);
|
timeBar.OnSelectedTimeChanged((DateTime) e.NewValue);
|
||||||
}
|
}
|
||||||
@@ -403,25 +403,17 @@ namespace HandyControl.Controls
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private DateTime TimeConvert(DateTime time)
|
private DateTime TimeConvert(DateTime time)
|
||||||
{
|
{
|
||||||
switch (_speIndex)
|
return _speIndex switch
|
||||||
{
|
{
|
||||||
case 0:
|
0 => new DateTime(time.Year, time.Month, time.Day, time.Hour / 2 * 2, 0, 0),
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour / 2 * 2, 0, 0);
|
1 => new DateTime(time.Year, time.Month, time.Day, time.Hour, 0, 0),
|
||||||
case 1:
|
2 => new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute / 30 * 30, 0),
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour, 0, 0);
|
3 => new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute / 10 * 10, 0),
|
||||||
case 2:
|
4 => new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute / 5 * 5, 0),
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute / 30 * 30, 0);
|
5 => new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, 0),
|
||||||
case 3:
|
6 => new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, time.Second / 30 * 30),
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute / 10 * 10, 0);
|
_ => time
|
||||||
case 4:
|
};
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute / 5 * 5, 0);
|
|
||||||
case 5:
|
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, 0);
|
|
||||||
case 6:
|
|
||||||
return new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, time.Second / 30 * 30);
|
|
||||||
default:
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -628,6 +628,7 @@ namespace HandyControl.Controls
|
|||||||
|| value == MessageBoxButton.YesNoCancel;
|
|| value == MessageBoxButton.YesNoCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "ConditionIsAlwaysTrueOrFalse")]
|
||||||
private static bool IsValidMessageBoxImage(MessageBoxImage value)
|
private static bool IsValidMessageBoxImage(MessageBoxImage value)
|
||||||
{
|
{
|
||||||
return value == MessageBoxImage.Asterisk
|
return value == MessageBoxImage.Asterisk
|
||||||
|
|||||||
@@ -21,19 +21,13 @@ namespace HandyControl.Expression.Drawing
|
|||||||
arcSegment.Size.Height, arcSegment.RotationAngle, arcSegment.IsLargeArc,
|
arcSegment.Size.Height, arcSegment.RotationAngle, arcSegment.IsLargeArc,
|
||||||
arcSegment.SweepDirection == SweepDirection.Clockwise, arcSegment.Point.X, arcSegment.Point.Y,
|
arcSegment.SweepDirection == SweepDirection.Clockwise, arcSegment.Point.X, arcSegment.Point.Y,
|
||||||
out var pointArray, out var num);
|
out var pointArray, out var num);
|
||||||
switch (num)
|
return num switch
|
||||||
{
|
{
|
||||||
case -1:
|
-1 => null,
|
||||||
return null;
|
0 => CreateLineSegment(arcSegment.Point, isStroked),
|
||||||
|
1 => CreateBezierSegment(pointArray[0], pointArray[1], pointArray[2], isStroked),
|
||||||
case 0:
|
_ => CreatePolyBezierSegment(pointArray, 0, num * 3, isStroked)
|
||||||
return CreateLineSegment(arcSegment.Point, isStroked);
|
};
|
||||||
|
|
||||||
case 1:
|
|
||||||
return CreateBezierSegment(pointArray[0], pointArray[1], pointArray[2], isStroked);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreatePolyBezierSegment(pointArray, 0, num * 3, isStroked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArcSegment CreateArcSegment(Point point, Size size, bool isLargeArc, bool clockwise,
|
public static ArcSegment CreateArcSegment(Point point, Size size, bool isLargeArc, bool clockwise,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace HandyControl.Interactivity
|
|||||||
{
|
{
|
||||||
if (parameter is DependencyObject dependencyObject)
|
if (parameter is DependencyObject dependencyObject)
|
||||||
{
|
{
|
||||||
if (Window.GetWindow(dependencyObject) is Window window)
|
if (Window.GetWindow(dependencyObject) is { } window)
|
||||||
{
|
{
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ namespace HandyControl.Interactivity
|
|||||||
private static ResourceManager ResourceMan;
|
private static ResourceManager ResourceMan;
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||||
internal static ResourceManager ResourceManager => ResourceMan ?? (ResourceMan = new ResourceManager(nameof(ExceptionStringTable),
|
internal static ResourceManager ResourceManager => ResourceMan ??= new ResourceManager(nameof(ExceptionStringTable),
|
||||||
typeof(ExceptionStringTable).Assembly));
|
typeof(ExceptionStringTable).Assembly);
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||||
internal static CultureInfo Culture { get; set; }
|
internal static CultureInfo Culture { get; set; }
|
||||||
|
|||||||
@@ -490,44 +490,26 @@ namespace HandyControl.Interactivity
|
|||||||
var layoutSlot = LayoutInformation.GetLayoutSlot(element);
|
var layoutSlot = LayoutInformation.GetLayoutSlot(element);
|
||||||
var x = 0.0;
|
var x = 0.0;
|
||||||
var y = 0.0;
|
var y = 0.0;
|
||||||
switch (element.HorizontalAlignment)
|
x = element.HorizontalAlignment switch
|
||||||
{
|
{
|
||||||
case HorizontalAlignment.Left:
|
HorizontalAlignment.Left => layoutSlot.Left + margin.Left,
|
||||||
x = layoutSlot.Left + margin.Left;
|
HorizontalAlignment.Center => (layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 -
|
||||||
break;
|
actualWidth / 2.0,
|
||||||
|
HorizontalAlignment.Right => layoutSlot.Right - margin.Right - actualWidth,
|
||||||
case HorizontalAlignment.Center:
|
HorizontalAlignment.Stretch => Math.Max(layoutSlot.Left + margin.Left,
|
||||||
x = (layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - actualWidth / 2.0;
|
(layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - actualWidth / 2.0),
|
||||||
break;
|
_ => x
|
||||||
|
};
|
||||||
case HorizontalAlignment.Right:
|
y = element.VerticalAlignment switch
|
||||||
x = layoutSlot.Right - margin.Right - actualWidth;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HorizontalAlignment.Stretch:
|
|
||||||
x = Math.Max(layoutSlot.Left + margin.Left,
|
|
||||||
(layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - actualWidth / 2.0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (element.VerticalAlignment)
|
|
||||||
{
|
{
|
||||||
case VerticalAlignment.Top:
|
VerticalAlignment.Top => layoutSlot.Top + margin.Top,
|
||||||
y = layoutSlot.Top + margin.Top;
|
VerticalAlignment.Center => (layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 -
|
||||||
break;
|
actualHeight / 2.0,
|
||||||
|
VerticalAlignment.Bottom => layoutSlot.Bottom - margin.Bottom - actualHeight,
|
||||||
case VerticalAlignment.Center:
|
VerticalAlignment.Stretch => Math.Max(layoutSlot.Top + margin.Top,
|
||||||
y = (layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - actualHeight / 2.0;
|
(layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - actualHeight / 2.0),
|
||||||
break;
|
_ => y
|
||||||
|
};
|
||||||
case VerticalAlignment.Bottom:
|
|
||||||
y = layoutSlot.Bottom - margin.Bottom - actualHeight;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VerticalAlignment.Stretch:
|
|
||||||
y = Math.Max(layoutSlot.Top + margin.Top,
|
|
||||||
(layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - actualHeight / 2.0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new Rect(x, y, actualWidth, actualHeight);
|
return new Rect(x, y, actualWidth, actualHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,4 +234,7 @@
|
|||||||
<data name="All" xml:space="preserve">
|
<data name="All" xml:space="preserve">
|
||||||
<value>Wszystkie</value>
|
<value>Wszystkie</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="NoData" xml:space="preserve">
|
||||||
|
<value>No Data</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -96,7 +96,6 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|
||||||
<Style x:Key="GroupBoxOriginalBaseStyle" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
|
<Style x:Key="GroupBoxOriginalBaseStyle" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
|
||||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0"/>
|
<Setter Property="hc:BorderElement.CornerRadius" Value="0"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
<Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
|
<Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
|
||||||
<Setter Property="Padding" Value="10"/>
|
<Setter Property="Padding" Value="10"/>
|
||||||
<Setter Property="hc:BorderElement.CornerRadius" Value="2"/>
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ToolTip">
|
<ControlTemplate TargetType="ToolTip">
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" Grid.ColumnSpan="3" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Name="PART_BorderTitle">
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" Grid.ColumnSpan="3" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Name="PART_BorderTitle">
|
||||||
<TextBlock x:Name="PART_TimeStr" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="{DynamicResource TextIconBrush}"/>
|
<TextBlock x:Name="PART_TimeStr" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="{DynamicResource TextIconBrush}"/>
|
||||||
</Border>
|
</Border>
|
||||||
<Canvas Grid.Row="1" Grid.ColumnSpan="3" Margin="0,16,0,0" VerticalAlignment="Top" Name="PART_Canvas" Width="178" Height="178">
|
<Canvas Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,16,0,0" VerticalAlignment="Top" Name="PART_Canvas" Width="178" Height="178">
|
||||||
<Border Background="{DynamicResource SecondaryRegionBrush}" Width="178" Height="178" CornerRadius="89"/>
|
<Border Background="{DynamicResource SecondaryRegionBrush}" Width="178" Height="178" CornerRadius="89"/>
|
||||||
<hc:CirclePanel Diameter="130" x:Name="PART_PanelNum" KeepVertical="True" Margin="24,24,0,0" OffsetAngle="-60"/>
|
<hc:CirclePanel Diameter="130" x:Name="PART_PanelNum" KeepVertical="True" Margin="24,24,0,0" OffsetAngle="-60"/>
|
||||||
<Border Focusable="False" Name="PART_BorderClock" Background="{DynamicResource PrimaryBrush}" RenderTransformOrigin="0.5,1" Height="63" Width="2" Canvas.Left="88" Canvas.Top="26"/>
|
<Border Focusable="False" Name="PART_BorderClock" Background="{DynamicResource PrimaryBrush}" RenderTransformOrigin="0.5,1" Height="63" Width="2" Canvas.Left="88" Canvas.Top="26"/>
|
||||||
|
|||||||
@@ -2333,7 +2333,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
<Style x:Key="GroupBoxOriginalBaseStyle" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
|
<Style x:Key="GroupBoxOriginalBaseStyle" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
|
||||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
@@ -9696,7 +9695,6 @@
|
|||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
|
<Style x:Key="PropertyItemToolTipBaseStyle" BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
|
||||||
<Setter Property="Padding" Value="10" />
|
<Setter Property="Padding" Value="10" />
|
||||||
<Setter Property="hc:BorderElement.CornerRadius" Value="2" />
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ToolTip">
|
<ControlTemplate TargetType="ToolTip">
|
||||||
@@ -11475,7 +11473,7 @@
|
|||||||
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" Grid.ColumnSpan="3" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Name="PART_BorderTitle">
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" Grid.ColumnSpan="3" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Name="PART_BorderTitle">
|
||||||
<TextBlock x:Name="PART_TimeStr" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="{DynamicResource TextIconBrush}" />
|
<TextBlock x:Name="PART_TimeStr" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="{DynamicResource TextIconBrush}" />
|
||||||
</Border>
|
</Border>
|
||||||
<Canvas Grid.Row="1" Grid.ColumnSpan="3" Margin="0,16,0,0" VerticalAlignment="Top" Name="PART_Canvas" Width="178" Height="178">
|
<Canvas Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,16,0,0" VerticalAlignment="Top" Name="PART_Canvas" Width="178" Height="178">
|
||||||
<Border Background="{DynamicResource SecondaryRegionBrush}" Width="178" Height="178" CornerRadius="89" />
|
<Border Background="{DynamicResource SecondaryRegionBrush}" Width="178" Height="178" CornerRadius="89" />
|
||||||
<hc:CirclePanel Diameter="130" x:Name="PART_PanelNum" KeepVertical="True" Margin="24,24,0,0" OffsetAngle="-60" />
|
<hc:CirclePanel Diameter="130" x:Name="PART_PanelNum" KeepVertical="True" Margin="24,24,0,0" OffsetAngle="-60" />
|
||||||
<Border Focusable="False" Name="PART_BorderClock" Background="{DynamicResource PrimaryBrush}" RenderTransformOrigin="0.5,1" Height="63" Width="2" Canvas.Left="88" Canvas.Top="26" />
|
<Border Focusable="False" Name="PART_BorderClock" Background="{DynamicResource PrimaryBrush}" RenderTransformOrigin="0.5,1" Height="63" Width="2" Canvas.Left="88" Canvas.Top="26" />
|
||||||
|
|||||||
@@ -79,38 +79,26 @@ namespace HandyControl.Tools
|
|||||||
var layoutSlot = LayoutInformation.GetLayoutSlot(element);
|
var layoutSlot = LayoutInformation.GetLayoutSlot(element);
|
||||||
var x = 0.0;
|
var x = 0.0;
|
||||||
var y = 0.0;
|
var y = 0.0;
|
||||||
switch (element.HorizontalAlignment)
|
x = element.HorizontalAlignment switch
|
||||||
{
|
{
|
||||||
case HorizontalAlignment.Left:
|
HorizontalAlignment.Left => layoutSlot.Left + margin.Left,
|
||||||
x = layoutSlot.Left + margin.Left;
|
HorizontalAlignment.Center => (layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 -
|
||||||
break;
|
width / 2.0,
|
||||||
case HorizontalAlignment.Center:
|
HorizontalAlignment.Right => layoutSlot.Right - margin.Right - width,
|
||||||
x = (layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - width / 2.0;
|
HorizontalAlignment.Stretch => Math.Max(layoutSlot.Left + margin.Left,
|
||||||
break;
|
(layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - width / 2.0),
|
||||||
case HorizontalAlignment.Right:
|
_ => x
|
||||||
x = layoutSlot.Right - margin.Right - width;
|
};
|
||||||
break;
|
y = element.VerticalAlignment switch
|
||||||
case HorizontalAlignment.Stretch:
|
|
||||||
x = Math.Max(layoutSlot.Left + margin.Left,
|
|
||||||
(layoutSlot.Left + margin.Left + layoutSlot.Right - margin.Right) / 2.0 - width / 2.0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (element.VerticalAlignment)
|
|
||||||
{
|
{
|
||||||
case VerticalAlignment.Top:
|
VerticalAlignment.Top => layoutSlot.Top + margin.Top,
|
||||||
y = layoutSlot.Top + margin.Top;
|
VerticalAlignment.Center => (layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 -
|
||||||
break;
|
height / 2.0,
|
||||||
case VerticalAlignment.Center:
|
VerticalAlignment.Bottom => layoutSlot.Bottom - margin.Bottom - height,
|
||||||
y = (layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - height / 2.0;
|
VerticalAlignment.Stretch => Math.Max(layoutSlot.Top + margin.Top,
|
||||||
break;
|
(layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - height / 2.0),
|
||||||
case VerticalAlignment.Bottom:
|
_ => y
|
||||||
y = layoutSlot.Bottom - margin.Bottom - height;
|
};
|
||||||
break;
|
|
||||||
case VerticalAlignment.Stretch:
|
|
||||||
y = Math.Max(layoutSlot.Top + margin.Top,
|
|
||||||
(layoutSlot.Top + margin.Top + layoutSlot.Bottom - margin.Bottom) / 2.0 - height / 2.0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new Rect(x, y, width, height);
|
return new Rect(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -9,6 +10,8 @@ using HandyControl.Tools.Interop;
|
|||||||
|
|
||||||
namespace HandyControl.Tools
|
namespace HandyControl.Tools
|
||||||
{
|
{
|
||||||
|
[SuppressMessage("ReSharper", "ArrangeRedundantParentheses")]
|
||||||
|
[SuppressMessage("ReSharper", "IntVariableOverflowInUncheckedContext")]
|
||||||
internal static class IconHelper
|
internal static class IconHelper
|
||||||
{
|
{
|
||||||
private static Size SmallIconSize;
|
private static Size SmallIconSize;
|
||||||
|
|||||||
@@ -12,10 +12,7 @@ namespace HandyControl.Tools
|
|||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
internal static void DemandUIWindowPermission()
|
internal static void DemandUIWindowPermission()
|
||||||
{
|
{
|
||||||
if (_allWindowsUIPermission == null)
|
_allWindowsUIPermission ??= new UIPermission(UIPermissionWindow.AllWindows);
|
||||||
{
|
|
||||||
_allWindowsUIPermission = new UIPermission(UIPermissionWindow.AllWindows);
|
|
||||||
}
|
|
||||||
_allWindowsUIPermission.Demand();
|
_allWindowsUIPermission.Demand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace HandyControl.Tools.Interop
|
|||||||
internal static BitmapHandle CreateDIBSection(HandleRef hdc, ref InteropValues.BITMAPINFO bitmapInfo, int iUsage,
|
internal static BitmapHandle CreateDIBSection(HandleRef hdc, ref InteropValues.BITMAPINFO bitmapInfo, int iUsage,
|
||||||
ref IntPtr ppvBits, SafeFileMappingHandle hSection, int dwOffset)
|
ref IntPtr ppvBits, SafeFileMappingHandle hSection, int dwOffset)
|
||||||
{
|
{
|
||||||
if (hSection == null) hSection = new SafeFileMappingHandle(IntPtr.Zero);
|
hSection ??= new SafeFileMappingHandle(IntPtr.Zero);
|
||||||
|
|
||||||
var hBitmap = PrivateCreateDIBSection(hdc, ref bitmapInfo, iUsage, ref ppvBits, hSection, dwOffset);
|
var hBitmap = PrivateCreateDIBSection(hdc, ref bitmapInfo, iUsage, ref ppvBits, hSection, dwOffset);
|
||||||
return hBitmap;
|
return hBitmap;
|
||||||
@@ -547,7 +547,7 @@ namespace HandyControl.Tools.Interop
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
private struct StartupOutput
|
private readonly struct StartupOutput
|
||||||
{
|
{
|
||||||
private readonly IntPtr hook;
|
private readonly IntPtr hook;
|
||||||
|
|
||||||
@@ -613,31 +613,30 @@ namespace HandyControl.Tools.Interop
|
|||||||
|
|
||||||
internal static Exception StatusException(int status)
|
internal static Exception StatusException(int status)
|
||||||
{
|
{
|
||||||
switch (status)
|
return status switch
|
||||||
{
|
{
|
||||||
case GenericError: return new ExternalException("GdiplusGenericError");
|
GenericError => new ExternalException("GdiplusGenericError"),
|
||||||
case InvalidParameter: return new ArgumentException("GdiplusInvalidParameter");
|
InvalidParameter => new ArgumentException("GdiplusInvalidParameter"),
|
||||||
case OutOfMemory: return new OutOfMemoryException("GdiplusOutOfMemory");
|
OutOfMemory => new OutOfMemoryException("GdiplusOutOfMemory"),
|
||||||
case ObjectBusy: return new InvalidOperationException("GdiplusObjectBusy");
|
ObjectBusy => new InvalidOperationException("GdiplusObjectBusy"),
|
||||||
case InsufficientBuffer: return new OutOfMemoryException("GdiplusInsufficientBuffer");
|
InsufficientBuffer => new OutOfMemoryException("GdiplusInsufficientBuffer"),
|
||||||
case NotImplemented: return new NotImplementedException("GdiplusNotImplemented");
|
NotImplemented => new NotImplementedException("GdiplusNotImplemented"),
|
||||||
case Win32Error: return new ExternalException("GdiplusGenericError");
|
Win32Error => new ExternalException("GdiplusGenericError"),
|
||||||
case WrongState: return new InvalidOperationException("GdiplusWrongState");
|
WrongState => new InvalidOperationException("GdiplusWrongState"),
|
||||||
case Aborted: return new ExternalException("GdiplusAborted");
|
Aborted => new ExternalException("GdiplusAborted"),
|
||||||
case FileNotFound: return new FileNotFoundException("GdiplusFileNotFound");
|
FileNotFound => new FileNotFoundException("GdiplusFileNotFound"),
|
||||||
case ValueOverflow: return new OverflowException("GdiplusOverflow");
|
ValueOverflow => new OverflowException("GdiplusOverflow"),
|
||||||
case AccessDenied: return new ExternalException("GdiplusAccessDenied");
|
AccessDenied => new ExternalException("GdiplusAccessDenied"),
|
||||||
case UnknownImageFormat: return new ArgumentException("GdiplusUnknownImageFormat");
|
UnknownImageFormat => new ArgumentException("GdiplusUnknownImageFormat"),
|
||||||
case PropertyNotFound: return new ArgumentException("GdiplusPropertyNotFoundError");
|
PropertyNotFound => new ArgumentException("GdiplusPropertyNotFoundError"),
|
||||||
case PropertyNotSupported: return new ArgumentException("GdiplusPropertyNotSupportedError");
|
PropertyNotSupported => new ArgumentException("GdiplusPropertyNotSupportedError"),
|
||||||
case FontFamilyNotFound: return new ArgumentException("GdiplusFontFamilyNotFound");
|
FontFamilyNotFound => new ArgumentException("GdiplusFontFamilyNotFound"),
|
||||||
case FontStyleNotFound: return new ArgumentException("GdiplusFontStyleNotFound");
|
FontStyleNotFound => new ArgumentException("GdiplusFontStyleNotFound"),
|
||||||
case NotTrueTypeFont: return new ArgumentException("GdiplusNotTrueTypeFont_NoName");
|
NotTrueTypeFont => new ArgumentException("GdiplusNotTrueTypeFont_NoName"),
|
||||||
case UnsupportedGdiplusVersion: return new ExternalException("GdiplusUnsupportedGdiplusVersion");
|
UnsupportedGdiplusVersion => new ExternalException("GdiplusUnsupportedGdiplusVersion"),
|
||||||
case GdiplusNotInitialized: return new ExternalException("GdiplusNotInitialized");
|
GdiplusNotInitialized => new ExternalException("GdiplusNotInitialized"),
|
||||||
}
|
_ => new ExternalException("GdiplusUnknown")
|
||||||
|
};
|
||||||
return new ExternalException("GdiplusUnknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(InteropValues.ExternDll.GdiPlus, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
[DllImport(InteropValues.ExternDll.GdiPlus, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
||||||
|
|||||||
@@ -53,15 +53,15 @@ namespace HandyControl.Tools
|
|||||||
/// <returns>方法返回布尔值</returns>
|
/// <returns>方法返回布尔值</returns>
|
||||||
public static bool IsIp(this string ip, IpType ipType)
|
public static bool IsIp(this string ip, IpType ipType)
|
||||||
{
|
{
|
||||||
switch (ipType)
|
return ipType switch
|
||||||
{
|
{
|
||||||
case IpType.A: return Regex.IsMatch(ip, RegexPatterns.IpAPattern);
|
IpType.A => Regex.IsMatch(ip, RegexPatterns.IpAPattern),
|
||||||
case IpType.B: return Regex.IsMatch(ip, RegexPatterns.IpBPattern);
|
IpType.B => Regex.IsMatch(ip, RegexPatterns.IpBPattern),
|
||||||
case IpType.C: return Regex.IsMatch(ip, RegexPatterns.IpCPattern);
|
IpType.C => Regex.IsMatch(ip, RegexPatterns.IpCPattern),
|
||||||
case IpType.D: return Regex.IsMatch(ip, RegexPatterns.IpDPattern);
|
IpType.D => Regex.IsMatch(ip, RegexPatterns.IpDPattern),
|
||||||
case IpType.E: return Regex.IsMatch(ip, RegexPatterns.IpEPattern);
|
IpType.E => Regex.IsMatch(ip, RegexPatterns.IpEPattern),
|
||||||
default: return false;
|
_ => false
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -400,27 +400,15 @@ namespace Microsoft.Windows.Shell
|
|||||||
TBPF tbpFlags = TBPF.NOPROGRESS;
|
TBPF tbpFlags = TBPF.NOPROGRESS;
|
||||||
if (attached)
|
if (attached)
|
||||||
{
|
{
|
||||||
switch (progressState)
|
tbpFlags = progressState switch
|
||||||
{
|
{
|
||||||
case TaskbarItemProgressState.None:
|
TaskbarItemProgressState.None => TBPF.NOPROGRESS,
|
||||||
tbpFlags = TBPF.NOPROGRESS;
|
TaskbarItemProgressState.Indeterminate => TBPF.INDETERMINATE,
|
||||||
break;
|
TaskbarItemProgressState.Normal => TBPF.NORMAL,
|
||||||
case TaskbarItemProgressState.Indeterminate:
|
TaskbarItemProgressState.Error => TBPF.ERROR,
|
||||||
tbpFlags = TBPF.INDETERMINATE;
|
TaskbarItemProgressState.Paused => TBPF.PAUSED,
|
||||||
break;
|
_ => TBPF.NOPROGRESS
|
||||||
case TaskbarItemProgressState.Normal:
|
};
|
||||||
tbpFlags = TBPF.NORMAL;
|
|
||||||
break;
|
|
||||||
case TaskbarItemProgressState.Error:
|
|
||||||
tbpFlags = TBPF.ERROR;
|
|
||||||
break;
|
|
||||||
case TaskbarItemProgressState.Paused:
|
|
||||||
tbpFlags = TBPF.PAUSED;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tbpFlags = TBPF.NOPROGRESS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
HRESULT result = this._taskbarList.SetProgressState(this._hwndSource.Handle, tbpFlags);
|
HRESULT result = this._taskbarList.SetProgressState(this._hwndSource.Handle, tbpFlags);
|
||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
|
|||||||
@@ -433,15 +433,12 @@ namespace Microsoft.Windows.Shell
|
|||||||
private WindowState _GetHwndState()
|
private WindowState _GetHwndState()
|
||||||
{
|
{
|
||||||
WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd);
|
WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd);
|
||||||
switch (windowPlacement.showCmd)
|
return windowPlacement.showCmd switch
|
||||||
{
|
{
|
||||||
case SW.SHOWMINIMIZED:
|
SW.SHOWMINIMIZED => WindowState.Minimized,
|
||||||
return WindowState.Minimized;
|
SW.SHOWMAXIMIZED => WindowState.Maximized,
|
||||||
case SW.SHOWMAXIMIZED:
|
_ => WindowState.Normal
|
||||||
return WindowState.Maximized;
|
};
|
||||||
default:
|
|
||||||
return WindowState.Normal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Rect _GetWindowRect()
|
private Rect _GetWindowRect()
|
||||||
|
|||||||
Reference in new issue
Block a user