Further expanded plugins

Added navigation between modules
This commit is contained in:
SpoinkyNL committed 2018-02-25 19:48:22 +01:00
1 parent 7773d377a2
commit 6a8edfc00a
21 files changed
+1193 -163

No files matched your search

+12 -9
View File
@@ -39,11 +39,14 @@
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
</Reference>
<Reference Include="HidSharp, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HidSharp.1.5\lib\net35\HidSharp.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
<Reference Include="MahApps.Metro, Version=1.6.0.362, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.0\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignColors, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll</HintPath>
@@ -63,8 +66,8 @@
<Reference Include="Ninject.Extensions.Factory, Version=3.3.2.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath>
</Reference>
<Reference Include="PropertyChanged, Version=2.2.4.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\packages\PropertyChanged.Fody.2.2.4.0\lib\net452\PropertyChanged.dll</HintPath>
<Reference Include="PropertyChanged, Version=2.2.6.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\packages\PropertyChanged.Fody.2.2.6\lib\net452\PropertyChanged.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Brushes, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Brushes.0.0.1.26\lib\net45\RGB.NET.Brushes.dll</HintPath>
@@ -99,8 +102,8 @@
<Reference Include="RGB.NET.Groups, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Groups.0.0.1.26\lib\net45\RGB.NET.Groups.dll</HintPath>
</Reference>
<Reference Include="Sanford.Multimedia.Midi, Version=6.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sanford.Multimedia.Midi.6.4.1\lib\net20\Sanford.Multimedia.Midi.dll</HintPath>
<Reference Include="Sanford.Multimedia.Midi, Version=6.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sanford.Multimedia.Midi.6.6.0\lib\net20\Sanford.Multimedia.Midi.dll</HintPath>
</Reference>
<Reference Include="Stylet, Version=1.1.21.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Stylet.1.1.21\lib\net45\Stylet.dll</HintPath>
@@ -113,7 +116,7 @@
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@@ -235,18 +238,17 @@
<Resource Include="FodyWeavers.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.2.3.17\build\net452\Fody.targets" Condition="Exists('..\packages\Fody.2.3.17\build\net452\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.2.3.17\build\net452\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.3.17\build\net452\Fody.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.26\build\net45\RGB.NET.Devices.Asus.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Asus.0.0.1.26\build\net45\RGB.NET.Devices.Asus.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.26\build\net45\RGB.NET.Devices.CoolerMaster.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.26\build\net45\RGB.NET.Devices.CoolerMaster.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.26\build\net45\RGB.NET.Devices.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Corsair.0.0.1.26\build\net45\RGB.NET.Devices.Corsair.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.26\build\net45\RGB.NET.Devices.Logitech.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Logitech.0.0.1.26\build\net45\RGB.NET.Devices.Logitech.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.26\build\net45\RGB.NET.Devices.Msi.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Msi.0.0.1.26\build\net45\RGB.NET.Devices.Msi.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.26\build\net45\RGB.NET.Devices.Razer.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Razer.0.0.1.26\build\net45\RGB.NET.Devices.Razer.targets'))" />
<Error Condition="!Exists('..\packages\Fody.2.4.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.4.2\build\Fody.targets'))" />
</Target>
<Import Project="..\packages\RGB.NET.Devices.Asus.0.0.1.26\build\net45\RGB.NET.Devices.Asus.targets" Condition="Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.26\build\net45\RGB.NET.Devices.Asus.targets')" />
<Import Project="..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.26\build\net45\RGB.NET.Devices.CoolerMaster.targets" Condition="Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.26\build\net45\RGB.NET.Devices.CoolerMaster.targets')" />
@@ -254,4 +256,5 @@
<Import Project="..\packages\RGB.NET.Devices.Logitech.0.0.1.26\build\net45\RGB.NET.Devices.Logitech.targets" Condition="Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.26\build\net45\RGB.NET.Devices.Logitech.targets')" />
<Import Project="..\packages\RGB.NET.Devices.Msi.0.0.1.26\build\net45\RGB.NET.Devices.Msi.targets" Condition="Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.26\build\net45\RGB.NET.Devices.Msi.targets')" />
<Import Project="..\packages\RGB.NET.Devices.Razer.0.0.1.26\build\net45\RGB.NET.Devices.Razer.targets" Condition="Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.26\build\net45\RGB.NET.Devices.Razer.targets')" />
<Import Project="..\packages\Fody.2.4.2\build\Fody.targets" Condition="Exists('..\packages\Fody.2.4.2\build\Fody.targets')" />
</Project>
+2 -2
View File
@@ -14,7 +14,7 @@ namespace Artemis.UI.Stylet
public override UIElement CreateViewForModel(object model)
{
if (model is IPluginViewModel)
if (model is IModuleViewModel)
return CreateViewForPlugin(model);
return base.CreateViewForModel(model);
@@ -22,7 +22,7 @@ namespace Artemis.UI.Stylet
private UIElement CreateViewForPlugin(object model)
{
var pluginInfo = ((IPluginViewModel) model).PluginInfo;
var pluginInfo = ((IModuleViewModel) model).PluginInfo;
var viewPath = pluginInfo.Folder + pluginInfo.ViewModel.Replace("ViewModel", "View").Replace(".cs", ".xaml");
// There doesn't have to be a view so make sure one exists
if (!File.Exists(viewPath))
+53 -25
View File
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Controls;
using Artemis.Core.Services.Interfaces;
using Artemis.Plugins.Interfaces;
using Artemis.Plugins.Models;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.ViewModels.Interfaces;
using Stylet;
@@ -19,7 +21,7 @@ namespace Artemis.UI.ViewModels
{
_artemisViewModels = artemisViewModels;
_pluginService = pluginService;
// Add the built-in items
Items.AddRange(artemisViewModels);
// Activate the home item
@@ -33,52 +35,78 @@ namespace Artemis.UI.ViewModels
if (!LoadingPlugins)
Modules.AddRange(_pluginService.Plugins.Where(p => p.Plugin is IModule));
PropertyChanged += OnSelectedModuleChanged;
PropertyChanged += OnSelectedPageChanged;
}
public IObservableCollection<PluginInfo> Modules { get; set; }
public bool MenuOpen { get; set; }
public bool LoadingPlugins { get; set; }
public ListBoxItem SelectedPage { get; set; }
public PluginInfo SelectedModule { get; set; }
private void PluginServiceOnStartedLoadingPlugins(object sender, EventArgs eventArgs)
{
LoadingPlugins = true;
Modules.Clear();
SelectedModule = null;
}
private void PluginServiceOnFinishedLoadedPlugins(object sender, EventArgs eventArgs)
{
LoadingPlugins = false;
Modules.AddRange(_pluginService.Plugins.Where(p => p.Plugin is IModule));
NavigateToModule(Modules.First());
SelectedModule = null;
LoadingPlugins = false;
}
public void NavigateToHome()
public async Task NavigateToSelectedModule()
{
ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(HomeViewModel)));
MenuOpen = false;
}
if (SelectedModule == null || LoadingPlugins)
return;
public void NavigateToNews()
{
}
public void NavigateToWorkshop()
{
}
public void NavigateToSettings()
{
ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(SettingsViewModel)));
MenuOpen = false;
}
public async void NavigateToModule(PluginInfo pluginInfo)
{
// Create a view model for the given plugin info (which will be a module)
var viewModel = await _pluginService.GetPluginViewModel(pluginInfo);
var viewModel = await _pluginService.GetModuleViewModel(SelectedModule);
// Tell Stylet to active the view model, the view manager will compile and show the XAML
ActivateItem(viewModel);
SelectedPage = null;
MenuOpen = false;
}
private async void OnSelectedModuleChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "SelectedModule")
await NavigateToSelectedModule();
}
private void OnSelectedPageChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != "SelectedPage" || SelectedPage == null)
return;
switch (SelectedPage.Name)
{
case "Home":
ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(HomeViewModel)));
break;
case "News":
// ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(NewsViewModel)));
break;
case "Workshop":
// ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(WorkshopViewModel)));
break;
case "Settings":
ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(SettingsViewModel)));
break;
}
SelectedModule = null;
MenuOpen = false;
}
}
}
+1 -28
View File
@@ -1,37 +1,10 @@
using System.Linq;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.ViewModels.Interfaces;
using RGB.NET.Core;
using Artemis.UI.ViewModels.Interfaces;
using Stylet;
namespace Artemis.UI.ViewModels
{
public class SettingsViewModel : Screen, ISettingsViewModel
{
private readonly IRgbService _rgbService;
public SettingsViewModel(IRgbService rgbService)
{
_rgbService = rgbService;
_rgbService.FinishedLoadedDevices += (sender, args) => SetTestDevice();
}
protected override void OnActivate()
{
SetTestDevice();
base.OnActivate();
}
private void SetTestDevice()
{
if (!IsActive)
return;
if (!_rgbService.LoadingDevices)
TestDevice = _rgbService.Surface.Devices.FirstOrDefault(d => d.DeviceInfo.DeviceType == RGBDeviceType.Keyboard);
}
public IRGBDevice TestDevice { get; set; }
public string Title => "Settings";
}
}
+23 -37
View File
@@ -7,6 +7,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:vms="clr-namespace:Artemis.UI.ViewModels"
xmlns:models="clr-namespace:Artemis.Plugins.Models;assembly=Artemis.Plugins"
mc:Ignorable="d"
GlowBrush="{DynamicResource AccentColorBrush}"
FontFamily="{StaticResource DefaultFont}"
@@ -80,29 +81,30 @@
<!-- Built-in pages -->
<ListBox Margin="0 16 0 16"
SelectedIndex="0"
DockPanel.Dock="Top">
<ListBoxItem PreviewMouseLeftButtonUp="{s:Action NavigateToHome}">
DockPanel.Dock="Top"
SelectedItem="{Binding SelectedPage}">
<ListBoxItem x:Name="Home">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Home"
Margin="0,0,8,0" />
<TextBlock>Home</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem PreviewMouseLeftButtonUp="{s:Action NavigateToNews}">
<ListBoxItem x:Name="News">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Newspaper"
Margin="0,0,8,0" />
<TextBlock>News</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem PreviewMouseLeftButtonUp="{s:Action NavigateToWorkshop}">
<ListBoxItem x:Name="Workshop">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="TestTube"
Margin="0,0,8,0" />
<TextBlock>Workshop</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem PreviewMouseLeftButtonUp="{s:Action NavigateToSettings}">
<ListBoxItem x:Name="Settings">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Settings"
Margin="0,0,8,0" />
@@ -118,39 +120,23 @@
</TextBlock>
<Border BorderThickness="0 1 0 0"
BorderBrush="{DynamicResource MaterialDesignDivider}">
<ScrollViewer DockPanel.Dock="Top">
<ListBox Margin="0 0 0 16"
SelectedIndex="0">
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<ListBox Margin="0 0 0 16"
SelectedIndex="0"
ItemsSource="{Binding Modules}"
SelectedItem="{Binding SelectedModule}"
DockPanel.Dock="Top">
<ListBox.ItemTemplate>
<DataTemplate DataType="models:PluginInfo">
<DockPanel HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="0">
<materialDesign:PackIcon Kind="Home"
Margin="0,0,8,0" />
<TextBlock>Home</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Newspaper"
Margin="0,0,8,0" />
<TextBlock>News</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="TestTube"
Margin="0,0,8,0" />
<TextBlock>Workshop</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Settings"
Margin="0,0,8,0" />
<TextBlock>Settings</TextBlock>
</StackPanel>
</ListBoxItem>
</ListBox>
</ScrollViewer>
<TextBlock Text="{Binding Name}" />
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</DockPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
@@ -185,4 +171,4 @@
</DockPanel>
</materialDesign:DrawerHost>
</materialDesign:DialogHost>
</metro:MetroWindow>
</metro:MetroWindow>
+19 -6
View File
@@ -3,11 +3,24 @@
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.Views"
xmlns:visualizers="clr-namespace:Artemis.UI.Controls.Visualizers"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<visualizers:RGBSurfaceVisualizer></visualizers:RGBSurfaceVisualizer>
</Grid>
d:DesignHeight="600" d:DesignWidth="600">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel Margin="16">
<TextBlock Style="{StaticResource MaterialDesignDisplay1TextBlock}">General</TextBlock>
<Grid>
<TextBlock>General settings like start up with Windows etc.</TextBlock>
</Grid>
<TextBlock Style="{StaticResource MaterialDesignDisplay1TextBlock}">Plugins</TextBlock>
<Grid>
<TextBlock>A list of plugins and options to disable them</TextBlock>
</Grid>
</StackPanel>
</UserControl>
+5 -4
View File
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.2.1" targetFramework="net461" />
<package id="Fody" version="2.3.17" targetFramework="net461" developmentDependency="true" />
<package id="ControlzEx" version="3.0.2.4" targetFramework="net461" />
<package id="Fody" version="2.4.2" targetFramework="net461" developmentDependency="true" />
<package id="HidSharp" version="1.5" targetFramework="net461" />
<package id="MahApps.Metro" version="1.5.0" targetFramework="net461" />
<package id="MahApps.Metro" version="1.6.0" targetFramework="net461" />
<package id="MaterialDesignColors" version="1.1.3" targetFramework="net461" />
<package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net461" />
<package id="MaterialDesignThemes.MahApps" version="0.0.11" targetFramework="net461" />
<package id="Ninject" version="3.3.4" targetFramework="net461" />
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net461" />
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net461" />
<package id="PropertyChanged.Fody" version="2.2.4.0" targetFramework="net461" developmentDependency="true" />
<package id="PropertyChanged.Fody" version="2.2.6" targetFramework="net461" developmentDependency="true" />
<package id="RGB.NET" version="0.0.1.26" targetFramework="net461" />
<package id="RGB.NET.Brushes" version="0.0.1.26" targetFramework="net461" />
<package id="RGB.NET.Core" version="0.0.1.26" targetFramework="net461" />
@@ -25,7 +26,7 @@
<package id="RGB.NET.Devices.Razer" version="0.0.1.26" targetFramework="net461" />
<package id="RGB.NET.Groups" version="0.0.1.26" targetFramework="net461" />
<package id="RGB.NET.Presets" version="0.0.1.26" targetFramework="net461" />
<package id="Sanford.Multimedia.Midi" version="6.4.1" targetFramework="net461" />
<package id="Sanford.Multimedia.Midi" version="6.6.0" targetFramework="net461" />
<package id="Stylet" version="1.1.21" targetFramework="net461" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
</packages>