Initial commit to new repository
This commit is contained in:
57
.decompiledproj/AxCopilot/ViewModels/ColorRowModel.cs
Normal file
57
.decompiledproj/AxCopilot/ViewModels/ColorRowModel.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AxCopilot.ViewModels;
|
||||
|
||||
public class ColorRowModel : INotifyPropertyChanged
|
||||
{
|
||||
private string _hex;
|
||||
|
||||
public string Label { get; init; } = "";
|
||||
|
||||
public string Property { get; init; } = "";
|
||||
|
||||
public string Hex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _hex;
|
||||
}
|
||||
set
|
||||
{
|
||||
_hex = value;
|
||||
OnPropertyChanged("Hex");
|
||||
OnPropertyChanged("Preview");
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush Preview
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(Hex));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public ColorRowModel(string label, string property, string hex)
|
||||
{
|
||||
Label = label;
|
||||
Property = property;
|
||||
_hex = hex;
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string? n = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user