1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Core - Added missing property changed calls in ProfileConfiguration

Sidebar - Added suspended status indicators
This commit is contained in:
Robert 2022-07-31 21:24:02 +02:00
parent 7667cc5473
commit 5873df250d
9 changed files with 518 additions and 130 deletions

View File

@ -28,7 +28,7 @@ namespace Artemis.Core
/// <param name="value">Value to apply.</param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected virtual bool RequiresUpdate<T>(ref T storage, T value)
protected bool RequiresUpdate<T>(ref T storage, T value)
{
return !Equals(storage, value);
}
@ -46,7 +46,7 @@ namespace Artemis.Core
/// </param>
/// <returns><c>true</c> if the value was changed, <c>false</c> if the existing value matched the desired value.</returns>
[NotifyPropertyChangedInvocator]
protected virtual bool SetAndNotify<T>(ref T storage, T value, [CallerMemberName] string? propertyName = null)
protected bool SetAndNotify<T>(ref T storage, T value, [CallerMemberName] string? propertyName = null)
{
if (!RequiresUpdate(ref storage, value)) return false;
@ -64,7 +64,7 @@ namespace Artemis.Core
/// and can be provided automatically when invoked from compilers that support <see cref="CallerMemberNameAttribute" />
/// .
/// </param>
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

View File

@ -11,15 +11,21 @@ namespace Artemis.Core
/// </summary>
public class ProfileConfiguration : BreakableModel, IStorageModel, IDisposable
{
private ProfileCategory _category;
private bool _disposed;
private bool _isMissingModule;
private bool _isSuspended;
private Module? _module;
private string _name;
private int _order;
private bool _isSuspended;
private bool _isMissingModule;
private ProfileCategory _category;
private ProfileConfigurationHotkeyMode _hotkeyMode;
private Hotkey? _enableHotkey;
private Hotkey? _disableHotkey;
private ActivationBehaviour _activationBehaviour;
private bool _activationConditionMet;
private bool _isBeingEdited;
private Profile? _profile;
private Module? _module;
internal ProfileConfiguration(ProfileCategory category, string name, string icon)
{
@ -91,31 +97,60 @@ namespace Artemis.Core
internal set => SetAndNotify(ref _category, value);
}
/// <summary>
/// Gets the icon configuration
/// </summary>
public ProfileConfigurationIcon Icon { get; }
/// <summary>
/// Gets or sets the <see cref="ProfileConfigurationHotkeyMode" /> used to determine hotkey behaviour
/// </summary>
public ProfileConfigurationHotkeyMode HotkeyMode { get; set; }
public ProfileConfigurationHotkeyMode HotkeyMode
{
get => _hotkeyMode;
set => SetAndNotify(ref _hotkeyMode, value);
}
/// <summary>
/// Gets or sets the hotkey used to enable or toggle the profile
/// </summary>
public Hotkey? EnableHotkey { get; set; }
public Hotkey? EnableHotkey
{
get => _enableHotkey;
set => SetAndNotify(ref _enableHotkey, value);
}
/// <summary>
/// Gets or sets the hotkey used to disable the profile
/// </summary>
public Hotkey? DisableHotkey { get; set; }
public Hotkey? DisableHotkey
{
get => _disableHotkey;
set => SetAndNotify(ref _disableHotkey, value);
}
/// <summary>
/// Gets the ID of the profile of this profile configuration
/// Gets or sets the behaviour of when this profile is activated
/// </summary>
public Guid ProfileId => Entity.ProfileId;
public ActivationBehaviour ActivationBehaviour
{
get => _activationBehaviour;
set => SetAndNotify(ref _activationBehaviour, value);
}
/// <summary>
/// Gets a boolean indicating whether the activation conditions where met during the last <see cref="Update" /> call
/// </summary>
public bool ActivationConditionMet
{
get => _activationConditionMet;
private set => SetAndNotify(ref _activationConditionMet, value);
}
/// <summary>
/// Gets or sets a boolean indicating whether this profile configuration is being edited
/// </summary>
public bool IsBeingEdited
{
get => _isBeingEdited;
set => SetAndNotify(ref _isBeingEdited, value);
}
/// <summary>
/// Gets the profile of this profile configuration
/// </summary>
@ -125,17 +160,6 @@ namespace Artemis.Core
internal set => SetAndNotify(ref _profile, value);
}
/// <summary>
/// Gets or sets the behaviour of when this profile is activated
/// </summary>
public ActivationBehaviour ActivationBehaviour { get; set; }
/// <summary>
/// Gets the data model condition that must evaluate to <see langword="true" /> for this profile to be activated
/// alongside any activation requirements of the <see cref="Module" />, if set
/// </summary>
public NodeScript<bool> ActivationCondition { get; }
/// <summary>
/// Gets or sets the module this profile uses
/// </summary>
@ -144,25 +168,31 @@ namespace Artemis.Core
get => _module;
set
{
_module = value;
SetAndNotify(ref _module, value);
IsMissingModule = false;
}
}
/// <summary>
/// Gets a boolean indicating whether the activation conditions where met during the last <see cref="Update" /> call
/// Gets the icon configuration
/// </summary>
public bool ActivationConditionMet { get; private set; }
public ProfileConfigurationIcon Icon { get; }
/// <summary>
/// Gets or sets a boolean indicating whether this profile configuration is being edited
/// Gets the data model condition that must evaluate to <see langword="true" /> for this profile to be activated
/// alongside any activation requirements of the <see cref="Module" />, if set
/// </summary>
public bool IsBeingEdited { get; set; }
public NodeScript<bool> ActivationCondition { get; }
/// <summary>
/// Gets the entity used by this profile config
/// </summary>
public ProfileConfigurationEntity Entity { get; }
/// <summary>
/// Gets the ID of the profile of this profile configuration
/// </summary>
public Guid ProfileId => Entity.ProfileId;
/// <summary>
/// Updates this configurations activation condition status
@ -243,7 +273,7 @@ namespace Artemis.Core
if (Entity.ActivationCondition != null)
ActivationCondition.LoadFromEntity(Entity.ActivationCondition);
EnableHotkey = Entity.EnableHotkey != null ? new Hotkey(Entity.EnableHotkey) : null;
DisableHotkey = Entity.DisableHotkey != null ? new Hotkey(Entity.DisableHotkey) : null;
}

