Added Logitech support (limited to G910 and G403 for now)

Added a splashscreen
This commit is contained in:
SpoinkyNL committed 2019-11-10 17:36:18 +01:00
1 parent fff770326c
commit 39f2920c90
138 files changed
+1417 -64

No files matched your search

+33 -2
View File
@@ -6,7 +6,6 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<s:ApplicationLoader>
<s:ApplicationLoader.Bootstrapper>
@@ -57,7 +56,39 @@
<!-- Some general convertes etc. -->
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<DrawingImage x:Key="BowIcon">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource IdealForegroundColorBrush}"
Geometry="M1518 3378 c-48 -63 -61 -101 -66 -184 -4 -70 -1 -91 27
-170 l31 -89 -27 -20 c-32 -24 -849 -601 -981 -693 l-93 -64 -87 40
c-48 22 -91 37 -95 32 -5 -4 9 -41 29 -83 l37 -75 -28 -24 c-23 -20
-29 -35 -33 -81 l-4 -56 -82 -19 c-109 -25 -109 -41 4 -91 l85 -38 7
-64 c15 -137 90 -1279 85 -1293 -3 -7 -35 -24 -70 -35 -159 -53 -257
-168 -257 -302 0 -35 2 -38 47 -53 54 -18 185 -21 232 -5 29 10 31
14 31 58 0 26 6 56 14 66 13 18 15 18 46 -8 44 -37 78 -35 119 7 l34
35 -17 41 c-9 23 -12 39 -6 35 6 -4 43 -1 83 6 39 6 219 14 398 18
l327 6 113 57 c158 78 256 166 317 282 24 46 27 62 27 152 0 98 -1
103 -41 184 l-42 83 44 69 c24 37 51 68 59 68 9 0 44 -14 78 -32 l62
-31 -93 -44 c-58 -26 -92 -48 -90 -55 9 -27 353 -68 570 -68 108 0
108 0 108 24 0 34 -105 171 -220 286 -122 122 -238 216 -250 204 -6
-6 -1 -42 16 -98 14 -49 23 -91 19 -94 -3 -3 -36 9 -73 27 l-69 33 24
71 c13 39 23 76 23 82 0 6 28 17 63 24 279 58 399 300 314 632 -32
121 -49 155 -134 255 -37 45 -106 126 -152 180 -73 87 -241 326 -241
343 0 3 15 13 32 21 21 10 35 25 40 45 15 60 -16 103 -81 108 -43 3
-39 22 14 74 l45 43 -25 50 c-35 69 -77 114 -130 139 -63 30 -88 27
-117 -11z m215 -835 c188 -279 250 -417 250 -548 0 -133 -74 -214 -243
-265 l-55 -16 -37 -138 c-21 -76 -39 -140 -40 -141 -6 -5 -814 377 -823
390 -6 7 -19 46 -29 86 -10 41 -25 81 -33 91 -8 9 -57 35 -109 59 -52
23 -93 46 -92 51 2 4 233 169 513 366 l510 358 26 -46 c15 -25 88 -136
162 -247z m-1108 -898 c61 21 88 26 107 19 14 -5 204 -92 421 -194 l395
-185 -27 -35 c-15 -19 -53 -72 -84 -117 l-57 -81 30 -90 c39 -117 40
-179 2 -253 -45 -90 -147 -145 -347 -189 -71 -15 -435 -59 -600 -73 l
-29 -2 -37 540 c-20 297 -40 581 -43 632 l-7 92 98 -46 97 -46 81 28z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</ResourceDictionary>
</Application.Resources>
</Application>
+5
View File
@@ -182,6 +182,7 @@
<Compile Include="ViewModels\Dialogs\ConfirmDialogViewModel.cs" />
<Compile Include="ViewModels\Dialogs\SurfaceCreateViewModelValidator.cs" />
<Compile Include="ViewModels\Dialogs\SurfaceCreateViewModel.cs" />
<Compile Include="ViewModels\Screens\SplashViewModel.cs" />
<Compile Include="ViewModels\Utilities\DialogViewModelHost.cs" />
<Compile Include="ViewModels\Dialogs\DialogViewModelBase.cs" />
<Compile Include="ViewModels\Utilities\PanZoomViewModel.cs" />
@@ -235,6 +236,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Screens\SplashView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Screens\SurfaceEditorView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+30 -6
View File
@@ -1,10 +1,12 @@
using System.Windows;
using System.Threading.Tasks;
using System.Windows;
using Artemis.Core.Ninject;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject;
using Artemis.UI.Stylet;
using Artemis.UI.ViewModels.Screens;
using Ninject;
using Stylet;
namespace Artemis.UI
{
@@ -15,11 +17,37 @@ namespace Artemis.UI
protected override void OnExit(ExitEventArgs e)
{
// Stop the Artemis core
_core.Dispose();
_core?.Dispose();
base.OnExit(e);
}
protected override void Launch()
{
var windowManager = (IWindowManager) GetInstance(typeof(IWindowManager));
var splashViewModel = new SplashViewModel(Kernel);
windowManager.ShowWindow(splashViewModel);
Task.Run(() =>
{
// Start the Artemis core
_core = Kernel.Get<ICoreService>();
// When the core is done, hide the splash and show the main window
_core.Initialized += (sender, args) => ShowMainWindow(windowManager, splashViewModel);
// While the core is instantiated, start listening for events on the splash
splashViewModel.ListenToEvents();
});
}
private void ShowMainWindow(IWindowManager windowManager, SplashViewModel splashViewModel)
{
Execute.OnUIThread(() =>
{
windowManager.ShowWindow(RootViewModel);
splashViewModel.RequestClose();
});
}
protected override void ConfigureIoC(IKernel kernel)
{
kernel.Settings.InjectNonPublic = true;
@@ -28,10 +56,6 @@ namespace Artemis.UI
kernel.Load<UIModule>();
// Load the core assembly's module
kernel.Load<CoreModule>();
// Start the Artemis core, the core's constructor will initialize async
_core = Kernel.Get<ICoreService>();
base.ConfigureIoC(kernel);
}
}
+4 -2
View File
@@ -36,7 +36,10 @@ namespace Artemis.UI.Stylet
kernel.Bind<IViewManager>().ToConstant(new ViewManager(viewManagerConfig));
kernel.Bind<IWindowManagerConfig>().ToConstant(this).InTransientScope();
kernel.Bind<IWindowManager>().ToMethod(c => new WindowManager(c.Kernel.Get<IViewManager>(), () => c.Kernel.Get<IMessageBoxViewModel>(), c.Kernel.Get<IWindowManagerConfig>())).InSingletonScope();
kernel.Bind<IWindowManager>().ToMethod(
c => new WindowManager(c.Kernel.Get<IViewManager>(), () => c.Kernel.Get<IMessageBoxViewModel>(), c.Kernel.Get<IWindowManagerConfig>())
)
.InSingletonScope();
kernel.Bind<IEventAggregator>().To<EventAggregator>().InSingletonScope();
kernel.Bind<IMessageBoxViewModel>().To<MessageBoxViewModel>(); // Not singleton!
}
@@ -55,7 +58,6 @@ namespace Artemis.UI.Stylet
protected override void Launch()
{
DisplayRootView(RootViewModel);
}
public override void Dispose()
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Artemis.Core.Services.Interfaces;
using Ninject;
using Stylet;
namespace Artemis.UI.ViewModels.Screens
{
public class SplashViewModel : Screen
{
private readonly IKernel _kernel;
public SplashViewModel(IKernel kernel)
{
_kernel = kernel;
Status = "Initializing Core";
}
public string Status { get; set; }
public void ListenToEvents()
{
var pluginService = _kernel.Get<IPluginService>();
pluginService.CopyingBuildInPlugins += (sender, args) => Status = "Updating built-in plugins";
pluginService.PluginLoading += (sender, args) => Status = "Loading plugin: " + args.PluginInfo.Name;
}
}
}
+1 -35
View File
@@ -16,40 +16,6 @@
d:DesignWidth="1113.251"
d:DataContext="{d:DesignInstance screens:RootViewModel}"
Icon="/Artemis.UI;component/Resources/logo-512.png">
<metro:MetroWindow.Resources>
<DrawingImage x:Key="BowIcon">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource IdealForegroundColorBrush}"
Geometry="M1518 3378 c-48 -63 -61 -101 -66 -184 -4 -70 -1 -91 27
-170 l31 -89 -27 -20 c-32 -24 -849 -601 -981 -693 l-93 -64 -87 40
c-48 22 -91 37 -95 32 -5 -4 9 -41 29 -83 l37 -75 -28 -24 c-23 -20
-29 -35 -33 -81 l-4 -56 -82 -19 c-109 -25 -109 -41 4 -91 l85 -38 7
-64 c15 -137 90 -1279 85 -1293 -3 -7 -35 -24 -70 -35 -159 -53 -257
-168 -257 -302 0 -35 2 -38 47 -53 54 -18 185 -21 232 -5 29 10 31
14 31 58 0 26 6 56 14 66 13 18 15 18 46 -8 44 -37 78 -35 119 7 l34
35 -17 41 c-9 23 -12 39 -6 35 6 -4 43 -1 83 6 39 6 219 14 398 18
l327 6 113 57 c158 78 256 166 317 282 24 46 27 62 27 152 0 98 -1
103 -41 184 l-42 83 44 69 c24 37 51 68 59 68 9 0 44 -14 78 -32 l62
-31 -93 -44 c-58 -26 -92 -48 -90 -55 9 -27 353 -68 570 -68 108 0
108 0 108 24 0 34 -105 171 -220 286 -122 122 -238 216 -250 204 -6
-6 -1 -42 16 -98 14 -49 23 -91 19 -94 -3 -3 -36 9 -73 27 l-69 33 24
71 c13 39 23 76 23 82 0 6 28 17 63 24 279 58 399 300 314 632 -32
121 -49 155 -134 255 -37 45 -106 126 -152 180 -73 87 -241 326 -241
343 0 3 15 13 32 21 21 10 35 25 40 45 15 60 -16 103 -81 108 -43 3
-39 22 14 74 l45 43 -25 50 c-35 69 -77 114 -130 139 -63 30 -88 27
-117 -11z m215 -835 c188 -279 250 -417 250 -548 0 -133 -74 -214 -243
-265 l-55 -16 -37 -138 c-21 -76 -39 -140 -40 -141 -6 -5 -814 377 -823
390 -6 7 -19 46 -29 86 -10 41 -25 81 -33 91 -8 9 -57 35 -109 59 -52
23 -93 46 -92 51 2 4 233 169 513 366 l510 358 26 -46 c15 -25 88 -136
162 -247z m-1108 -898 c61 21 88 26 107 19 14 -5 204 -92 421 -194 l395
-185 -27 -35 c-15 -19 -53 -72 -84 -117 l-57 -81 30 -90 c39 -117 40
-179 2 -253 -45 -90 -147 -145 -347 -189 -71 -15 -435 -59 -600 -73 l
-29 -2 -37 540 c-20 297 -40 581 -43 632 l-7 92 98 -46 97 -46 81 28z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</metro:MetroWindow.Resources>
<metro:MetroWindow.LeftWindowCommands>
<metro:WindowCommands>
<!-- Make the window title dissapear by providing an empty overwrite of WindowCommands -->
@@ -62,7 +28,7 @@
Background="Transparent"
RenderOptions.BitmapScalingMode="HighQuality"
Margin="0,0,-10,0">
<Image Source="{DynamicResource BowIcon}"
<Image Source="{StaticResource BowIcon}"
Stretch="Uniform"
Margin="6" />
</Grid>
@@ -0,0 +1,34 @@
<mah:MetroWindow x:Class="Artemis.UI.Views.Screens.SplashView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Artemis.UI.Views.Screens"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:screens="clr-namespace:Artemis.UI.ViewModels.Screens"
mc:Ignorable="d"
Title="Artemis"
Height="450"
Width="450"
ShowTitleBar="False"
ShowMaxRestoreButton="False"
ShowCloseButton="False"
ShowMinButton="False"
WindowStartupLocation="CenterScreen"
GlowBrush="{DynamicResource AccentColorBrush}"
FontFamily="{StaticResource DefaultFont}"
d:DataContext="{d:DesignInstance screens:SplashViewModel}">
<Grid Background="{DynamicResource PrimaryHueMidBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition Height="50" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Image Source="{StaticResource BowIcon}" Stretch="Uniform" Margin="6,50,6,6" />
<TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Foreground="White" FontSize="16">Artemis is initializing...</TextBlock>
<TextBlock Grid.Row="2" HorizontalAlignment="Center" Foreground="#FFDDDDDD" Text="{Binding Status}"/>
<ProgressBar Grid.Row="3" IsIndeterminate="True" Maximum="1" Minimum="1" Margin="16 0"/>
</Grid>
</mah:MetroWindow>