From e012721a8ee24540e3a0a71190c773e44835bad9 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Mon, 22 Feb 2016 10:16:21 +0100 Subject: [PATCH] Project cleanup, welcome page --- Artemis/Artemis/App.config | 51 ++++++++++++++----- Artemis/Artemis/App.xaml | 3 +- Artemis/Artemis/Artemis.csproj | 8 +++ Artemis/Artemis/Events/ToggleEnabled.cs | 4 +- .../KeyboardProviders/Corsair/CorsairRGB.cs | 3 +- .../KeyboardProviders/ProviderHelper.cs | 1 - .../AudioVisualizer/AudioVisualizerModel.cs | 2 +- .../AudioVisualizer/AudioVisualizerView.xaml | 2 +- .../Modules/Effects/TypeWave/TypeWaveModel.cs | 2 +- Artemis/Artemis/Settings/General.settings | 4 +- .../Artemis/Utilities/Memory/MemoryHelpers.cs | 4 +- Artemis/Artemis/Utilities/ShellLink.cs | 4 +- Artemis/Artemis/ViewModels/ShellViewModel.cs | 5 ++ .../Artemis/ViewModels/SystemTrayViewModel.cs | 5 +- .../Artemis/ViewModels/WelcomeViewModel.cs | 13 +++++ .../Views/Flyouts/FlyoutSettingsView.xaml | 9 ++-- Artemis/Artemis/Views/SystemTrayView.xaml | 24 ++++----- Artemis/Artemis/Views/SystemTrayView.xaml.cs | 3 +- Artemis/Artemis/Views/WelcomeView.xaml | 50 ++++++++++++++++++ Artemis/Artemis/Views/WelcomeView.xaml.cs | 22 ++++++++ Artemis/Artemis/packages.config | 1 + 21 files changed, 173 insertions(+), 47 deletions(-) create mode 100644 Artemis/Artemis/ViewModels/WelcomeViewModel.cs create mode 100644 Artemis/Artemis/Views/WelcomeView.xaml create mode 100644 Artemis/Artemis/Views/WelcomeView.xaml.cs diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config index 366d5c12d..4f3f4dc8c 100644 --- a/Artemis/Artemis/App.config +++ b/Artemis/Artemis/App.config @@ -2,19 +2,44 @@ - -
-
-
-
-
-
-
-
-
-
-
-
+ +
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Artemis/Artemis/App.xaml b/Artemis/Artemis/App.xaml index a2126df67..d19aed2d9 100644 --- a/Artemis/Artemis/App.xaml +++ b/Artemis/Artemis/App.xaml @@ -16,7 +16,8 @@ - + diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj index 73d25903c..7c1a95602 100644 --- a/Artemis/Artemis/Artemis.csproj +++ b/Artemis/Artemis/Artemis.csproj @@ -338,6 +338,7 @@ + EffectsView.xaml @@ -383,6 +384,9 @@ SystemTrayView.xaml + + WelcomeView.xaml + @@ -502,6 +506,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/Artemis/Artemis/Events/ToggleEnabled.cs b/Artemis/Artemis/Events/ToggleEnabled.cs index 014575e6b..00112d7f3 100644 --- a/Artemis/Artemis/Events/ToggleEnabled.cs +++ b/Artemis/Artemis/Events/ToggleEnabled.cs @@ -2,11 +2,11 @@ { public class ToggleEnabled { - public bool Enabled { get; set; } - public ToggleEnabled(bool enabled) { Enabled = enabled; } + + public bool Enabled { get; set; } } } \ No newline at end of file diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs b/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs index cdc207732..6aa6b53d0 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs @@ -2,7 +2,6 @@ using System.Threading; using Artemis.Utilities; using CUE.NET; -using CUE.NET.Brushes; using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Keyboard; using CUE.NET.Exceptions; @@ -23,7 +22,7 @@ namespace Artemis.KeyboardProviders.Corsair public override bool CanEnable() { - // Try for about 10 seconds + // Try for about 10 seconds, in case CUE isn't started yet var tries = 0; while (tries < 9) { diff --git a/Artemis/Artemis/KeyboardProviders/ProviderHelper.cs b/Artemis/Artemis/KeyboardProviders/ProviderHelper.cs index 10bfa713b..966f403d0 100644 --- a/Artemis/Artemis/KeyboardProviders/ProviderHelper.cs +++ b/Artemis/Artemis/KeyboardProviders/ProviderHelper.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using Artemis.KeyboardProviders.Corsair; using Artemis.KeyboardProviders.Logitech; -using Artemis.KeyboardProviders.Razer; namespace Artemis.KeyboardProviders { diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs index 8cd1329f4..c1fd4626a 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs @@ -69,7 +69,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer ColorHelpers.ToDrawingColor(Settings.MiddleColor), ColorHelpers.ToDrawingColor(Settings.BottomColor) }, - LinearGradientMode.Vertical) {ContainedBrush = false}); + LinearGradientMode.Vertical) {ContainedBrush = false, Height = 0}); } _sampleAggregator.FftCalculated += FftCalculated; diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml index 942e68fe2..03ecaa8f8 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml @@ -79,7 +79,7 @@ + Margin="0,0,-5,0" Width="114" IsEnabled="False" /> - + + diff --git a/Artemis/Artemis/Utilities/Memory/MemoryHelpers.cs b/Artemis/Artemis/Utilities/Memory/MemoryHelpers.cs index 0fb6d7b97..a8fc3ff8e 100644 --- a/Artemis/Artemis/Utilities/Memory/MemoryHelpers.cs +++ b/Artemis/Artemis/Utilities/Memory/MemoryHelpers.cs @@ -54,7 +54,9 @@ namespace Artemis.Utilities.Memory var jsonClient = new WebClient(); // Random number to get around cache issues var rand = new Random(DateTime.Now.Millisecond); - var json = jsonClient.DownloadString("https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next()); + var json = + jsonClient.DownloadString( + "https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next()); // Get a list of pointers var pointers = JsonConvert.DeserializeObject>(json); diff --git a/Artemis/Artemis/Utilities/ShellLink.cs b/Artemis/Artemis/Utilities/ShellLink.cs index 914bc33fe..7e3996986 100644 --- a/Artemis/Artemis/Utilities/ShellLink.cs +++ b/Artemis/Artemis/Utilities/ShellLink.cs @@ -5,8 +5,8 @@ using System.Text; namespace Artemis.Utilities { /// - /// Creates a shortcut (.lnk) file. - /// Source: http://stackoverflow.com/a/14632782/5015269 + /// Creates a shortcut (.lnk) file. + /// Source: http://stackoverflow.com/a/14632782/5015269 /// [ComImport] [Guid("00021401-0000-0000-C000-000000000046")] diff --git a/Artemis/Artemis/ViewModels/ShellViewModel.cs b/Artemis/Artemis/ViewModels/ShellViewModel.cs index bbbc85191..fbf978e71 100644 --- a/Artemis/Artemis/ViewModels/ShellViewModel.cs +++ b/Artemis/Artemis/ViewModels/ShellViewModel.cs @@ -12,6 +12,7 @@ namespace Artemis.ViewModels private readonly EffectsViewModel _effectsVm; private readonly GamesViewModel _gamesVm; private readonly OverlaysViewModel _overlaysVm; + private readonly WelcomeViewModel _welcomeVm; public ShellViewModel() { @@ -19,6 +20,7 @@ namespace Artemis.ViewModels MainModel = new MainModel(events); DisplayName = "Artemis"; + _welcomeVm = new WelcomeViewModel {DisplayName = "Welcome"}; _effectsVm = new EffectsViewModel(MainModel) {DisplayName = "Effects"}; _gamesVm = new GamesViewModel(MainModel) {DisplayName = "Games"}; _overlaysVm = new OverlaysViewModel(MainModel) {DisplayName = "Overlays"}; @@ -35,9 +37,12 @@ namespace Artemis.ViewModels { base.OnActivate(); + ActivateItem(_welcomeVm); ActivateItem(_effectsVm); ActivateItem(_gamesVm); ActivateItem(_overlaysVm); + + ActiveItem = _welcomeVm; } public void OnClose(EventArgs e) diff --git a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs index 8bbca0bd5..a1b4c6289 100644 --- a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs +++ b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs @@ -1,6 +1,5 @@ using System.Windows; using Artemis.Events; -using Artemis.Settings; using Caliburn.Micro; namespace Artemis.ViewModels @@ -26,8 +25,8 @@ namespace Artemis.ViewModels _windowManager = windowManager; _shellViewModel = shellViewModel; _shellViewModel.MainModel.Events.Subscribe(this); - - /* + + /* * By now Effects are added to the MainModel so we can savely start * This is done from here to make sure all UI elements listening to * events will receive the first ToggleEnabled event diff --git a/Artemis/Artemis/ViewModels/WelcomeViewModel.cs b/Artemis/Artemis/ViewModels/WelcomeViewModel.cs new file mode 100644 index 000000000..8000adf27 --- /dev/null +++ b/Artemis/Artemis/ViewModels/WelcomeViewModel.cs @@ -0,0 +1,13 @@ +using System.Diagnostics; +using Caliburn.Micro; + +namespace Artemis.ViewModels +{ + public class WelcomeViewModel : Screen + { + public void NavigateTo(string url) + { + Process.Start(new ProcessStartInfo(url)); + } + } +} \ No newline at end of file diff --git a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml index 5639142d5..f7a988923 100644 --- a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml +++ b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml @@ -33,7 +33,7 @@ + cal:Message.Attach="[Event Unchecked] = [Action ToggleEnabled]; [Event Checked] = [Action ToggleEnabled]" />