View File

@ -17,6 +17,18 @@
"System.ValueTuple": "4.5.0"
}
},
"Avalonia.Diagnostics": {
"type": "Direct",
"requested": "[0.10.15, )",
"resolved": "0.10.15",
"contentHash": "s3TSl7vmMXv3EzJPzsa69PshiPp9ajoMeVGP9FAfYopR6iuq60MxikEZTscjhsJ+BySCALXN83F1Gwz8o3oGJA==",
"dependencies": {
"Avalonia": "0.10.15",
"Avalonia.Controls.DataGrid": "0.10.15",
"Microsoft.CodeAnalysis.CSharp.Scripting": "3.4.0",
"System.Reactive": "5.0.0"
}
},
"Avalonia.ReactiveUI": {
"type": "Direct",
"requested": "[0.10.15, )",
@ -317,6 +329,75 @@
"resolved": "0.10.4",
"contentHash": "enc2U+/1UnF3rtocxb5ofcg7cJSmJI4adbYPr8DZa5bQzvhqA/VbjlcalxoqjI3CR2RvM5WWpjKT0p3BriFJjw=="
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "2.9.6",
"contentHash": "Kmms3TxGQMNb95Cu/3K+0bIcMnV4qf/phZBLAB0HUi65rBPxP4JO3aM2LoAcb+DFS600RQJMZ7ZLyYDTbLwJOQ=="
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "3ncA7cV+iXGA1VYwe2UEZXcvWyZSlbexWjM9AvocP7sik5UD93qt9Hq0fMRGk0jFRmvmE4T2g+bGfXiBVZEhLw==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "2.9.6",
"System.Collections.Immutable": "1.5.0",
"System.Memory": "4.5.3",
"System.Reflection.Metadata": "1.6.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2",
"System.Text.Encoding.CodePages": "4.5.1",
"System.Threading.Tasks.Extensions": "4.5.3"
}
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "/LsTtgcMN6Tu1oo7/WYbRAHL4/ubXC/miEakwTpcZKJKtFo7D0AK95Hw0dbGxul6C8WJu60v6NP2435TDYZM+Q==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.CSharp.Scripting": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "tLgqc76qXHmONUhWhxo7z3TcL/LmGFWIUJm1exbQmVJohuQvJnejUMxmVkdxDfMuMZU1fIyJXPZ6Fkp4FEneAg==",
"dependencies": {
"Microsoft.CSharp": "4.3.0",
"Microsoft.CodeAnalysis.CSharp": "[3.4.0]",
"Microsoft.CodeAnalysis.Common": "[3.4.0]",
"Microsoft.CodeAnalysis.Scripting.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.Scripting.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "+b6I3DZL2zvck+B/E/aiOveakj5U2G2BcYODQxcGh2IDbatNU3XXxGT1HumkWB5uIZI2Leu0opBgBpjScmjGMA==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "P+MBhIM0YX+JqROuf7i306ZLJEjQYA9uUyRDE+OqwUI5sh41e2ZbPQV3LfAPh+29cmceE1pUffXsGfR4eMY3KA==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
"System.Dynamic.Runtime": "4.3.0",
"System.Globalization": "4.3.0",
"System.Linq": "4.3.0",
"System.Linq.Expressions": "4.3.0",
"System.ObjectModel": "4.3.0",
"System.Reflection": "4.3.0",
"System.Reflection.Extensions": "4.3.0",
"System.Reflection.Primitives": "4.3.0",
"System.Reflection.TypeExtensions": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Runtime.InteropServices": "4.3.0",
"System.Threading": "4.3.0"
}
},
"Microsoft.DotNet.PlatformAbstractions": {
"type": "Transitive",
"resolved": "3.1.6",
@ -665,6 +746,11 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "1.5.0",
"contentHash": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ=="
},
"System.Collections.NonGeneric": {
"type": "Transitive",
"resolved": "4.3.0",
@ -1398,6 +1484,15 @@
"System.Runtime": "4.3.0"
}
},
"System.Text.Encoding.CodePages": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==",
"dependencies": {
"Microsoft.NETCore.Platforms": "2.1.2",
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
}
},
"System.Text.Encoding.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
@ -1438,13 +1533,8 @@
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Runtime": "4.3.0",
"System.Threading.Tasks": "4.3.0"
}
"resolved": "4.5.3",
"contentHash": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ=="
},
"System.Threading.Timer": {
"type": "Transitive",

View File

@ -30,6 +30,18 @@
"Avalonia.X11": "0.10.15"
}
},
"Avalonia.Diagnostics": {
"type": "Direct",
"requested": "[0.10.15, )",
"resolved": "0.10.15",
"contentHash": "s3TSl7vmMXv3EzJPzsa69PshiPp9ajoMeVGP9FAfYopR6iuq60MxikEZTscjhsJ+BySCALXN83F1Gwz8o3oGJA==",
"dependencies": {
"Avalonia": "0.10.15",
"Avalonia.Controls.DataGrid": "0.10.15",
"Microsoft.CodeAnalysis.CSharp.Scripting": "3.4.0",
"System.Reactive": "5.0.0"
}
},
"Avalonia.ReactiveUI": {
"type": "Direct",
"requested": "[0.10.15, )",
@ -345,6 +357,75 @@
"resolved": "0.10.4",
"contentHash": "enc2U+/1UnF3rtocxb5ofcg7cJSmJI4adbYPr8DZa5bQzvhqA/VbjlcalxoqjI3CR2RvM5WWpjKT0p3BriFJjw=="
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "2.9.6",
"contentHash": "Kmms3TxGQMNb95Cu/3K+0bIcMnV4qf/phZBLAB0HUi65rBPxP4JO3aM2LoAcb+DFS600RQJMZ7ZLyYDTbLwJOQ=="
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "3ncA7cV+iXGA1VYwe2UEZXcvWyZSlbexWjM9AvocP7sik5UD93qt9Hq0fMRGk0jFRmvmE4T2g+bGfXiBVZEhLw==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "2.9.6",
"System.Collections.Immutable": "1.5.0",
"System.Memory": "4.5.3",
"System.Reflection.Metadata": "1.6.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2",
"System.Text.Encoding.CodePages": "4.5.1",
"System.Threading.Tasks.Extensions": "4.5.3"
}
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "/LsTtgcMN6Tu1oo7/WYbRAHL4/ubXC/miEakwTpcZKJKtFo7D0AK95Hw0dbGxul6C8WJu60v6NP2435TDYZM+Q==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.CSharp.Scripting": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "tLgqc76qXHmONUhWhxo7z3TcL/LmGFWIUJm1exbQmVJohuQvJnejUMxmVkdxDfMuMZU1fIyJXPZ6Fkp4FEneAg==",
"dependencies": {
"Microsoft.CSharp": "4.3.0",
"Microsoft.CodeAnalysis.CSharp": "[3.4.0]",
"Microsoft.CodeAnalysis.Common": "[3.4.0]",
"Microsoft.CodeAnalysis.Scripting.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.Scripting.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "+b6I3DZL2zvck+B/E/aiOveakj5U2G2BcYODQxcGh2IDbatNU3XXxGT1HumkWB5uIZI2Leu0opBgBpjScmjGMA==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "P+MBhIM0YX+JqROuf7i306ZLJEjQYA9uUyRDE+OqwUI5sh41e2ZbPQV3LfAPh+29cmceE1pUffXsGfR4eMY3KA==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
"System.Dynamic.Runtime": "4.3.0",
"System.Globalization": "4.3.0",
"System.Linq": "4.3.0",
"System.Linq.Expressions": "4.3.0",
"System.ObjectModel": "4.3.0",
"System.Reflection": "4.3.0",
"System.Reflection.Extensions": "4.3.0",
"System.Reflection.Primitives": "4.3.0",
"System.Reflection.TypeExtensions": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Runtime.InteropServices": "4.3.0",
"System.Threading": "4.3.0"
}
},
"Microsoft.DotNet.PlatformAbstractions": {
"type": "Transitive",
"resolved": "3.1.6",
@ -747,6 +828,11 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "1.5.0",
"contentHash": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ=="
},
"System.Collections.NonGeneric": {
"type": "Transitive",
"resolved": "4.3.0",
@ -1529,13 +1615,8 @@
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Runtime": "4.3.0",
"System.Threading.Tasks": "4.3.0"
}
"resolved": "4.5.3",
"contentHash": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ=="
},
"System.Threading.Timer": {
"type": "Transitive",
@ -1668,6 +1749,7 @@
"Avalonia": "0.10.15",
"Avalonia.Controls.PanAndZoom": "10.14.0",
"Avalonia.Desktop": "0.10.15",
"Avalonia.Diagnostics": "0.10.15",
"Avalonia.ReactiveUI": "0.10.15",
"Avalonia.Xaml.Behaviors": "0.10.14",
"DynamicData": "7.8.6",
@ -1688,6 +1770,7 @@
"dependencies": {
"Artemis.Core": "1.0.0",
"Avalonia": "0.10.15",
"Avalonia.Diagnostics": "0.10.15",
"Avalonia.ReactiveUI": "0.10.15",
"Avalonia.Xaml.Behaviors": "0.10.14",
"DynamicData": "7.8.6",

View File

@ -104,36 +104,38 @@
</avalonia:MaterialIcon.Transitions>
</avalonia:MaterialIcon>
<TextBlock Classes="fadable"
Classes.suspended="{CompiledBinding IsSuspended}"
Grid.Column="1"
Padding="0 5"
FontWeight="SemiBold"
FontSize="13"
VerticalAlignment="Center"
Text="{CompiledBinding ProfileCategory.Name, FallbackValue='Profile name'}"
TextTrimming="CharacterEllipsis"
PointerReleased="InputElement_OnPointerReleased"
Background="Transparent">
<TextBlock.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</TextBlock.Transitions>
</TextBlock>
<Panel Grid.Column="1" HorizontalAlignment="Left">
<TextBlock Classes="fadable"
Classes.suspended="{CompiledBinding IsSuspended}"
Padding="0 5"
FontWeight="SemiBold"
FontSize="13"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{CompiledBinding ProfileCategory.Name, FallbackValue='Profile name'}"
TextTrimming="CharacterEllipsis"
PointerReleased="InputElement_OnPointerReleased"
Background="Transparent">
<TextBlock.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</TextBlock.Transitions>
</TextBlock>
<Border Classes="fadable"
Classes.suspended="{CompiledBinding IsSuspended}"
Grid.Column="1"
BorderBrush="White"
BorderThickness="0.5"
Height="1">
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
<Border Classes="fadable"
Classes.suspended="{CompiledBinding IsSuspended}"
HorizontalAlignment="Stretch"
BorderBrush="White"
BorderThickness="0.5"
Height="1">
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
</Panel>
<Button Classes="category-button icon-button icon-button-small"
Grid.Column="2"

View File

@ -6,13 +6,11 @@
xmlns:converters="clr-namespace:Artemis.UI.Converters"
xmlns:sidebar="clr-namespace:Artemis.UI.Screens.Sidebar"
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Sidebar.SidebarProfileConfigurationView"
x:DataType="sidebar:SidebarProfileConfigurationViewModel"
Background="Transparent">
<UserControl.Resources>
<converters:ValuesAdditionConverter x:Key="ValuesAddition" />
</UserControl.Resources>
<UserControl.ContextFlyout>
<MenuFlyout>
<MenuItem Header="View properties" Command="{CompiledBinding EditProfile}">
@ -22,7 +20,7 @@
</MenuItem>
<MenuItem Header="Suspend" Command="{CompiledBinding ToggleSuspended}">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="Check" IsVisible="{CompiledBinding IsSuspended}" />
<avalonia:MaterialIcon Kind="Check" IsVisible="{CompiledBinding ProfileConfiguration.IsSuspended}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Suspend all">
@ -64,34 +62,46 @@
VerticalAlignment="Center"
ConfigurationIcon="{CompiledBinding ProfileConfiguration.Icon}"
Width="20"
Height="20" />
Height="20"
Margin="0 0 5 0">
<shared:ProfileConfigurationIcon.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</shared:ProfileConfigurationIcon.Transitions>
</shared:ProfileConfigurationIcon>
<TextBlock Grid.Column="1"
x:Name="ProfileName"
FontSize="12"
Margin="10 0 0 0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{CompiledBinding ProfileConfiguration.Name}"
TextTrimming="CharacterEllipsis" />
<Panel Grid.Column="1" HorizontalAlignment="Left">
<TextBlock Classes="fadable"
Classes.suspended="{CompiledBinding IsDisabled}"
Padding="0 5"
FontWeight="SemiBold"
FontSize="13"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{CompiledBinding ProfileConfiguration.Name, FallbackValue='Profile name'}"
TextTrimming="CharacterEllipsis"
Background="Transparent">
<TextBlock.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</TextBlock.Transitions>
</TextBlock>
<Border Grid.Column="0"
Grid.ColumnSpan="2"
BorderThickness="1"
BorderBrush="{DynamicResource MaterialDesignBody}"
Height="1"
Opacity="0"
HorizontalAlignment="Left">
<!-- Ensure the line covers the profile and the text but not the full two columns -->
<Border.Width>
<MultiBinding Converter="{StaticResource ValuesAddition}">
<Binding Path="ActualWidth" ElementName="ProfileIcon" />
<Binding Path="Width" ElementName="ProfileName" />
<Binding Path="Margin.Left" ElementName="ProfileName" />
</MultiBinding>
</Border.Width>
</Border>
<Border Classes="fadable"
Classes.suspended="{CompiledBinding ProfileConfiguration.IsSuspended}"
HorizontalAlignment="Stretch"
BorderBrush="White"
BorderThickness="0.5"
Height="1">
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
</Panel>
<Button Command="{CompiledBinding EditProfile}"
Classes="icon-button icon-button-small"
@ -106,8 +116,8 @@
Grid.Column="3"
ToolTip.Tip="Suspend/resume profile">
<Panel>
<avalonia:MaterialIcon Kind="EyeOff" IsVisible="{CompiledBinding IsSuspended}" />
<avalonia:MaterialIcon Kind="Eye" IsVisible="{CompiledBinding !IsSuspended}" />
<avalonia:MaterialIcon Kind="EyeOff" IsVisible="{CompiledBinding ProfileConfiguration.IsSuspended}" />
<avalonia:MaterialIcon Kind="Eye" IsVisible="{CompiledBinding !ProfileConfiguration.IsSuspended}" />
</Panel>
</Button>
</Grid>

View File

@ -21,8 +21,7 @@ namespace Artemis.UI.Screens.Sidebar
private readonly IProfileService _profileService;
private readonly IProfileEditorService _profileEditorService;
private readonly IWindowService _windowService;
private ObservableAsPropertyHelper<bool>? _isSuspended;
public ProfileConfiguration ProfileConfiguration { get; }
private ObservableAsPropertyHelper<bool>? _isDisabled;
public SidebarProfileConfigurationViewModel(SidebarViewModel sidebarViewModel,
ProfileConfiguration profileConfiguration,
@ -44,11 +43,13 @@ namespace Artemis.UI.Screens.Sidebar
ExportProfile = ReactiveCommand.CreateFromTask(ExecuteExportProfile);
DuplicateProfile = ReactiveCommand.Create(ExecuteDuplicateProfile);
this.WhenActivated(d => { _isSuspended = ProfileConfiguration.WhenAnyValue(c => c.IsSuspended).ToProperty(this, vm => vm.IsSuspended).DisposeWith(d); });
this.WhenActivated(d => _isDisabled = ProfileConfiguration.WhenAnyValue(c => c.IsSuspended, c => c.ActivationConditionMet, (suspended, met) => suspended || !met)
.ToProperty(this, vm => vm.IsDisabled)
.DisposeWith(d));
_profileService.LoadProfileConfigurationIcon(ProfileConfiguration);
}
public ProfileConfiguration ProfileConfiguration { get; }
public ReactiveCommand<Unit, Unit> EditProfile { get; }
public ReactiveCommand<Unit, Unit> ToggleSuspended { get; }
public ReactiveCommand<string, Unit> ResumeAll { get; }
@ -57,7 +58,7 @@ namespace Artemis.UI.Screens.Sidebar
public ReactiveCommand<Unit, Unit> ExportProfile { get; }
public ReactiveCommand<Unit, Unit> DuplicateProfile { get; }
public bool IsSuspended => _isSuspended?.Value ?? false;
public bool IsDisabled => _isDisabled?.Value ?? false;
private async Task ExecuteEditProfile()
{

View File

@ -39,6 +39,18 @@
"Avalonia.X11": "0.10.15"
}
},
"Avalonia.Diagnostics": {
"type": "Direct",
"requested": "[0.10.15, )",
"resolved": "0.10.15",
"contentHash": "s3TSl7vmMXv3EzJPzsa69PshiPp9ajoMeVGP9FAfYopR6iuq60MxikEZTscjhsJ+BySCALXN83F1Gwz8o3oGJA==",
"dependencies": {
"Avalonia": "0.10.15",
"Avalonia.Controls.DataGrid": "0.10.15",
"Microsoft.CodeAnalysis.CSharp.Scripting": "3.4.0",
"System.Reactive": "5.0.0"
}
},
"Avalonia.ReactiveUI": {
"type": "Direct",
"requested": "[0.10.15, )",
@ -371,6 +383,75 @@
"resolved": "0.10.4",
"contentHash": "enc2U+/1UnF3rtocxb5ofcg7cJSmJI4adbYPr8DZa5bQzvhqA/VbjlcalxoqjI3CR2RvM5WWpjKT0p3BriFJjw=="
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "2.9.6",
"contentHash": "Kmms3TxGQMNb95Cu/3K+0bIcMnV4qf/phZBLAB0HUi65rBPxP4JO3aM2LoAcb+DFS600RQJMZ7ZLyYDTbLwJOQ=="
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "3ncA7cV+iXGA1VYwe2UEZXcvWyZSlbexWjM9AvocP7sik5UD93qt9Hq0fMRGk0jFRmvmE4T2g+bGfXiBVZEhLw==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "2.9.6",
"System.Collections.Immutable": "1.5.0",
"System.Memory": "4.5.3",
"System.Reflection.Metadata": "1.6.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2",
"System.Text.Encoding.CodePages": "4.5.1",
"System.Threading.Tasks.Extensions": "4.5.3"
}
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "/LsTtgcMN6Tu1oo7/WYbRAHL4/ubXC/miEakwTpcZKJKtFo7D0AK95Hw0dbGxul6C8WJu60v6NP2435TDYZM+Q==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.CSharp.Scripting": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "tLgqc76qXHmONUhWhxo7z3TcL/LmGFWIUJm1exbQmVJohuQvJnejUMxmVkdxDfMuMZU1fIyJXPZ6Fkp4FEneAg==",
"dependencies": {
"Microsoft.CSharp": "4.3.0",
"Microsoft.CodeAnalysis.CSharp": "[3.4.0]",
"Microsoft.CodeAnalysis.Common": "[3.4.0]",
"Microsoft.CodeAnalysis.Scripting.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.Scripting.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "+b6I3DZL2zvck+B/E/aiOveakj5U2G2BcYODQxcGh2IDbatNU3XXxGT1HumkWB5uIZI2Leu0opBgBpjScmjGMA==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "P+MBhIM0YX+JqROuf7i306ZLJEjQYA9uUyRDE+OqwUI5sh41e2ZbPQV3LfAPh+29cmceE1pUffXsGfR4eMY3KA==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
"System.Dynamic.Runtime": "4.3.0",
"System.Globalization": "4.3.0",
"System.Linq": "4.3.0",
"System.Linq.Expressions": "4.3.0",
"System.ObjectModel": "4.3.0",
"System.Reflection": "4.3.0",
"System.Reflection.Extensions": "4.3.0",
"System.Reflection.Primitives": "4.3.0",
"System.Reflection.TypeExtensions": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Runtime.InteropServices": "4.3.0",
"System.Threading": "4.3.0"
}
},
"Microsoft.DotNet.PlatformAbstractions": {
"type": "Transitive",
"resolved": "3.1.6",
@ -724,6 +805,11 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "1.5.0",
"contentHash": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ=="
},
"System.Collections.NonGeneric": {
"type": "Transitive",
"resolved": "4.3.0",
@ -1506,13 +1592,8 @@
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Runtime": "4.3.0",
"System.Threading.Tasks": "4.3.0"
}
"resolved": "4.5.3",
"contentHash": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ=="
},
"System.Threading.Timer": {
"type": "Transitive",
@ -1641,6 +1722,7 @@
"dependencies": {
"Artemis.Core": "1.0.0",
"Avalonia": "0.10.15",
"Avalonia.Diagnostics": "0.10.15",
"Avalonia.ReactiveUI": "0.10.15",
"Avalonia.Xaml.Behaviors": "0.10.14",
"DynamicData": "7.8.6",

View File

@ -116,6 +116,17 @@
"Avalonia.X11": "0.10.15"
}
},
"Avalonia.Diagnostics": {
"type": "Transitive",
"resolved": "0.10.15",
"contentHash": "s3TSl7vmMXv3EzJPzsa69PshiPp9ajoMeVGP9FAfYopR6iuq60MxikEZTscjhsJ+BySCALXN83F1Gwz8o3oGJA==",
"dependencies": {
"Avalonia": "0.10.15",
"Avalonia.Controls.DataGrid": "0.10.15",
"Microsoft.CodeAnalysis.CSharp.Scripting": "3.4.0",
"System.Reactive": "5.0.0"
}
},
"Avalonia.FreeDesktop": {
"type": "Transitive",
"resolved": "0.10.15",
@ -327,6 +338,75 @@
"resolved": "0.10.4",
"contentHash": "enc2U+/1UnF3rtocxb5ofcg7cJSmJI4adbYPr8DZa5bQzvhqA/VbjlcalxoqjI3CR2RvM5WWpjKT0p3BriFJjw=="
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "2.9.6",
"contentHash": "Kmms3TxGQMNb95Cu/3K+0bIcMnV4qf/phZBLAB0HUi65rBPxP4JO3aM2LoAcb+DFS600RQJMZ7ZLyYDTbLwJOQ=="
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "3ncA7cV+iXGA1VYwe2UEZXcvWyZSlbexWjM9AvocP7sik5UD93qt9Hq0fMRGk0jFRmvmE4T2g+bGfXiBVZEhLw==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "2.9.6",
"System.Collections.Immutable": "1.5.0",
"System.Memory": "4.5.3",
"System.Reflection.Metadata": "1.6.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2",
"System.Text.Encoding.CodePages": "4.5.1",
"System.Threading.Tasks.Extensions": "4.5.3"
}
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "/LsTtgcMN6Tu1oo7/WYbRAHL4/ubXC/miEakwTpcZKJKtFo7D0AK95Hw0dbGxul6C8WJu60v6NP2435TDYZM+Q==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.CSharp.Scripting": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "tLgqc76qXHmONUhWhxo7z3TcL/LmGFWIUJm1exbQmVJohuQvJnejUMxmVkdxDfMuMZU1fIyJXPZ6Fkp4FEneAg==",
"dependencies": {
"Microsoft.CSharp": "4.3.0",
"Microsoft.CodeAnalysis.CSharp": "[3.4.0]",
"Microsoft.CodeAnalysis.Common": "[3.4.0]",
"Microsoft.CodeAnalysis.Scripting.Common": "[3.4.0]"
}
},
"Microsoft.CodeAnalysis.Scripting.Common": {
"type": "Transitive",
"resolved": "3.4.0",
"contentHash": "+b6I3DZL2zvck+B/E/aiOveakj5U2G2BcYODQxcGh2IDbatNU3XXxGT1HumkWB5uIZI2Leu0opBgBpjScmjGMA==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "[3.4.0]"
}
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "P+MBhIM0YX+JqROuf7i306ZLJEjQYA9uUyRDE+OqwUI5sh41e2ZbPQV3LfAPh+29cmceE1pUffXsGfR4eMY3KA==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
"System.Dynamic.Runtime": "4.3.0",
"System.Globalization": "4.3.0",
"System.Linq": "4.3.0",
"System.Linq.Expressions": "4.3.0",
"System.ObjectModel": "4.3.0",
"System.Reflection": "4.3.0",
"System.Reflection.Extensions": "4.3.0",
"System.Reflection.Primitives": "4.3.0",
"System.Reflection.TypeExtensions": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Runtime.InteropServices": "4.3.0",
"System.Threading": "4.3.0"
}
},
"Microsoft.DotNet.PlatformAbstractions": {
"type": "Transitive",
"resolved": "3.1.6",
@ -676,6 +756,11 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "1.5.0",
"contentHash": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ=="
},
"System.Collections.NonGeneric": {
"type": "Transitive",
"resolved": "4.3.0",
@ -1409,6 +1494,15 @@
"System.Runtime": "4.3.0"
}
},
"System.Text.Encoding.CodePages": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==",
"dependencies": {
"Microsoft.NETCore.Platforms": "2.1.2",
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
}
},
"System.Text.Encoding.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
@ -1449,13 +1543,8 @@
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Runtime": "4.3.0",
"System.Threading.Tasks": "4.3.0"
}
"resolved": "4.5.3",
"contentHash": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ=="
},
"System.Threading.Timer": {
"type": "Transitive",
@ -1584,6 +1673,7 @@
"dependencies": {
"Artemis.Core": "1.0.0",
"Avalonia": "0.10.15",
"Avalonia.Diagnostics": "0.10.15",
"Avalonia.ReactiveUI": "0.10.15",
"Avalonia.Xaml.Behaviors": "0.10.14",
"DynamicData": "7.8.6",