MeasureToolProperties.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Text.Json; 6 using System.Text.Json.Serialization; 7 8 using Settings.UI.Library.Attributes; 9 using Settings.UI.Library.Enumerations; 10 11 namespace Microsoft.PowerToys.Settings.UI.Library 12 { 13 public class MeasureToolProperties 14 { 15 [CmdConfigureIgnore] 16 public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, true, false, true, 0x4D); 17 18 public MeasureToolProperties() 19 { 20 ActivationShortcut = DefaultActivationShortcut; 21 UnitsOfMeasure = new IntProperty(0); 22 PixelTolerance = new IntProperty(30); 23 ContinuousCapture = false; 24 DrawFeetOnCross = true; 25 PerColorChannelEdgeDetection = false; 26 MeasureCrossColor = new StringProperty("#FF4500"); 27 DefaultMeasureStyle = new IntProperty((int)MeasureToolMeasureStyle.None); 28 } 29 30 public HotkeySettings ActivationShortcut { get; set; } 31 32 [JsonConverter(typeof(BoolPropertyJsonConverter))] 33 public bool ContinuousCapture { get; set; } 34 35 [JsonConverter(typeof(BoolPropertyJsonConverter))] 36 public bool DrawFeetOnCross { get; set; } 37 38 [JsonConverter(typeof(BoolPropertyJsonConverter))] 39 public bool PerColorChannelEdgeDetection { get; set; } 40 41 public IntProperty UnitsOfMeasure { get; set; } 42 43 public IntProperty PixelTolerance { get; set; } 44 45 public StringProperty MeasureCrossColor { get; set; } 46 47 public IntProperty DefaultMeasureStyle { get; set; } 48 49 public override string ToString() => JsonSerializer.Serialize(this, SettingsSerializationContext.Default.MeasureToolProperties); 50 } 51 }