Automated dotnet-format update
This commit is contained in:
1 parent
ad4c2f68aa
commit
2af18c2d38
403 files changed
+1569
-1567
No files matched your search
@@ -24,4 +24,4 @@ namespace HandyControl.Tools.Converter
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,4 +29,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value != null && (bool)value ? Visibility.Collapsed : Visibility.Visible;
|
||||
return value != null && (bool) value ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
@@ -17,4 +17,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace HandyControl.Tools.Converter
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
var arr = new List<bool>();
|
||||
foreach (var item in values)
|
||||
{
|
||||
@@ -36,4 +36,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,4 +33,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace HandyControl.Tools.Converter
|
||||
}
|
||||
|
||||
var min = Math.Min(width, height);
|
||||
return new CornerRadius(min/2);
|
||||
return new CornerRadius(min / 2);
|
||||
}
|
||||
|
||||
return DependencyProperty.UnsetValue;
|
||||
@@ -28,4 +28,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,9 +108,9 @@ namespace HandyControl.Tools.Converter
|
||||
return i switch
|
||||
{
|
||||
1 => new ColLayout(lengths[0]),
|
||||
2 => new ColLayout {Xs = lengths[0], Sm = lengths[1]},
|
||||
3 => new ColLayout {Xs = lengths[0], Sm = lengths[1], Md = lengths[2]},
|
||||
4 => new ColLayout {Xs = lengths[0], Sm = lengths[1], Md = lengths[2], Lg = lengths[3]},
|
||||
2 => new ColLayout { Xs = lengths[0], Sm = lengths[1] },
|
||||
3 => new ColLayout { Xs = lengths[0], Sm = lengths[1], Md = lengths[2] },
|
||||
4 => new ColLayout { Xs = lengths[0], Sm = lengths[1], Md = lengths[2], Lg = lengths[3] },
|
||||
5 => new ColLayout
|
||||
{
|
||||
Xs = lengths[0],
|
||||
@@ -132,4 +132,4 @@ namespace HandyControl.Tools.Converter
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,4 +36,4 @@ namespace HandyControl.Tools.Converter
|
||||
return parameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,4 @@ namespace HandyControl.Tools.Converter
|
||||
return new SolidColorBrush(default);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,4 +49,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.IsNullOrEmpty((string)value) ? Visibility.Collapsed : Visibility.Visible;
|
||||
return string.IsNullOrEmpty((string) value) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value != null && (Visibility)value == Visibility.Collapsed;
|
||||
return value != null && (Visibility) value == Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.IsNullOrEmpty((string)value) ? Visibility.Visible : Visibility.Collapsed;
|
||||
return string.IsNullOrEmpty((string) value) ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value != null && (Visibility)value == Visibility.Collapsed;
|
||||
return value != null && (Visibility) value == Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Windows.Media;
|
||||
|
||||
namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public class TreeViewItemMarginConverter: IValueConverter
|
||||
public class TreeViewItemMarginConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
@@ -14,7 +14,7 @@ namespace HandyControl.Tools.Converter
|
||||
UIElement element = value as TreeViewItem;
|
||||
while (element != null && element.GetType() != typeof(TreeView))
|
||||
{
|
||||
element = (UIElement)VisualTreeHelper.GetParent(element);
|
||||
element = (UIElement) VisualTreeHelper.GetParent(element);
|
||||
if (element is TreeViewItem)
|
||||
left += 19.0;
|
||||
}
|
||||
@@ -25,4 +25,4 @@ namespace HandyControl.Tools.Converter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace HandyControl.Tools.Extension
|
||||
|
||||
public ColLayout()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ColLayout(int uniformWidth)
|
||||
@@ -124,4 +124,4 @@ namespace HandyControl.Tools.Extension
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ namespace HandyControl.Tools.Extension
|
||||
color.B
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,4 @@ namespace HandyControl.Tools.Extension
|
||||
return enumerable;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,4 +55,4 @@ namespace HandyControl.Tools.Extension
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,4 @@ namespace HandyControl.Tools.Extension
|
||||
return length / strokeThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace HandyControl.Tools.Extension
|
||||
=> element.SetValue(TargetPropertyProperty, value);
|
||||
|
||||
private static DependencyProperty GetTargetProperty(DependencyObject element)
|
||||
=> (DependencyProperty)element.GetValue(TargetPropertyProperty);
|
||||
=> (DependencyProperty) element.GetValue(TargetPropertyProperty);
|
||||
|
||||
public BindingMode Mode { get; set; }
|
||||
|
||||
@@ -148,4 +148,4 @@ namespace HandyControl.Tools.Extension
|
||||
Mode = BindingMode.OneWay
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace HandyControl.Tools.Extension
|
||||
{
|
||||
try
|
||||
{
|
||||
return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(input);
|
||||
return (T) TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(input);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -29,4 +29,4 @@ namespace HandyControl.Tools.Extension
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ namespace HandyControl.Tools.Extension
|
||||
/// <param name="element"></param>
|
||||
public static void Collapse(this UIElement element) => element.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,4 @@ namespace HandyControl.Tools.Extension
|
||||
|
||||
public static bool IsNaN(this double value) => double.IsNaN(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
if (comparerType == ComparerTypeCode.DateTimeRange)
|
||||
{
|
||||
return (IComparer<T>)new DateTimeRangeComparer();
|
||||
return (IComparer<T>) new DateTimeRangeComparer();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace HandyControl.Tools
|
||||
|
||||
private Brush GetRenderBrush(string hashcode)
|
||||
{
|
||||
var v = (double)int.Parse(hashcode.Substring(hashcode.Length - 7), NumberStyles.HexNumber);
|
||||
var v = (double) int.Parse(hashcode.Substring(hashcode.Length - 7), NumberStyles.HexNumber);
|
||||
var scale = v / 0xfffffff;
|
||||
var color = Hsl2Rgb(scale);
|
||||
return new SolidColorBrush(color);
|
||||
@@ -116,4 +116,4 @@ namespace HandyControl.Tools
|
||||
(byte) (arr[(hValue | 8) % 6] * 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,6 @@ namespace HandyControl.Tools
|
||||
private byte[] GetHatchData(HatchStyle hatchStyle) =>
|
||||
hatchStyle < HatchStyle.Horizontal || hatchStyle > HatchStyle.SolidDiamond
|
||||
? throw new ArgumentOutOfRangeException(nameof(hatchStyle))
|
||||
: HatchBrushes[(int)hatchStyle];
|
||||
: HatchBrushes[(int) hatchStyle];
|
||||
}
|
||||
}
|
||||
@@ -272,4 +272,4 @@ namespace HandyControl.Tools
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace HandyControl.Tools
|
||||
if (list == null) return;
|
||||
KeyBindingCollection = new ObservableCollection<KeyBinding>(list);
|
||||
if (KeyBindingCollection.Count == 0) return;
|
||||
|
||||
|
||||
AddKeyBindings(KeyBindingCollection);
|
||||
KeyboardHook.Start();
|
||||
}
|
||||
@@ -118,4 +118,4 @@ namespace HandyControl.Tools
|
||||
public static ObservableCollection<KeyBinding> GetKeyBindings(DependencyObject element)
|
||||
=> (ObservableCollection<KeyBinding>) element.GetValue(KeyBindingsProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,4 +91,4 @@ namespace HandyControl.Tools
|
||||
return accumulated;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,4 +136,4 @@ namespace HandyControl.Tools
|
||||
return Vector3D.CrossProduct(v0, v1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,4 @@ namespace HandyControl.Tools
|
||||
return Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace HandyControl.Tools
|
||||
|
||||
}
|
||||
|
||||
public static ConfigHelper Instance = new Lazy<ConfigHelper>(() => new ConfigHelper()).Value;
|
||||
public static ConfigHelper Instance = new Lazy<ConfigHelper>(() => new ConfigHelper()).Value;
|
||||
|
||||
private XmlLanguage _lang = XmlLanguage.GetLanguage("zh-cn");
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace HandyControl.Tools
|
||||
SetTimelineFrameRate(config.TimelineFrameRate);
|
||||
}
|
||||
|
||||
public void SetTimelineFrameRate(int rate) =>
|
||||
public void SetTimelineFrameRate(int rate) =>
|
||||
Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata(rate));
|
||||
|
||||
public void SetWindowDefaultStyle(object resourceKey = null)
|
||||
@@ -82,7 +82,7 @@ namespace HandyControl.Tools
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,10 @@ namespace HandyControl.Tools
|
||||
{
|
||||
if (!_isInDesignMode.HasValue)
|
||||
{
|
||||
_isInDesignMode = (bool)DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)).Metadata.DefaultValue;
|
||||
_isInDesignMode = (bool) DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)).Metadata.DefaultValue;
|
||||
}
|
||||
return _isInDesignMode.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
private const double LogicalDpi = 96.0;
|
||||
|
||||
[ThreadStatic]
|
||||
[ThreadStatic]
|
||||
private static Matrix _transformToDip;
|
||||
|
||||
static DpiHelper()
|
||||
@@ -101,4 +101,4 @@ namespace HandyControl.Tools
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
bf = GetBestMatch(bf.Decoder.Frames, size);
|
||||
|
||||
asGoodAsItGets = bf.Decoder is IconBitmapDecoder || bf.PixelWidth == (int)size.Width && bf.PixelHeight == (int)size.Height;
|
||||
asGoodAsItGets = bf.Decoder is IconBitmapDecoder || bf.PixelWidth == (int) size.Width && bf.PixelHeight == (int) size.Height;
|
||||
|
||||
image = bf;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ namespace HandyControl.Tools
|
||||
var hPos = i % width;
|
||||
var vPos = i / width;
|
||||
var byteIndex = hPos / 8;
|
||||
var offsetBit = (byte)(0x80 >> (hPos % 8));
|
||||
var offsetBit = (byte) (0x80 >> (hPos % 8));
|
||||
|
||||
if (colorArray[i * 4 + 3] == 0x00)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ namespace HandyControl.Tools
|
||||
}
|
||||
else
|
||||
{
|
||||
bitsMask[byteIndex + bytesPerScanLine * vPos] &= (byte)~offsetBit;
|
||||
bitsMask[byteIndex + bytesPerScanLine * vPos] &= (byte) ~offsetBit;
|
||||
}
|
||||
|
||||
if (hPos == width - 1 && width == 8)
|
||||
@@ -153,7 +153,7 @@ namespace HandyControl.Tools
|
||||
internal static int AlignToBytes(double original, int nBytesCount)
|
||||
{
|
||||
var nBitsCount = 8 << (nBytesCount - 1);
|
||||
return ((int)Math.Ceiling(original) + (nBitsCount - 1)) / nBitsCount * nBitsCount;
|
||||
return ((int) Math.Ceiling(original) + (nBitsCount - 1)) / nBitsCount * nBitsCount;
|
||||
}
|
||||
|
||||
private static BitmapSource GenerateBitmapSource(ImageSource img, Size renderSize)
|
||||
@@ -183,7 +183,7 @@ namespace HandyControl.Tools
|
||||
dc.DrawImage(img, drawingDimensions);
|
||||
dc.Close();
|
||||
|
||||
var bmp = new RenderTargetBitmap((int)renderSize.Width, (int)renderSize.Height, 96, 96, PixelFormats.Pbgra32);
|
||||
var bmp = new RenderTargetBitmap((int) renderSize.Width, (int) renderSize.Height, 96, 96, PixelFormats.Pbgra32);
|
||||
bmp.Render(dv);
|
||||
|
||||
return bmp;
|
||||
@@ -229,8 +229,8 @@ namespace HandyControl.Tools
|
||||
private static int MatchImage(BitmapFrame frame, Size size, int bpp)
|
||||
{
|
||||
var score = 2 * MyAbs(bpp, SystemBitDepth, false) +
|
||||
MyAbs(frame.PixelWidth, (int)size.Width, true) +
|
||||
MyAbs(frame.PixelHeight, (int)size.Height, true);
|
||||
MyAbs(frame.PixelWidth, (int) size.Width, true) +
|
||||
MyAbs(frame.PixelHeight, (int) size.Height, true);
|
||||
|
||||
return score;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
var sysBitDepth = InteropMethods.GetDeviceCaps(hdcDesktop, InteropValues.BITSPIXEL);
|
||||
sysBitDepth *= InteropMethods.GetDeviceCaps(hdcDesktop, InteropValues.PLANES);
|
||||
|
||||
|
||||
if (sysBitDepth == 8)
|
||||
{
|
||||
sysBitDepth = 4;
|
||||
@@ -291,4 +291,4 @@ namespace HandyControl.Tools
|
||||
InteropMethods.ExtractIconEx(iconModuleFile, 0, out largeIconHandle, out smallIconHandle, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace HandyControl.Tools
|
||||
|
||||
private static void SetInputInfo(DependencyObject element, InputInfo value) => element.SetValue(InputInfoProperty, value);
|
||||
|
||||
private static InputInfo GetInputInfo(DependencyObject element) => (InputInfo)element.GetValue(InputInfoProperty);
|
||||
private static InputInfo GetInputInfo(DependencyObject element) => (InputInfo) element.GetValue(InputInfoProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 将 MouseDown MouseMove MouseUp 封装为点击事件
|
||||
@@ -67,25 +67,25 @@ namespace HandyControl.Tools
|
||||
|
||||
private static void Element_LostMouseCapture(object sender, MouseEventArgs e)
|
||||
{
|
||||
var element = (UIElement)sender;
|
||||
var element = (UIElement) sender;
|
||||
GetInputInfo(element)?.LostCapture();
|
||||
}
|
||||
|
||||
private static void Element_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var element = (UIElement)sender;
|
||||
var element = (UIElement) sender;
|
||||
GetInputInfo(element)?.Up(e.GetPosition(element));
|
||||
}
|
||||
|
||||
private static void Element_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var element = (UIElement)sender;
|
||||
var element = (UIElement) sender;
|
||||
GetInputInfo(element)?.Move(e.GetPosition(element));
|
||||
}
|
||||
|
||||
private static void Element_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var element = (UIElement)sender;
|
||||
var element = (UIElement) sender;
|
||||
GetInputInfo(element)?.Down(e.GetPosition(element));
|
||||
}
|
||||
|
||||
@@ -146,4 +146,4 @@ namespace HandyControl.Tools
|
||||
public bool IsEmpty() => ClickEventHandler is null && DragStarted is null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
Source = new Uri($"pack://application:,,,/{assembly.GetName().Name};component/{themePath}/Skin{SkinType.Default.ToString()}.xaml")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Theme GetTheme(string name, ResourceDictionary resourceDictionary)
|
||||
@@ -94,4 +94,4 @@ namespace HandyControl.Tools
|
||||
.FirstOrDefault(item => Equals(item.Name, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace HandyControl.Tools
|
||||
{
|
||||
var rects = new List<InteropValues.RECT>();
|
||||
InteropMethods.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,
|
||||
delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref InteropValues.RECT rect, IntPtr lpData)
|
||||
delegate (IntPtr hMonitor, IntPtr hdcMonitor, ref InteropValues.RECT rect, IntPtr lpData)
|
||||
{
|
||||
var monitorInfo = default(InteropValues.MONITORINFO);
|
||||
monitorInfo.cbSize = (uint) Marshal.SizeOf(typeof(InteropValues.MONITORINFO));
|
||||
@@ -28,9 +28,9 @@ namespace HandyControl.Tools
|
||||
rects.Add(monitorInfo.rcWork);
|
||||
return true;
|
||||
}, IntPtr.Zero);
|
||||
|
||||
|
||||
var num = 0L;
|
||||
|
||||
|
||||
screenSubRect = new InteropValues.RECT
|
||||
{
|
||||
Left = 0,
|
||||
@@ -38,7 +38,7 @@ namespace HandyControl.Tools
|
||||
Top = 0,
|
||||
Bottom = 0
|
||||
};
|
||||
|
||||
|
||||
monitorRect = new InteropValues.RECT
|
||||
{
|
||||
Left = 0,
|
||||
@@ -46,7 +46,7 @@ namespace HandyControl.Tools
|
||||
Top = 0,
|
||||
Bottom = 0
|
||||
};
|
||||
|
||||
|
||||
foreach (var current in rects)
|
||||
{
|
||||
var rect = current;
|
||||
@@ -68,10 +68,10 @@ namespace HandyControl.Tools
|
||||
X = (int) point.X,
|
||||
Y = (int) point.Y
|
||||
}, 2);
|
||||
|
||||
|
||||
monitorRect = new Rect(0.0, 0.0, 0.0, 0.0);
|
||||
workAreaRect = new Rect(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
|
||||
if (intPtr != IntPtr.Zero)
|
||||
{
|
||||
InteropValues.MONITORINFO monitorInfo = default;
|
||||
@@ -82,4 +82,4 @@ namespace HandyControl.Tools
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,4 @@ namespace HandyControl.Tools
|
||||
_allWindowsUIPermission.Demand();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,4 @@ namespace HandyControl.Tools
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,4 +230,4 @@ namespace HandyControl.Tools
|
||||
return numericSeparator;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
var v = (double) value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
var v = (double) value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v > 0;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDoubleIncludeZero(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
var v = (double) value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v >= 0;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
var v = (double) value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v < 0;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDoubleIncludeZero(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
var v = (double) value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && v <= 0;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosInt(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
var v = (int) value;
|
||||
return v > 0;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosIntIncludeZero(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
var v = (int) value;
|
||||
return v >= 0;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegInt(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
var v = (int) value;
|
||||
return v < 0;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegIntIncludeZero(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
var v = (int) value;
|
||||
return v <= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,4 +74,4 @@ namespace HandyControl.Tools
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace HandyControl.Tools
|
||||
/// <returns></returns>
|
||||
public static Window GetActiveWindow() => Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||
|
||||
private static readonly BitArray _cacheValid = new BitArray((int)InteropValues.CacheSlot.NumSlots);
|
||||
private static readonly BitArray _cacheValid = new BitArray((int) InteropValues.CacheSlot.NumSlots);
|
||||
|
||||
private static bool _setDpiX = true;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace HandyControl.Tools
|
||||
try
|
||||
{
|
||||
_dpiX = InteropMethods.GetDeviceCaps(new HandleRef(null, dc), InteropValues.LOGPIXELSX);
|
||||
_cacheValid[(int)InteropValues.CacheSlot.DpiX] = true;
|
||||
_cacheValid[(int) InteropValues.CacheSlot.DpiX] = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -113,9 +113,9 @@ namespace HandyControl.Tools
|
||||
{
|
||||
lock (_cacheValid)
|
||||
{
|
||||
while (!_cacheValid[(int)InteropValues.CacheSlot.WindowResizeBorderThickness])
|
||||
while (!_cacheValid[(int) InteropValues.CacheSlot.WindowResizeBorderThickness])
|
||||
{
|
||||
_cacheValid[(int)InteropValues.CacheSlot.WindowResizeBorderThickness] = true;
|
||||
_cacheValid[(int) InteropValues.CacheSlot.WindowResizeBorderThickness] = true;
|
||||
|
||||
var frameSize = new Size(InteropMethods.GetSystemMetrics(InteropValues.SM.CXSIZEFRAME), InteropMethods.GetSystemMetrics(InteropValues.SM.CYSIZEFRAME));
|
||||
var frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize, DpiX / 96.0, Dpi / 96.0);
|
||||
@@ -142,7 +142,7 @@ namespace HandyControl.Tools
|
||||
InteropMethods.ReleaseDC(IntPtr.Zero, hdc);
|
||||
return WindowResizeBorderThickness.Add(new Thickness((autoHide ? - 4 : 4) * scale));
|
||||
#else
|
||||
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? - 4 : 4));
|
||||
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -4 : 4));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace HandyControl.Tools
|
||||
|
||||
private static int VirtualKey;
|
||||
|
||||
private static readonly IntPtr KeyDownIntPtr = (IntPtr)InteropValues.WM_KEYDOWN;
|
||||
private static readonly IntPtr KeyDownIntPtr = (IntPtr) InteropValues.WM_KEYDOWN;
|
||||
|
||||
private static readonly IntPtr KeyUpIntPtr = (IntPtr)InteropValues.WM_KEYUP;
|
||||
private static readonly IntPtr KeyUpIntPtr = (IntPtr) InteropValues.WM_KEYUP;
|
||||
|
||||
private static readonly IntPtr SyskeyDownIntPtr = (IntPtr)InteropValues.WM_SYSKEYDOWN;
|
||||
private static readonly IntPtr SyskeyDownIntPtr = (IntPtr) InteropValues.WM_SYSKEYDOWN;
|
||||
|
||||
private static readonly IntPtr SyskeyUpIntPtr = (IntPtr)InteropValues.WM_SYSKEYUP;
|
||||
private static readonly IntPtr SyskeyUpIntPtr = (IntPtr) InteropValues.WM_SYSKEYUP;
|
||||
|
||||
private static int Count;
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace HandyControl.Tools
|
||||
{
|
||||
using var curProcess = Process.GetCurrentProcess();
|
||||
using var curModule = curProcess.MainModule;
|
||||
|
||||
|
||||
if (curModule != null)
|
||||
{
|
||||
return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_KEYBOARD_LL, proc,
|
||||
return InteropMethods.SetWindowsHookEx((int) InteropValues.HookType.WH_KEYBOARD_LL, proc,
|
||||
InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
@@ -102,4 +102,4 @@ namespace HandyControl.Tools
|
||||
return InteropMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,10 +43,10 @@ namespace HandyControl.Tools
|
||||
{
|
||||
using var curProcess = Process.GetCurrentProcess();
|
||||
using var curModule = curProcess.MainModule;
|
||||
|
||||
|
||||
if (curModule != null)
|
||||
{
|
||||
return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_MOUSE_LL, proc,
|
||||
return InteropMethods.SetWindowsHookEx((int) InteropValues.HookType.WH_MOUSE_LL, proc,
|
||||
InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
@@ -55,10 +55,10 @@ namespace HandyControl.Tools
|
||||
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
if (nCode < 0) return InteropMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
|
||||
var hookStruct = (InteropValues.MOUSEHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(InteropValues.MOUSEHOOKSTRUCT));
|
||||
var hookStruct = (InteropValues.MOUSEHOOKSTRUCT) Marshal.PtrToStructure(lParam, typeof(InteropValues.MOUSEHOOKSTRUCT));
|
||||
StatusChanged?.Invoke(null, new MouseHookEventArgs
|
||||
{
|
||||
MessageType = (MouseHookMessageType)wParam,
|
||||
MessageType = (MouseHookMessageType) wParam,
|
||||
Point = new InteropValues.POINT(hookStruct.pt.X, hookStruct.pt.Y)
|
||||
});
|
||||
|
||||
|
||||
@@ -42,4 +42,4 @@ namespace HandyControl.Tools.Interop
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,4 @@ namespace HandyControl.Tools.Interop
|
||||
|
||||
public static readonly int Kernel = HandleCollector.RegisterType(nameof(Kernel), 0, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace HandyControl.Tools.Interop
|
||||
}
|
||||
|
||||
var oldThreshHold = 100 * _threshHold / (100 + _deltaPercent);
|
||||
if (oldThreshHold >= _initialThreshHold && _handleCount < (int)(oldThreshHold * .9F))
|
||||
if (oldThreshHold >= _initialThreshHold && _handleCount < (int) (oldThreshHold * .9F))
|
||||
{
|
||||
_threshHold = oldThreshHold;
|
||||
}
|
||||
@@ -129,4 +129,4 @@ namespace HandyControl.Tools.Interop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ namespace HandyControl.Tools.Interop
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,9 @@ namespace HandyControl.Tools.Interop
|
||||
[SecurityCritical]
|
||||
public static bool CloseHandleNoThrow(HandleRef handle)
|
||||
{
|
||||
HandleCollector.Remove((IntPtr)handle, CommonHandles.Kernel);
|
||||
HandleCollector.Remove((IntPtr) handle, CommonHandles.Kernel);
|
||||
var result = InteropMethods.IntCloseHandle(handle);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@ namespace HandyControl.Tools.Interop
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace HandyControl.Tools.Interop
|
||||
{
|
||||
#region common
|
||||
|
||||
internal const int E_FAIL = unchecked((int)0x80004005);
|
||||
internal const int E_FAIL = unchecked((int) 0x80004005);
|
||||
|
||||
internal static readonly IntPtr HRGN_NONE = new IntPtr(-1);
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace HandyControl.Tools.Interop
|
||||
[SecurityCritical]
|
||||
internal static int ReleaseDC(HandleRef hWnd, HandleRef hDC)
|
||||
{
|
||||
HandleCollector.Remove((IntPtr)hDC, CommonHandles.HDC);
|
||||
HandleCollector.Remove((IntPtr) hDC, CommonHandles.HDC);
|
||||
return IntReleaseDC(hWnd, hDC);
|
||||
}
|
||||
|
||||
@@ -314,9 +314,9 @@ namespace HandyControl.Tools.Interop
|
||||
|
||||
internal static int GetYLParam(int lParam) => HiWord(lParam);
|
||||
|
||||
internal static int HiWord(int value) => (short)(value >> 16);
|
||||
internal static int HiWord(int value) => (short) (value >> 16);
|
||||
|
||||
internal static int LoWord(int value) => (short)(value & 65535);
|
||||
internal static int LoWord(int value) => (short) (value & 65535);
|
||||
|
||||
[DllImport(InteropValues.ExternDll.User32)]
|
||||
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
|
||||
@@ -374,7 +374,7 @@ namespace HandyControl.Tools.Interop
|
||||
[DllImport(InteropValues.ExternDll.User32)]
|
||||
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
|
||||
internal static int GetWindowLong(IntPtr hWnd, InteropValues.GWL nIndex) => GetWindowLong(hWnd, (int)nIndex);
|
||||
internal static int GetWindowLong(IntPtr hWnd, InteropValues.GWL nIndex) => GetWindowLong(hWnd, (int) nIndex);
|
||||
|
||||
internal static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
|
||||
{
|
||||
@@ -401,12 +401,12 @@ namespace HandyControl.Tools.Interop
|
||||
{
|
||||
if (IntPtr.Size == 8)
|
||||
{
|
||||
return SetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
|
||||
return SetWindowLongPtr(hWnd, (int) nIndex, dwNewLong);
|
||||
}
|
||||
return new IntPtr(SetWindowLong(hWnd, (int)nIndex, dwNewLong.ToInt32()));
|
||||
return new IntPtr(SetWindowLong(hWnd, (int) nIndex, dwNewLong.ToInt32()));
|
||||
}
|
||||
|
||||
internal static int SetWindowLong(IntPtr hWnd, InteropValues.GWL nIndex, int dwNewLong) => SetWindowLong(hWnd, (int)nIndex, dwNewLong);
|
||||
internal static int SetWindowLong(IntPtr hWnd, InteropValues.GWL nIndex, int dwNewLong) => SetWindowLong(hWnd, (int) nIndex, dwNewLong);
|
||||
|
||||
[DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode)]
|
||||
internal static extern ushort RegisterClass(ref InteropValues.WNDCLASS lpWndClass);
|
||||
@@ -451,7 +451,7 @@ namespace HandyControl.Tools.Interop
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool AlphaBlend(IntPtr hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, IntPtr hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, InteropValues.BLENDFUNCTION pfn);
|
||||
|
||||
internal static int GET_SC_WPARAM(IntPtr wParam) => (int)wParam & 65520;
|
||||
internal static int GET_SC_WPARAM(IntPtr wParam) => (int) wParam & 65520;
|
||||
|
||||
[DllImport(InteropValues.ExternDll.User32)]
|
||||
internal static extern IntPtr ChildWindowFromPointEx(IntPtr hwndParent, InteropValues.POINT pt, int uFlags);
|
||||
@@ -486,7 +486,7 @@ namespace HandyControl.Tools.Interop
|
||||
|
||||
private static bool Initialized => InitToken != IntPtr.Zero;
|
||||
|
||||
internal const int
|
||||
internal const int
|
||||
Ok = 0,
|
||||
GenericError = 1,
|
||||
InvalidParameter = 2,
|
||||
@@ -508,7 +508,7 @@ namespace HandyControl.Tools.Interop
|
||||
GdiplusNotInitialized = 18,
|
||||
PropertyNotFound = 19,
|
||||
PropertyNotSupported = 20,
|
||||
E_UNEXPECTED = unchecked((int)0x8000FFFF);
|
||||
E_UNEXPECTED = unchecked((int) 0x8000FFFF);
|
||||
|
||||
static Gdip()
|
||||
{
|
||||
@@ -719,4 +719,4 @@ namespace HandyControl.Tools.Interop
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace HandyControl.Tools.Interop
|
||||
PLANES = 14,
|
||||
BI_RGB = 0,
|
||||
DIB_RGB_COLORS = 0,
|
||||
E_FAIL = unchecked((int)0x80004005),
|
||||
E_FAIL = unchecked((int) 0x80004005),
|
||||
NIF_MESSAGE = 0x00000001,
|
||||
NIF_ICON = 0x00000002,
|
||||
NIF_TIP = 0x00000004,
|
||||
@@ -233,10 +233,10 @@ namespace HandyControl.Tools.Interop
|
||||
|
||||
public RECT(Rect rect)
|
||||
{
|
||||
Left = (int)rect.Left;
|
||||
Top = (int)rect.Top;
|
||||
Right = (int)rect.Right;
|
||||
Bottom = (int)rect.Bottom;
|
||||
Left = (int) rect.Left;
|
||||
Top = (int) rect.Top;
|
||||
Right = (int) rect.Right;
|
||||
Bottom = (int) rect.Bottom;
|
||||
}
|
||||
|
||||
public Point Position => new Point(Left, Top);
|
||||
@@ -717,11 +717,11 @@ namespace HandyControl.Tools.Interop
|
||||
[return: MarshalAs(UnmanagedType.I8)]
|
||||
long CopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In, MarshalAs(UnmanagedType.I8)] long cb, [Out, MarshalAs(UnmanagedType.LPArray)] long[] pcbRead);
|
||||
|
||||
void Commit([In]int grfCommitFlags);
|
||||
void Commit([In] int grfCommitFlags);
|
||||
|
||||
void Revert();
|
||||
|
||||
void LockRegion([In, MarshalAs(UnmanagedType.I8)]long libOffset, [In, MarshalAs(UnmanagedType.I8)] long cb, [In] int dwLockType);
|
||||
void LockRegion([In, MarshalAs(UnmanagedType.I8)] long libOffset, [In, MarshalAs(UnmanagedType.I8)] long cb, [In] int dwLockType);
|
||||
|
||||
void UnlockRegion([In, MarshalAs(UnmanagedType.I8)] long libOffset, [In, MarshalAs(UnmanagedType.I8)] long cb, [In] int dwLockType);
|
||||
|
||||
@@ -820,7 +820,7 @@ namespace HandyControl.Tools.Interop
|
||||
while (written < cb)
|
||||
{
|
||||
var toRead = bufsize;
|
||||
if (written + toRead > cb) toRead = (int)(cb - written);
|
||||
if (written + toRead > cb) toRead = (int) (cb - written);
|
||||
var read = Read(buffer, toRead);
|
||||
if (read == 0) break;
|
||||
if (pstm.Write(buffer, read) != read)
|
||||
@@ -973,4 +973,4 @@ namespace HandyControl.Tools.Interop
|
||||
internal string szCSDVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace HandyControl.Tools
|
||||
if (_poolSize > 0)
|
||||
{
|
||||
var lastPooledIndex = _poolSize - 1;
|
||||
var instance = (T)_pool[lastPooledIndex];
|
||||
var instance = (T) _pool[lastPooledIndex];
|
||||
_pool[lastPooledIndex] = null;
|
||||
_poolSize--;
|
||||
return instance;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
public SynchronizedPool(int maxPoolSize) : base(maxPoolSize)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override T Acquire()
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
public override bool Release(T element)
|
||||
{
|
||||
lock (_lockObj) {
|
||||
lock (_lockObj)
|
||||
{
|
||||
return base.Release(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ namespace HandyControl.Tools
|
||||
}
|
||||
}
|
||||
|
||||
void ICollection.CopyTo(Array array, int index) => CopyTo((T[])array, index);
|
||||
void ICollection.CopyTo(Array array, int index) => CopyTo((T[]) array, index);
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
}
|
||||
|
||||
@@ -94,4 +94,4 @@ namespace HandyControl.Tools
|
||||
return Regex.IsMatch(str, RegexPatterns.UrlPattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,4 +148,4 @@
|
||||
/// <returns></returns>
|
||||
public object GetValue(string propertyName) => GetType().GetField(propertyName).GetValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
-51
@@ -17,67 +17,67 @@ namespace HandyControl.Tools
|
||||
switch (buttonBase)
|
||||
{
|
||||
case RadioButton _:
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemSingle);
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemHorizontalLast
|
||||
: ResourceToken.RadioGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemVerticalLast
|
||||
: ResourceToken.RadioGroupItemDefault);
|
||||
}
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemHorizontalLast
|
||||
: ResourceToken.RadioGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemVerticalLast
|
||||
: ResourceToken.RadioGroupItemDefault);
|
||||
}
|
||||
|
||||
case Button _:
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemSingle);
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ButtonGroupItemHorizontalLast
|
||||
: ResourceToken.ButtonGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ButtonGroupItemVerticalLast
|
||||
: ResourceToken.ButtonGroupItemDefault);
|
||||
}
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ButtonGroupItemHorizontalLast
|
||||
: ResourceToken.ButtonGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ButtonGroupItemVerticalLast
|
||||
: ResourceToken.ButtonGroupItemDefault);
|
||||
}
|
||||
|
||||
case ToggleButton _:
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemSingle);
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ToggleButtonGroupItemHorizontalLast
|
||||
: ResourceToken.ToggleButtonGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ToggleButtonGroupItemVerticalLast
|
||||
: ResourceToken.ToggleButtonGroupItemDefault);
|
||||
}
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ToggleButtonGroupItemHorizontalLast
|
||||
: ResourceToken.ToggleButtonGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ToggleButtonGroupItemVerticalLast
|
||||
: ResourceToken.ToggleButtonGroupItemDefault);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -27,4 +27,4 @@ namespace HandyControl.Tools
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,4 @@ namespace HandyControl.Tools
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user