1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 02:03:32 +00:00

need this elsewhere

This commit is contained in:
SpoinkyNL 2020-09-15 19:39:42 +02:00
parent 1d789bf23c
commit 906efdac98
5 changed files with 161 additions and 167 deletions

View File

@ -131,6 +131,9 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
foreach (var childViewModel in Items) foreach (var childViewModel in Items)
childViewModel.Update(); childViewModel.Update();
if (IsRootGroup)
((DisplayConditionsViewModel) Parent).DisplayStartHint = !Items.Any();
} }
} }
} }

View File

@ -15,20 +15,6 @@
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" /> <converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
</UserControl.Resources> </UserControl.Resources>
<materialDesign:Transitioner AutoApplyTransitionOrigins="True" SelectedIndex="{Binding TransitionerIndex}">
<!-- Conditions intro -->
<materialDesign:ColorZone Mode="PrimaryDark" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="32">
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" TextWrapping="Wrap" TextAlignment="Center" Margin="0 15">Unleash Artemis's true potential</TextBlock>
<TextBlock TextWrapping="Wrap" TextAlignment="Center">Start using conditions to dynamically show and hide groups and layers</TextBlock>
<Button Style="{DynamicResource MaterialDesignFloatingActionAccentButton}" Command="{x:Static materialDesign:Transitioner.MoveNextCommand}" Margin="16">
<materialDesign:PackIcon Kind="ArrowRight" />
</Button>
</StackPanel>
</materialDesign:ColorZone>
<!-- Conditions content -->
<Grid Margin="10"> <Grid Margin="10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -171,5 +157,4 @@
</materialDesign:ColorZone> </materialDesign:ColorZone>
</Grid> </Grid>
</Grid> </Grid>
</materialDesign:Transitioner>
</UserControl> </UserControl>

View File

@ -12,7 +12,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
private readonly IDisplayConditionsVmFactory _displayConditionsVmFactory; private readonly IDisplayConditionsVmFactory _displayConditionsVmFactory;
private readonly IProfileEditorService _profileEditorService; private readonly IProfileEditorService _profileEditorService;
private RenderProfileElement _renderProfileElement; private RenderProfileElement _renderProfileElement;
private int _transitionerIndex; private bool _displayStartHint;
public DisplayConditionsViewModel(IProfileEditorService profileEditorService, IDisplayConditionsVmFactory displayConditionsVmFactory) public DisplayConditionsViewModel(IProfileEditorService profileEditorService, IDisplayConditionsVmFactory displayConditionsVmFactory)
{ {
@ -20,13 +20,12 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
_displayConditionsVmFactory = displayConditionsVmFactory; _displayConditionsVmFactory = displayConditionsVmFactory;
} }
public int TransitionerIndex public bool DisplayStartHint
{ {
get => _transitionerIndex; get => _displayStartHint;
set => SetAndNotify(ref _transitionerIndex, value); set => SetAndNotify(ref _displayStartHint, value);
} }
public RenderProfileElement RenderProfileElement public RenderProfileElement RenderProfileElement
{ {
get => _renderProfileElement; get => _renderProfileElement;
@ -89,8 +88,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
ActiveItem.Update(); ActiveItem.Update();
// Only show the intro to conditions once, and only if the layer has no conditions // Only show the intro to conditions once, and only if the layer has no conditions
if (TransitionerIndex != 1) DisplayStartHint = !ActiveItem.Items.Any();
TransitionerIndex = ActiveItem.Items.Any() ? 1 : 0;
} }
} }
} }

View File

@ -23,9 +23,11 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
protected override void OnActivate() protected override void OnActivate()
{ {
// Take it off the UI thread to avoid freezing on tab change // Take it off the UI thread to avoid freezing on tab change
Task.Run(() => Task.Run(async () =>
{ {
Items.Clear(); Items.Clear();
await Task.Delay(200);
var instances = _surfaceService.ActiveSurface.Devices.Select(d => _settingsVmFactory.CreateDeviceSettingsViewModel(d)).ToList(); var instances = _surfaceService.ActiveSurface.Devices.Select(d => _settingsVmFactory.CreateDeviceSettingsViewModel(d)).ToList();
foreach (var deviceSettingsViewModel in instances) foreach (var deviceSettingsViewModel in instances)
Items.Add(deviceSettingsViewModel); Items.Add(deviceSettingsViewModel);

View File

@ -23,10 +23,16 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
protected override void OnActivate() protected override void OnActivate()
{ {
// Take it off the UI thread to avoid freezing on tab change // Take it off the UI thread to avoid freezing on tab change
Task.Run(async () =>
{
Items.Clear(); Items.Clear();
await Task.Delay(200);
var instances = _pluginService.GetAllPluginInfo().Select(p => _settingsVmFactory.CreatePluginSettingsViewModel(p.Instance)).ToList(); var instances = _pluginService.GetAllPluginInfo().Select(p => _settingsVmFactory.CreatePluginSettingsViewModel(p.Instance)).ToList();
foreach (var pluginSettingsViewModel in instances) foreach (var pluginSettingsViewModel in instances)
Items.Add(pluginSettingsViewModel); Items.Add(pluginSettingsViewModel);
});
} }
} }
} }