EHR CP: Fixes

This commit is contained in:
Gurge44 committed 2024-09-20 12:12:39 +02:00
1 parent 97752e2d45
commit 902faa0578
8 files changed
+50 -22

No files matched your search

+3 -3
View File
@@ -113,11 +113,11 @@ README file in the root directory of this source tree.
<Frame Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Grid.RowSpan="10" Name="Navigator" NavigationUIVisibility="Hidden"/>
<Label Content="EHR Control Panel" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="2" FontSize="70" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="LightGray" Name="Title"/>
<Label Content="EHR Control Panel" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="2" FontSize="70" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" Foreground="LightGray" Name="Title"/>
<Border Grid.Column="1" Grid.Row="3" Grid.RowSpan="4" Background="#2D2D2D" CornerRadius="20" Padding="20" HorizontalAlignment="Center" VerticalAlignment="Center" Name="ButtonGroup">
<StackPanel>
<Label Content="Custom Team Assignment" FontSize="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="LightGray"></Label>
<Label Content="Custom Team Assignment" FontSize="15" HorizontalContentAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" Foreground="LightGray"/>
<Button Click="CreateNewPlaySet" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<ScaleTransform/>
@@ -145,7 +145,7 @@ README file in the root directory of this source tree.
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/question.svg" Name="QuestionButtonImage" Width="30" Height="30"/>
<TextBlock Text="Settings" VerticalAlignment="Center" Margin="10,0,0,0"/>
<TextBlock Text="Quiz Master Questions" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
</Button>
+6 -5
View File
@@ -145,6 +145,7 @@
</Style>
<Style TargetType="ComboBox">
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="White"/>
@@ -306,16 +307,16 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/new-file.svg" Name="NewFileButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<Image Source="Resources/new-file.svg" Name="NewFileButtonImage" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Save to new file"/>
</StackPanel>
</Button>
<Button>
<Button Click="AddToExistingFile">
<Button.RenderTransform>
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/save-as.svg" Name="SaveAsButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<Image Source="Resources/save-as.svg" Name="SaveAsButtonImage" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Add to existing file"/>
</StackPanel>
</Button>
@@ -324,7 +325,7 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/copy.svg" Name="CopyButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<Image Source="Resources/copy.svg" Name="CopyButtonImage" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Copy"/>
</StackPanel>
</Button>
@@ -333,7 +334,7 @@
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/back.svg" Name="BackButtonImage" Width="30" Height="30" Margin="0,0,15,0"/>
<Image Source="Resources/back.svg" Name="BackButtonImage" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Back"/>
</StackPanel>
</Button>
@@ -10,6 +10,7 @@ namespace CustomTeamAssigner
public QMQuestions()
{
InitializeComponent();
Instance = this;
}
private void SaveToNewFile(object sender, RoutedEventArgs e)
@@ -35,5 +36,20 @@ namespace CustomTeamAssigner
if (QuestionTextBox == null || Answer1TextBox == null || Answer2TextBox == null || Answer3TextBox == null || CorrectAnswerComboBox == null) return;
OutputTextBox.Text = string.Join(';', QuestionTextBox.Text, Answer1TextBox.Text, Answer2TextBox.Text, Answer3TextBox.Text, CorrectAnswerComboBox.SelectedIndex.ToString());
}
private void AddToExistingFile(object sender, RoutedEventArgs e)
{
var ofd = new Microsoft.Win32.OpenFileDialog
{
Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*",
FilterIndex = 1,
RestoreDirectory = true
};
if (ofd.ShowDialog() == true)
{
System.IO.File.AppendAllText(ofd.FileName, '\n' + OutputTextBox.Text);
}
}
}
}
+2 -2
View File
@@ -163,10 +163,10 @@
</StackPanel>
<!-- RichTextBox for Text Input -->
<RichTextBox Name="richTextBox" Grid.Row="1" Grid.RowSpan="5" VerticalAlignment="Top" Margin="10,20,10,80" BorderBrush="#1C1C1C" MinHeight="50"/>
<RichTextBox Name="RichTextBox" Grid.Row="1" Grid.RowSpan="5" VerticalAlignment="Top" Margin="10,20,10,80" BorderBrush="#1C1C1C" MinHeight="50"/>
<!-- Preview HTML Output -->
<TextBox Name="htmlPreview" Grid.Row="6" Grid.RowSpan="3" IsReadOnly="True"
<TextBox Name="HtmlPreview" Grid.Row="6" Grid.RowSpan="3" IsReadOnly="True"
VerticalAlignment="Bottom" Margin="10,10,10,0" TextWrapping="Wrap" />
<Button Grid.Row="9" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="BackButton_Click">
+12 -11
View File
@@ -16,8 +16,9 @@ namespace CustomTeamAssigner
public RichTextEditor()
{
InitializeComponent();
richTextBox.TextChanged += RichTextBox_TextChanged;
richTextBox.Focus();
Instance = this;
RichTextBox.TextChanged += RichTextBox_TextChanged;
RichTextBox.Focus();
MainGrid.Visibility = Visibility.Visible;
}
@@ -30,12 +31,12 @@ namespace CustomTeamAssigner
{
string xamlText = GetXamlFromRichTextBox();
string htmlText = ConvertXamlToHtml(xamlText);
htmlPreview.Text = htmlText;
HtmlPreview.Text = htmlText;
}
private string GetXamlFromRichTextBox()
{
TextRange textRange = new(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
TextRange textRange = new(RichTextBox.Document.ContentStart, RichTextBox.Document.ContentEnd);
using MemoryStream stream = new();
textRange.Save(stream, DataFormats.Xaml);
return Encoding.UTF8.GetString(stream.ToArray());
@@ -142,19 +143,19 @@ namespace CustomTeamAssigner
private void Bold_Click(object sender, RoutedEventArgs e)
{
if (!richTextBox.Selection.IsEmpty)
richTextBox.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
if (!RichTextBox.Selection.IsEmpty)
RichTextBox.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
}
private void Italic_Click(object sender, RoutedEventArgs e)
{
if (!richTextBox.Selection.IsEmpty)
richTextBox.Selection.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Italic);
if (!RichTextBox.Selection.IsEmpty)
RichTextBox.Selection.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Italic);
}
private void Underline_Click(object sender, RoutedEventArgs e)
{
TextSelection selection = richTextBox.Selection;
TextSelection selection = RichTextBox.Selection;
if (!selection.IsEmpty)
{
selection.ApplyPropertyValue(
@@ -170,7 +171,7 @@ namespace CustomTeamAssigner
if (sender is ComboBox { SelectedItem: ComboBoxItem selectedItem })
{
double selectedFontSize = double.Parse(selectedItem.Content.ToString() ?? "20");
richTextBox.Selection.ApplyPropertyValue(TextElement.FontSizeProperty, selectedFontSize);
RichTextBox?.Selection.ApplyPropertyValue(TextElement.FontSizeProperty, selectedFontSize);
}
}
@@ -180,7 +181,7 @@ namespace CustomTeamAssigner
{
string selectedColor = selectedItem.Content.ToString() ?? string.Empty;
SolidColorBrush colorBrush = new BrushConverter().ConvertFromString(selectedColor) as SolidColorBrush ?? new(Colors.White);
richTextBox.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, colorBrush);
RichTextBox?.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, colorBrush);
}
}
@@ -13,6 +13,7 @@ namespace CustomTeamAssigner
public RoleDescFinder()
{
InitializeComponent();
Instance = this;
MainGrid.Visibility = Visibility.Visible;
}
+9 -1
View File
@@ -320,7 +320,15 @@ README file in the root directory of this source tree.
<StackPanel Grid.Row="6" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal">
<ComboBox x:Name="MemberComboBox" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Width="300"/>
<Button Content=" Add Member " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Click="AddMember"/>
<Button FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Click="AddMember" Width="300">
<Button.RenderTransform>
<ScaleTransform/>
</Button.RenderTransform>
<StackPanel Orientation="Horizontal">
<Image Source="Resources/add.svg" Name="AddButtonImage" Width="30" Height="30" Margin="15"/>
<TextBlock Text="Add Member"/>
</StackPanel>
</Button>
</StackPanel>
<Label Grid.Row="8" Grid.Column="2" Content="Click on a member to remove it" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
@@ -23,6 +23,7 @@ namespace CustomTeamAssigner
public TeamEditorPage(Team team)
{
InitializeComponent();
Instance = this;
EditingTeam = team;
EditingTeamMembers = team.TeamMembers;
InitializeMembersGrid();