Settings UI - Seperated tabs into different VMs

This commit is contained in:
Robert committed 2020-08-19 19:39:34 +02:00
1 parent 8b8fe3a3ec
commit ae9bdecef1
21 files changed
+819 -727

No files matched your search

@@ -0,0 +1,88 @@
<UserControl x:Class="Artemis.UI.Screens.Settings.Tabs.Modules.ModuleOrderTabView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Tabs.Modules"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance local:ModuleOrderTabViewModel}">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid Margin="15" MaxWidth="800">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- Profile editor settings -->
<StackPanel>
<Grid Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}">Overlays</TextBlock>
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignCaptionTextBlock}"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Margin="10 0">
Modules that should always render on top
</TextBlock>
</Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
<StackPanel Margin="15">
<ListBox ItemsSource="{Binding OverlayModules}" DisplayMemberPath="DisplayName"/>
</StackPanel>
</materialDesign:Card>
</StackPanel>
<StackPanel Grid.Row="1">
<Grid Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}">Applications/games</TextBlock>
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignCaptionTextBlock}"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Margin="10 0">
Modules that are related to specific applications or games
</TextBlock>
</Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
<StackPanel Margin="15">
<ListBox ItemsSource="{Binding ApplicationModules}" DisplayMemberPath="DisplayName"/>
</StackPanel>
</materialDesign:Card>
</StackPanel>
<StackPanel Grid.Row="2">
<Grid Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}">Normal</TextBlock>
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignCaptionTextBlock}"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Margin="10 0">
Regular modules that are always active in the background
</TextBlock>
</Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
<StackPanel Margin="15">
<ListBox ItemsSource="{Binding NormalModules}" DisplayMemberPath="DisplayName"/>
</StackPanel>
</materialDesign:Card>
</StackPanel>
</Grid>
</ScrollViewer>
</UserControl>
@@ -0,0 +1,49 @@
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Services.Interfaces;
using Stylet;
namespace Artemis.UI.Screens.Settings.Tabs.Modules
{
public class ModuleOrderTabViewModel : Screen
{
private readonly IPluginService _pluginService;
public ModuleOrderTabViewModel(IPluginService pluginService)
{
DisplayName = "MODULE PRIORITY";
_pluginService = pluginService;
NormalModules = new BindableCollection<Core.Plugins.Abstract.Module>();
ApplicationModules = new BindableCollection<Core.Plugins.Abstract.Module>();
OverlayModules = new BindableCollection<Core.Plugins.Abstract.Module>();
}
public BindableCollection<Core.Plugins.Abstract.Module> NormalModules { get; set; }
public BindableCollection<Core.Plugins.Abstract.Module> ApplicationModules { get; set; }
public BindableCollection<Core.Plugins.Abstract.Module> OverlayModules { get; set; }
protected override void OnActivate()
{
// Take it off the UI thread to avoid freezing on tab change
Task.Run(() =>
{
NormalModules.Clear();
ApplicationModules.Clear();
OverlayModules.Clear();
var instances = _pluginService.GetPluginsOfType<Core.Plugins.Abstract.Module>().ToList();
foreach (var module in instances)
{
if (module.PriorityCategory == ModulePriorityCategory.Normal)
NormalModules.Add(module);
else if (module.PriorityCategory == ModulePriorityCategory.Application)
ApplicationModules.Add(module);
else if (module.PriorityCategory == ModulePriorityCategory.Overlay)
OverlayModules.Add(module);
}
});
}
}
}
@@ -1,123 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.Settings.Tabs.Modules.ModuleOrderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Tabs.Modules"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- Profile editor settings -->
<StackPanel>
<Grid Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}">Overlays</TextBlock>
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignCaptionTextBlock}"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Margin="10 0">
Modules that should always render on top
</TextBlock>
</Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
<StackPanel Margin="15">
<ListBox>
<TextBlock>
Plain
</TextBlock>
<TextBlock>
Old
</TextBlock>
<TextBlock>
ListBox
</TextBlock>
<TextBlock>
Full of junk
</TextBlock>
</ListBox>
</StackPanel>
</materialDesign:Card>
</StackPanel>
<StackPanel Grid.Row="1">
<Grid Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}">Applications/games</TextBlock>
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignCaptionTextBlock}"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Margin="10 0">
Modules that are related to specific applications or games
</TextBlock>
</Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
<StackPanel Margin="15">
<ListBox>
<TextBlock>
Plain
</TextBlock>
<TextBlock>
Old
</TextBlock>
<TextBlock>
ListBox
</TextBlock>
<TextBlock>
Full of junk
</TextBlock>
</ListBox>
</StackPanel>
</materialDesign:Card>
</StackPanel>
<StackPanel Grid.Row="2">
<Grid Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}">Normal</TextBlock>
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignCaptionTextBlock}"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Margin="10 0">
Regular modules that are always active in the background
</TextBlock>
</Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
<StackPanel Margin="15">
<ListBox>
<TextBlock>
Plain
</TextBlock>
<TextBlock>
Old
</TextBlock>
<TextBlock>
ListBox
</TextBlock>
<TextBlock>
Full of junk
</TextBlock>
</ListBox>
</StackPanel>
</materialDesign:Card>
</StackPanel>
</Grid>
</UserControl>
@@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using Stylet;
namespace Artemis.UI.Screens.Settings.Tabs.Modules
{
public class ModuleOrderViewModel : PropertyChangedBase
{
}
}