mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
UI - Added new icon picker to profile configuration dialog
This commit is contained in:
1 parent
07f8209b7b
commit
ed3a770881
9 files changed
+119
-70
No files matched your search
@@ -8,6 +8,7 @@
|
||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Sidebar"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
xmlns:materialIconPicker="clr-namespace:Artemis.UI.Shared.MaterialIconPicker;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="850"
|
||||
x:Class="Artemis.UI.Screens.Sidebar.ProfileConfigurationEditView"
|
||||
x:DataType="local:ProfileConfigurationEditViewModel"
|
||||
@@ -108,27 +109,12 @@
|
||||
<Border Background="{DynamicResource CheckerboardBrush}" CornerRadius="{DynamicResource CardCornerRadius}" Width="78" Height="78">
|
||||
<avalonia:MaterialIcon Kind="{CompiledBinding SelectedMaterialIcon.Icon}" Width="45" Height="45" />
|
||||
</Border>
|
||||
<ComboBox ItemsSource="{CompiledBinding MaterialIcons}"
|
||||
SelectedItem="{CompiledBinding SelectedMaterialIcon}"
|
||||
VerticalAlignment="Bottom"
|
||||
IsTextSearchEnabled="True"
|
||||
Margin="10 0"
|
||||
Width="250"
|
||||
IsVisible="{CompiledBinding IconType, Converter={StaticResource EnumBoolConverter}, ConverterParameter={x:Static core:ProfileConfigurationIconType.MaterialIcon}}">
|
||||
<ComboBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Width="250"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ComboBox.ItemsPanel>
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="local:ProfileIconViewModel">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<avalonia:MaterialIcon Kind="{CompiledBinding Icon}" Margin="0 0 5 0" />
|
||||
<TextBlock Text="{CompiledBinding DisplayName}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<materialIconPicker:MaterialIconPickerButton
|
||||
Value="{CompiledBinding SelectedMaterialIcon.Icon}"
|
||||
Margin="10 0"
|
||||
Width="250"
|
||||
VerticalAlignment="Bottom"
|
||||
IsVisible="{CompiledBinding IconType, Converter={StaticResource EnumBoolConverter}, ConverterParameter={x:Static core:ProfileConfigurationIconType.MaterialIcon}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox VerticalAlignment="Bottom" IsChecked="{CompiledBinding FadeInAndOut}" ToolTip.Tip="Smoothly animates in and out when the profile activation conditions change.">
|
||||
|
||||
@@ -32,7 +32,6 @@ public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConf
|
||||
private bool _fadeInAndOut;
|
||||
private ProfileConfigurationHotkeyMode _hotkeyMode;
|
||||
private ProfileConfigurationIconType _iconType;
|
||||
private ObservableCollection<ProfileIconViewModel>? _materialIcons;
|
||||
private ProfileConfiguration _profileConfiguration;
|
||||
private string _profileName;
|
||||
private Bitmap? _selectedBitmapSource;
|
||||
@@ -185,13 +184,7 @@ public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConf
|
||||
get => _iconType;
|
||||
set => RaiseAndSetIfChanged(ref _iconType, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<ProfileIconViewModel>? MaterialIcons
|
||||
{
|
||||
get => _materialIcons;
|
||||
set => RaiseAndSetIfChanged(ref _materialIcons, value);
|
||||
}
|
||||
|
||||
|
||||
public ProfileIconViewModel? SelectedMaterialIcon
|
||||
{
|
||||
get => _selectedMaterialIcon;
|
||||
@@ -227,7 +220,6 @@ public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConf
|
||||
SelectedMaterialIcon = !IsNew && Enum.TryParse(_profileConfiguration.Icon.IconName, out MaterialIconKind enumValue)
|
||||
? icons.FirstOrDefault(m => m.Icon == enumValue)
|
||||
: icons.ElementAt(new Random().Next(0, icons.Count - 1));
|
||||
MaterialIcons = icons;
|
||||
}
|
||||
|
||||
private async Task SaveIcon()
|
||||
|
||||
@@ -5,11 +5,20 @@ namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class ProfileIconViewModel : ViewModelBase
|
||||
{
|
||||
private MaterialIconKind _icon;
|
||||
|
||||
public ProfileIconViewModel(MaterialIconKind icon)
|
||||
{
|
||||
Icon = icon;
|
||||
DisplayName = icon.ToString();
|
||||
}
|
||||
|
||||
public MaterialIconKind Icon { get; }
|
||||
public MaterialIconKind Icon
|
||||
{
|
||||
get => _icon;
|
||||
set
|
||||
{
|
||||
RaiseAndSetIfChanged(ref _icon, value);
|
||||
DisplayName = _icon.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user