mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Core - Added missing property changed calls in ProfileConfiguration
Sidebar - Added suspended status indicators
This commit is contained in:
1 parent
7667cc5473
commit
5873df250d
9 files changed
+518
-130
No files matched your search
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user