diff --git a/CTA/CustomTeamAssigner/MainWindow.xaml b/CTA/CustomTeamAssigner/MainWindow.xaml index d8aae77c6..e4c703a61 100644 --- a/CTA/CustomTeamAssigner/MainWindow.xaml +++ b/CTA/CustomTeamAssigner/MainWindow.xaml @@ -11,6 +11,7 @@ README file in the root directory of this source tree. 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:svgc="http://sharpvectors.codeplex.com/svgc/" mc:Ignorable="d" Title="EHR Control Panel" Height="720" Width="1280" FontSize="20" MinHeight="640" MinWidth="1024" WindowStartupLocation="CenterScreen" Background="#1C1C1C"> @@ -123,7 +124,7 @@ README file in the root directory of this source tree. - + @@ -132,7 +133,7 @@ README file in the root directory of this source tree. - + @@ -144,7 +145,7 @@ README file in the root directory of this source tree. - + @@ -154,7 +155,7 @@ README file in the root directory of this source tree. - + @@ -164,11 +165,9 @@ README file in the root directory of this source tree. - + - - diff --git a/CTA/CustomTeamAssigner/MainWindow.xaml.cs b/CTA/CustomTeamAssigner/MainWindow.xaml.cs index 28dd42259..3641b9b67 100644 --- a/CTA/CustomTeamAssigner/MainWindow.xaml.cs +++ b/CTA/CustomTeamAssigner/MainWindow.xaml.cs @@ -1,11 +1,6 @@ -using System.Diagnostics.CodeAnalysis; -using Microsoft.Win32; +using Microsoft.Win32; using System.IO; using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using SharpVectors.Converters; -using SharpVectors.Renderers.Wpf; /* * Copyright (c) 2024, Gurge44 @@ -17,107 +12,16 @@ using SharpVectors.Renderers.Wpf; namespace CustomTeamAssigner { - public partial class MainWindow : Window + public partial class MainWindow { public static MainWindow Instance { get; private set; } = null!; - private static readonly List<(string FileName, DrawingImage Image)> SVGs = []; - public MainWindow() { InitializeComponent(); Instance = this; - LoadSvgImages(); } - - void LoadSvgImages() - { - int doneIndex = 0; - var fileReader = new FileSvgReader(new()); - var files = Directory.GetFiles("Resources", "*.svg"); - files.Do(LoadImage); - LoadingLabel.Visibility = Visibility.Collapsed; - return; - - void LoadImage(string file) - { - var drawing = fileReader.Read(file); - var image = new DrawingImage(drawing); - var fileName = Path.GetFileNameWithoutExtension(file); - SVGs.Add((fileName, image)); - - ApplyImage(fileName, image); - - doneIndex++; - LoadingLabel.Content = $"Loading images.... ({doneIndex}/{files.Length})"; - } - } - - public static void ApplyAllImages() - { - foreach (var tuple in SVGs) - { - var fileName = tuple.FileName; - var image = tuple.Image; - - ApplyImage(fileName, image); - } - } - - [SuppressMessage("ReSharper", "ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract")] - private static void ApplyImage(string fileName, DrawingImage image) - { - switch (fileName) - { - case "add": - Instance.AddButtonImage.Source = image; - if (PlaySetListerPage.Instance != null) PlaySetListerPage.Instance.AddButtonImage.Source = image; - break; - case "back": - if (PlaySetListerPage.Instance != null) PlaySetListerPage.Instance.BackButtonImage.Source = image; - if (QMQuestions.Instance != null) QMQuestions.Instance.BackButtonImage.Source = image; - if (RichTextEditor.Instance != null) RichTextEditor.Instance.BackButtonImage.Source = image; - if (RoleDescFinder.Instance != null) RoleDescFinder.Instance.BackButtonImage.Source = image; - break; - case "copy": - if (QMQuestions.Instance != null) QMQuestions.Instance.CopyButtonImage.Source = image; - break; - case "delete": - if (PlaySetListerPage.Instance != null) PlaySetListerPage.Instance.DeleteButtonImage.Source = image; - if (TeamEditorPage.Instance != null) TeamEditorPage.Instance.DeleteButtonImage.Source = image; - break; - case "discard": - if (TeamEditorPage.Instance != null) TeamEditorPage.Instance.DiscardButtonImage.Source = image; - break; - case "edit": - if (PlaySetListerPage.Instance != null) PlaySetListerPage.Instance.EditButtonImage.Source = image; - break; - case "import": - Instance.ImportButtonImage.Source = image; - break; - case "new-file": - if (QMQuestions.Instance != null) QMQuestions.Instance.NewFileButtonImage.Source = image; - break; - case "question": - Instance.QuestionButtonImage.Source = image; - break; - case "save": - if (TeamEditorPage.Instance != null) TeamEditorPage.Instance.SaveButtonImage.Source = image; - break; - case "save-as": - if (PlaySetListerPage.Instance != null) PlaySetListerPage.Instance.SaveAsButtonImage.Source = image; - if (QMQuestions.Instance != null) QMQuestions.Instance.SaveAsButtonImage.Source = image; - break; - case "search": - Instance.SearchButtonImage.Source = image; - if (RoleDescFinder.Instance != null) RoleDescFinder.Instance.SearchButtonImage.Source = image; - break; - case "template": - Instance.TemplateButtonImage.Source = image; - break; - } - } - + void ImportPlaySet(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new() @@ -133,7 +37,6 @@ namespace CustomTeamAssigner Navigator.NavigationService.Navigate(new PlaySetListerPage()); Utils.SetMainWindowContents(Visibility.Collapsed); - ApplyAllImages(); } } @@ -142,28 +45,24 @@ namespace CustomTeamAssigner Utils.Teams.Clear(); Navigator.NavigationService.Navigate(new PlaySetListerPage()); Utils.SetMainWindowContents(Visibility.Collapsed); - ApplyAllImages(); } private void QMQuestionsClick(object sender, RoutedEventArgs e) { Utils.SetMainWindowContents(Visibility.Collapsed); Navigator.NavigationService.Navigate(new QMQuestions()); - ApplyAllImages(); } private void OpenRoleDescFinder(object sender, RoutedEventArgs e) { Utils.SetMainWindowContents(Visibility.Collapsed); Navigator.NavigationService.Navigate(new RoleDescFinder()); - ApplyAllImages(); } private void OpenTemplateCreator(object sender, RoutedEventArgs e) { Utils.SetMainWindowContents(Visibility.Collapsed); Navigator.NavigationService.Navigate(new RichTextEditor()); - ApplyAllImages(); } } } \ No newline at end of file diff --git a/CTA/CustomTeamAssigner/PlaySetListerPage.xaml b/CTA/CustomTeamAssigner/PlaySetListerPage.xaml index 8faf75111..60451d581 100644 --- a/CTA/CustomTeamAssigner/PlaySetListerPage.xaml +++ b/CTA/CustomTeamAssigner/PlaySetListerPage.xaml @@ -185,7 +185,7 @@ README file in the root directory of this source tree. - + @@ -194,7 +194,7 @@ README file in the root directory of this source tree. - + @@ -203,7 +203,7 @@ README file in the root directory of this source tree. - + @@ -212,7 +212,7 @@ README file in the root directory of this source tree. - + @@ -221,7 +221,7 @@ README file in the root directory of this source tree. - + diff --git a/CTA/CustomTeamAssigner/PlaySetListerPage.xaml.cs b/CTA/CustomTeamAssigner/PlaySetListerPage.xaml.cs index 237904f59..386d0155a 100644 --- a/CTA/CustomTeamAssigner/PlaySetListerPage.xaml.cs +++ b/CTA/CustomTeamAssigner/PlaySetListerPage.xaml.cs @@ -34,7 +34,6 @@ namespace CustomTeamAssigner MainWindow.Instance.Navigator.NavigationService.Navigate(new TeamEditorPage(Utils.Teams.ElementAt(TeamListBox.SelectedIndex))); Utils.SetMainWindowContents(Visibility.Collapsed); - MainWindow.ApplyAllImages(); } void DeleteTeam(object sender, RoutedEventArgs e) @@ -56,7 +55,6 @@ namespace CustomTeamAssigner Utils.Teams.Add(team); MainWindow.Instance.Navigator.NavigationService.Navigate(new TeamEditorPage(team)); Utils.SetMainWindowContents(Visibility.Collapsed); - MainWindow.ApplyAllImages(); } void SavePlaySet(object sender, RoutedEventArgs e) diff --git a/CTA/CustomTeamAssigner/QMQuestions.xaml b/CTA/CustomTeamAssigner/QMQuestions.xaml index cb5163525..8d4fe2c4e 100644 --- a/CTA/CustomTeamAssigner/QMQuestions.xaml +++ b/CTA/CustomTeamAssigner/QMQuestions.xaml @@ -3,6 +3,7 @@ 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:svgc="http://sharpvectors.codeplex.com/svgc/" mc:Ignorable="d" Title="QMQuestions" Height="680" Width="1260"> @@ -309,7 +310,7 @@ - + @@ -318,7 +319,7 @@ - + @@ -327,7 +328,7 @@ - + @@ -336,7 +337,7 @@ - + diff --git a/CTA/CustomTeamAssigner/RichTextEditor.xaml b/CTA/CustomTeamAssigner/RichTextEditor.xaml index 590a544ca..59da102d9 100644 --- a/CTA/CustomTeamAssigner/RichTextEditor.xaml +++ b/CTA/CustomTeamAssigner/RichTextEditor.xaml @@ -3,6 +3,7 @@ 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:svgc="http://sharpvectors.codeplex.com/svgc/" mc:Ignorable="d" Title="RichTextEditor" Height="680" Width="1260"> @@ -174,7 +175,7 @@ - + diff --git a/CTA/CustomTeamAssigner/RoleDescFinder.xaml b/CTA/CustomTeamAssigner/RoleDescFinder.xaml index 4f315ac5e..a641df3dc 100644 --- a/CTA/CustomTeamAssigner/RoleDescFinder.xaml +++ b/CTA/CustomTeamAssigner/RoleDescFinder.xaml @@ -3,6 +3,7 @@ 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:svgc="http://sharpvectors.codeplex.com/svgc/" mc:Ignorable="d" d:DesignHeight="680" d:DesignWidth="1260" FontSize="24" Title="Role Description Finder"> @@ -121,7 +122,7 @@ - + @@ -134,7 +135,7 @@ - + diff --git a/CTA/CustomTeamAssigner/TeamEditorPage.xaml b/CTA/CustomTeamAssigner/TeamEditorPage.xaml index 26d5e15f4..802ae8bae 100644 --- a/CTA/CustomTeamAssigner/TeamEditorPage.xaml +++ b/CTA/CustomTeamAssigner/TeamEditorPage.xaml @@ -11,6 +11,7 @@ README file in the root directory of this source tree. 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:svgc="http://sharpvectors.codeplex.com/svgc/" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" FontSize="24" Title="Team Editor"> @@ -325,7 +326,7 @@ README file in the root directory of this source tree. - + @@ -337,7 +338,7 @@ README file in the root directory of this source tree. - + @@ -346,7 +347,7 @@ README file in the root directory of this source tree. - + @@ -355,7 +356,7 @@ README file in the root directory of this source tree. - + diff --git a/CTA/CustomTeamAssigner/TeamEditorPage.xaml.cs b/CTA/CustomTeamAssigner/TeamEditorPage.xaml.cs index 51840750b..406a41351 100644 --- a/CTA/CustomTeamAssigner/TeamEditorPage.xaml.cs +++ b/CTA/CustomTeamAssigner/TeamEditorPage.xaml.cs @@ -29,7 +29,6 @@ namespace CustomTeamAssigner InitializeMembersGrid(); InitializeComboBox(); InitializeEditorFields(); - MainWindow.ApplyAllImages(); } void InitializeEditorFields() @@ -91,14 +90,12 @@ namespace CustomTeamAssigner MainWindow.Instance.Navigator.NavigationService.Navigate(new PlaySetListerPage()); Utils.SetMainWindowContents(Visibility.Collapsed); - MainWindow.ApplyAllImages(); } void Cancel(object sender, RoutedEventArgs e) { MainWindow.Instance.Navigator.NavigationService.Navigate(new PlaySetListerPage()); Utils.SetMainWindowContents(Visibility.Collapsed); - MainWindow.ApplyAllImages(); } void Delete(object sender, RoutedEventArgs e) @@ -106,7 +103,6 @@ namespace CustomTeamAssigner Utils.Teams.Remove(EditingTeam); MainWindow.Instance.Navigator.NavigationService.Navigate(new PlaySetListerPage()); Utils.SetMainWindowContents(Visibility.Collapsed); - MainWindow.ApplyAllImages(); } void AddMember(object sender, RoutedEventArgs e)