This commit is contained in:
Gurge44 committed 2024-10-01 14:16:52 +02:00
1 parent f66c78d447
commit 121539c61d
9 files changed
+29 -133

No files matched your search

+6 -7
View File
@@ -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.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/add.svg" Name="AddButtonImage" Width="30" Height="30"/>
<svgc:SvgViewbox Source="Resources/add.svg" Width="30" Height="30"/>
<TextBlock Text="Create New Play-Set" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
</Button>
@@ -132,7 +133,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/import.svg" Name="ImportButtonImage" Width="30" Height="30"/>
<svgc:SvgViewbox Source="Resources/import.svg" Width="30" Height="30"/>
<TextBlock Text="Import Play-Set" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
</Button>
@@ -144,7 +145,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/question.svg" Name="QuestionButtonImage" Width="30" Height="30"/>
<svgc:SvgViewbox Source="Resources/question.svg" Width="30" Height="30"/>
<TextBlock Text="Quiz Master Questions" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
</Button>
@@ -154,7 +155,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/search.svg" Name="SearchButtonImage" Width="30" Height="30"/>
<svgc:SvgViewbox Source="Resources/search.svg" Width="30" Height="30"/>
<TextBlock Text="Role Description Finder" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
</Button>
@@ -164,11 +165,9 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/template.svg" Name="TemplateButtonImage" Width="30" Height="30"/>
<svgc:SvgViewbox Source="Resources/template.svg" Width="30" Height="30"/>
<TextBlock Text="Template Creator" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
</Button>
<Label Grid.Column="0" Grid.Row="9" Content="Loading SVG Images...." Name="LoadingLabel"></Label>
</Grid>
</Window>
+3 -104
View File
@@ -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();
}
}
}
@@ -185,7 +185,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/add.svg" Name="AddButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/add.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Add"/>
</StackPanel>
</Button>
@@ -194,7 +194,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/edit.svg" Name="EditButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/edit.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Edit"/>
</StackPanel>
</Button>
@@ -203,7 +203,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/delete.svg" Name="DeleteButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/delete.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Delete"/>
</StackPanel>
</Button>
@@ -212,7 +212,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/save-as.svg" Name="SaveAsButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/save-as.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Save"/>
</StackPanel>
</Button>
@@ -221,7 +221,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/back.svg" Name="BackButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/back.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Go Back"/>
</StackPanel>
</Button>
@@ -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)
+5 -4
View File
@@ -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 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/new-file.svg" Name="NewFileButtonImage" Width="30" Height="30" Margin="15"/>
<svgc:SvgViewbox Source="Resources/new-file.svg" Name="NewFileButtonImage" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Save to new file"/>
</StackPanel>
</Button>
@@ -318,7 +319,7 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/save-as.svg" Name="SaveAsButtonImage" Width="30" Height="30" Margin="15"/>
<svgc:SvgViewbox Source="Resources/save-as.svg" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Add to existing file"/>
</StackPanel>
</Button>
@@ -327,7 +328,7 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/copy.svg" Name="CopyButtonImage" Width="30" Height="30" Margin="15"/>
<svgc:SvgViewbox Source="Resources/copy.svg" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Copy"/>
</StackPanel>
</Button>
@@ -336,7 +337,7 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/back.svg" Name="BackButtonImage" Width="30" Height="30" Margin="15"/>
<svgc:SvgViewbox Source="Resources/back.svg" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Back"/>
</StackPanel>
</Button>
+2 -1
View File
@@ -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 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/back.svg" Name="BackButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/back.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Back"/>
</StackPanel>
</Button>
+3 -2
View File
@@ -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 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/search.svg" Name="SearchButtonImage" Width="30" Height="30" Margin="15"/>
<svgc:SvgViewbox Source="Resources/search.svg" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Find Description"/>
</StackPanel>
</Button>
@@ -134,7 +135,7 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/back.svg" Name="BackButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/back.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Back"/>
</StackPanel>
</Button>
+5 -4
View File
@@ -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.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/add.svg" Name="AddButtonImage" Width="30" Height="30" Margin="15"/>
<svgc:SvgViewbox Source="Resources/add.svg" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Add Member"/>
</StackPanel>
</Button>
@@ -337,7 +338,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/discard.svg" Name="DiscardButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/discard.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Cancel"/>
</StackPanel>
</Button>
@@ -346,7 +347,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/delete.svg" Name="DeleteButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/delete.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Delete"/>
</StackPanel>
</Button>
@@ -355,7 +356,7 @@ README file in the root directory of this source tree.
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/save.svg" Name="SaveButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<svgc:SvgViewbox Source="Resources/save.svg" Width="30" Height="30" Margin="0,0,15,0"/>
<TextBlock Text="Save"/>
</StackPanel>
</Button>
@@ -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)