mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Databinding modifiers - Redesigned API to leverage generics
Databinding modifiers - Updated default modifiers to use new API
This commit is contained in:
1 parent
2bb663db15
commit
fd9f3afef5
50 files changed
+487
-407
No files matched your search
@@ -41,6 +41,8 @@
|
||||
</UserControl.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Style="{StaticResource MaterialDesignFlatDarkBgButton}"
|
||||
Background="{Binding SwitchButtonBrush}"
|
||||
BorderBrush="{Binding SwitchButtonBrush}"
|
||||
Height="22"
|
||||
Padding="0"
|
||||
Width="22"
|
||||
|
||||
@@ -7,6 +7,7 @@ using Artemis.Core;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using MaterialDesignColors.ColorManipulation;
|
||||
using Stylet;
|
||||
|
||||
// Remove, annoying while working on it
|
||||
@@ -19,7 +20,7 @@ namespace Artemis.UI.Shared.Input
|
||||
private readonly IDataModelUIService _dataModelUIService;
|
||||
private readonly Module _module;
|
||||
private readonly Timer _updateTimer;
|
||||
private Brush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
|
||||
private SolidColorBrush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
|
||||
private DataModelPath _dataModelPath;
|
||||
private DataModelPropertiesViewModel _dataModelViewModel;
|
||||
private bool _displaySwitchButton;
|
||||
@@ -41,12 +42,18 @@ namespace Artemis.UI.Shared.Input
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public Brush ButtonBrush
|
||||
public SolidColorBrush ButtonBrush
|
||||
{
|
||||
get => _buttonBrush;
|
||||
set => SetAndNotify(ref _buttonBrush, value);
|
||||
set
|
||||
{
|
||||
if (!SetAndNotify(ref _buttonBrush, value)) return;
|
||||
NotifyOfPropertyChange(nameof(SwitchButtonBrush));
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush SwitchButtonBrush => new SolidColorBrush(ButtonBrush.Color.Darken());
|
||||
|
||||
public string Placeholder
|
||||
{
|
||||
get => _placeholder;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
<Grid Margin="3 -4">
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding InputViewModel, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}">
|
||||
<Button Style="{StaticResource MaterialDesignFlatDarkBgButton}"
|
||||
Background="{Binding SwitchButtonBrush}"
|
||||
BorderBrush="{Binding SwitchButtonBrush}"
|
||||
Height="22"
|
||||
Padding="0"
|
||||
Width="22"
|
||||
@@ -32,7 +34,8 @@
|
||||
Margin="0 0 -3 0"
|
||||
HorizontalAlignment="Left"
|
||||
ToolTip="Switch to data model value"
|
||||
Command="{s:Action SwitchToDynamic}">
|
||||
Command="{s:Action SwitchToDynamic}"
|
||||
Visibility="{Binding DisplaySwitchButton, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||
<materialDesign:PackIcon Kind="SwapHorizontal" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource DataModelConditionButton}"
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Windows.Media;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using MaterialDesignColors.ColorManipulation;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Shared.Input
|
||||
@@ -14,7 +15,7 @@ namespace Artemis.UI.Shared.Input
|
||||
{
|
||||
private readonly IDataModelUIService _dataModelUIService;
|
||||
private readonly Window _rootView;
|
||||
private Brush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
|
||||
private SolidColorBrush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
|
||||
private DataModelDisplayViewModel _displayViewModel;
|
||||
private DataModelInputViewModel _inputViewModel;
|
||||
private bool _isEnabled;
|
||||
@@ -22,6 +23,7 @@ namespace Artemis.UI.Shared.Input
|
||||
private DataModelPropertyAttribute _targetDescription;
|
||||
private Type _targetType;
|
||||
private object _value;
|
||||
private bool _displaySwitchButton;
|
||||
|
||||
internal DataModelStaticViewModel(Type targetType, DataModelPropertyAttribute targetDescription, IDataModelUIService dataModelUIService)
|
||||
{
|
||||
@@ -40,12 +42,18 @@ namespace Artemis.UI.Shared.Input
|
||||
}
|
||||
}
|
||||
|
||||
public Brush ButtonBrush
|
||||
public SolidColorBrush ButtonBrush
|
||||
{
|
||||
get => _buttonBrush;
|
||||
set => SetAndNotify(ref _buttonBrush, value);
|
||||
set
|
||||
{
|
||||
if (!SetAndNotify(ref _buttonBrush, value)) return;
|
||||
NotifyOfPropertyChange(nameof(SwitchButtonBrush));
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush SwitchButtonBrush => new SolidColorBrush(ButtonBrush.Color.Darken());
|
||||
|
||||
public DataModelDisplayViewModel DisplayViewModel
|
||||
{
|
||||
get => _displayViewModel;
|
||||
@@ -92,6 +100,12 @@ namespace Artemis.UI.Shared.Input
|
||||
private set => SetAndNotify(ref _isEnabled, value);
|
||||
}
|
||||
|
||||
public bool DisplaySwitchButton
|
||||
{
|
||||
get => _displaySwitchButton;
|
||||
set => SetAndNotify(ref _displaySwitchButton, value);
|
||||
}
|
||||
|
||||
public void ActivateInputViewModel()
|
||||
{
|
||||
InputViewModel = _dataModelUIService.GetDataModelInputViewModel(
|
||||
|
||||
Reference in new issue
Block a user