Skip to content

Commit

Permalink
V1.1.7.0 Updates
Browse files Browse the repository at this point in the history
- Removed OAT Simulation code for standalone tool.
- Checklist title can be changed and the list can be edited directly from the list.
  • Loading branch information
ClutchplateDude committed Sep 28, 2024
1 parent de5fcf1 commit 88cc20d
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 56 deletions.
10 changes: 5 additions & 5 deletions OATControl/DlgAppSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderBrush="#300" BorderThickness="2" x:Name="ImageBorder" >
<Border BorderBrush="#401111" BorderThickness="2" x:Name="ImageBorder" Padding="1" Background="#800000">
<Viewbox>
<Grid>
<Grid Name="backgroundGrid" Width="128" Height="128" Visibility="Visible">
<Rectangle Fill="Transparent" Visibility="Visible" x:Name="backgroundRect"/>
<Rectangle Fill="#FF800000" Visibility="Visible" x:Name="backgroundRect"/>
</Grid>
<Path Data="M16.000015,9.6000061C12.500012,9.6000061 9.5999844,12.5 9.5999844,16 9.5999844,19.5 12.500012,22.399994 16.000015,22.399994 19.500019,22.399994 22.400015,19.5 22.400015,16 22.400015,12.5 19.500019,9.6000061 16.000015,9.6000061z M14.199995,0L17.800005,0C18.199999,0,18.599993,0.29998779,18.599993,0.79998779L18.599993,4.7999878C19.900013,5.1000061,21.000019,5.6000061,22.099997,6.2999878L25.000023,3.3999939C25.099999,3.2999878 25.300011,3.1999817 25.500025,3.1999817 25.700007,3.1999817 25.900019,3.2999878 26.000025,3.3999939L28.600033,6C28.900021,6.2999878,28.900021,6.7999878,28.600033,7.1000061L25.700007,10C26.400019,11.100006,26.900019,12.299988,27.200007,13.5L31.20001,13.5C31.600037,13.5,31.999998,13.799988,31.999998,14.299988L31.999998,17.899994C31.999998,18.299988,31.700012,18.699982,31.20001,18.699982L27.200007,18.699982C26.900019,20,26.400019,21.100006,25.700007,22.199982L28.600033,25.100006C28.700009,25.199982 28.799984,25.399994 28.799984,25.600006 28.799984,25.799988 28.700009,26 28.600033,26.100006L26.000025,28.600006C25.900019,28.699982 25.700007,28.799988 25.500025,28.799988 25.300011,28.799988 25.099999,28.699982 25.000023,28.600006L22.099997,25.699982C21.000019,26.399994,19.800007,26.899994,18.599993,27.199982L18.599993,31.199982C18.599993,31.600006,18.300005,32,17.800005,32L14.199995,32C13.8,32,13.400006,31.699982,13.400006,31.199982L13.400006,27.199982C12.099987,26.899994,11.000011,26.399994,9.9000027,25.699982L7.0000064,28.600006C6.9000003,28.699982 6.6999881,28.799988 6.5000059,28.799988 6.2999937,28.799988 6.099981,28.699982 6.0000054,28.600006L3.3999967,26C3.0999784,25.699982,3.0999784,25.199982,3.3999967,24.899994L6.2999937,22C5.5999805,20.899994,5.0999801,19.699982,4.7999923,18.5L0.79998828,18.5C0.39999409,18.5,-1.933513E-07,18.199982,0,17.699982L0,14.100006C-1.933513E-07,13.699982,0.2999879,13.299988,0.79998828,13.299988L4.7999923,13.299988C5.0999801,12,5.5999805,10.899994,6.2999937,9.7999878L3.3999967,7C3.2999908,6.8999939 3.1999845,6.6999817 3.1999845,6.5 3.1999845,6.2999878 3.2999908,6.1000061 3.3999967,6L6.0000054,3.3999939C6.099981,3.2999878 6.2999937,3.1999817 6.5000059,3.1999817 6.6999881,3.1999817 6.9000003,3.2999878 7.0000064,3.3999939L9.9000027,6.2999878C11.000011,5.6000061,12.199993,5.1000061,13.400006,4.7999878L13.400006,0.79998779C13.400006,0.29998779,13.8,0,14.199995,0z"
x:Name="colorGear"
Expand All @@ -107,13 +107,13 @@
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ImageBorder" Property="BorderBrush" Value="#200" />
<Setter TargetName="backgroundRect" Property="Fill" Value="#600000" />
<Setter TargetName="colorGear" Property="Fill" Value="#300" />
<Setter TargetName="colorGear" Property="Fill" Value="#C00" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<!--<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#700" />
<Setter Property="BorderBrush" Value="#600" />
Expand All @@ -122,7 +122,7 @@
<Setter Property="Background" Value="#400" />
<Setter Property="BorderBrush" Value="#500" />
</Trigger>
</Style.Triggers>
</Style.Triggers>-->
</Style>

<Style x:Key="GridViewColumnHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
Expand Down
70 changes: 64 additions & 6 deletions OATControl/DlgChecklist.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:controls="clr-namespace:OATControl.Controls"
xmlns:converters="clr-namespace:OATControl.Converters"
mc:Ignorable="d"
Title="Checklist" MinHeight="310" Width="600" MinWidth="204" Height="500"
MinHeight="310" Width="600" MinWidth="204" Height="500"
WindowStyle="None"
WindowStartupLocation="Manual"
Activated="Window_Activated"
Expand Down Expand Up @@ -65,16 +65,74 @@
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
<Style x:Key="ImageSquareButtonStyle" TargetType="Button" BasedOn="{StaticResource AccentedSquareButtonStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderBrush="#401111" BorderThickness="2" x:Name="ImageBorder" Height="20" Padding="1" Background="#800000">
<Viewbox>
<Grid>
<Grid Name="backgroundGrid" Width="128" Height="128" Visibility="Visible">
<Rectangle Fill="#FF800000" Visibility="Visible" x:Name="backgroundRect"/>
</Grid>
<Path Data="M20.638062,9.6380005L6.6380615,23.638 8.3620605,25.362 22.362061,11.362z M20.5,4.5L27.5,11.5 9,30 0,32 2,23z M27,0C29.760986,0 32,2.2389832 32,5 32,6.1259766 31.628052,7.1640015 31,8L29,10 22,3 24,1C24.83606,0.37197876,25.874023,0,27,0z"
x:Name="colorGear"
Stretch="Uniform"
Fill="#E00"
Width="116"
Height="116"
Margin="0,0,0,0"
RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<RotateTransform Angle="0" />
<ScaleTransform ScaleX="1" ScaleY="1" />
</TransformGroup.Children>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</Viewbox>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ImageBorder" Property="BorderBrush" Value="#200" />
<Setter TargetName="backgroundRect" Property="Fill" Value="#600000" />
<Setter TargetName="colorGear" Property="Fill" Value="#C00" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<!--<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#700" />
<Setter Property="BorderBrush" Value="#600" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#400" />
<Setter Property="BorderBrush" Value="#500" />
</Trigger>
</Style.Triggers>-->
</Style>
</Window.Resources>
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" HorizontalAlignment="Stretch" MouseDown="OnTitleMouseDown" MouseMove="OnTitleMouseMove" MouseUp="OnTitleMouseUp" Cursor="SizeAll">
<TextBlock Text="Startup Checklist" Foreground="#C44" FontSize="16" FontWeight="Bold" Margin="0,8,0,0" HorizontalAlignment="Center"/>
<DockPanel Grid.Row="0" HorizontalAlignment="Stretch">
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding ListTitle}" Foreground="#C44" FontSize="16" FontWeight="Bold" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" MouseDown="OnTitleMouseDown" MouseMove="OnTitleMouseMove" MouseUp="OnTitleMouseUp" Cursor="SizeAll"/>
<Button Grid.Column="1" HorizontalAlignment="Right" Width="20" Height="20" Margin="8,2,5,0" Command="{Binding EditChecklistCommand}" Padding="0" Style="{StaticResource ImageSquareButtonStyle}" ToolTip="Edit this checklist" Cursor="Arrow"/>
</Grid>
</DockPanel>
<Grid Grid.Row="1" Margin="10">
<Grid Grid.Row="1" Margin="5,2,5,5">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
Expand All @@ -89,12 +147,12 @@
Width="80"
Click="OnCloseClick"
Style="{StaticResource AccentedDialogSquareButton}"
Margin="5,0,5,0"/>
Margin="0,0,3,0"/>
<Button Content="Reset"
Width="80"
Click="OnResetClick"
Style="{StaticResource AccentedDialogSquareButton}"
Margin="5,0,5,0"/>
Margin="2,0,0,0"/>
</StackPanel>
</Grid>

Expand Down
32 changes: 26 additions & 6 deletions OATControl/DlgChecklist.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Text;
using System.Windows;
using System.Windows.Input;
using DelegateCommand = OATCommunications.WPF.DelegateCommand;

namespace OATControl
{
Expand All @@ -19,25 +20,39 @@ namespace OATControl
public partial class DlgChecklist : Window, INotifyPropertyChanged
{
string _listFilePath;
string _listTitle;
private ObservableCollection<ChecklistItem> checklistItems;
DateTime _lastCreationDate;
private Point _startCapturePos;
private Point _startWindowPos;
private DelegateCommand _editChecklistCommand;

public DlgChecklist(string listFilePath)
{

this.DataContext = this;

_editChecklistCommand = new DelegateCommand(() => OnShowChecklist(), () => true);
_listTitle = AppSettings.Instance.ChecklistTitle;
InitializeComponent();
InitializeWebView();

_listFilePath = listFilePath;

LoadChecklistItemsFromFile(_listFilePath);

}

private void OnShowChecklist()
{
DlgChecklistEditor dlg = new DlgChecklistEditor(_listFilePath);
dlg.ShowDialog();
_listTitle = AppSettings.Instance.ChecklistTitle;
OnPropertyChanged("ListTitle");
LoadChecklistItemsFromFile(_listFilePath);
UpdateChecklistHtml();
}

public ICommand EditChecklistCommand { get { return _editChecklistCommand; } }

private void UpdateChecklistHtml()
{
string htmlContent = GenerateChecklistHtml(checklistItems);
Expand Down Expand Up @@ -147,7 +162,7 @@ private async void InitializeWebView()

// Create the WebView2 environment with the custom user data folder
var env = await CoreWebView2Environment.CreateAsync(null, userDataFolder);

ChecklistWebView.CoreWebView2InitializationCompleted += async (sender, args) =>
{
if (args.IsSuccess)
Expand Down Expand Up @@ -180,7 +195,7 @@ public class CheckboxMessage
public bool IsChecked { get; set; }
}


private void OnResetClick(object sender, RoutedEventArgs e)
{
foreach (var item in checklistItems)
Expand Down Expand Up @@ -251,7 +266,7 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs

public string TempFolder
{
get { return Path.GetTempPath(); }
get { return Path.GetTempPath(); }
}

private void Window_Activated(object sender, EventArgs e)
Expand Down Expand Up @@ -298,6 +313,11 @@ private void OnTitleMouseMove(object sender, MouseEventArgs e)
e.Handled = true;
}
}

public string ListTitle
{
get { return _listTitle; }
}
}

}
Expand Down
67 changes: 57 additions & 10 deletions OATControl/DlgChecklistEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,37 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="Edit Startup Checklist" Height="400" Width="600"
Title="Edit Startup Checklist" Height="525" Width="360" MinWidth="392"
WindowStartupLocation="CenterOwner">
<mah:MetroWindow.Resources>
<Style x:Key="TextBoxSmall" TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}" >
<Setter Property="Margin" Value="10,2,10,2" />
<Setter Property="Height" Value="11" />
<Setter Property="Background" Value="#770000" />
<Setter Property="Foreground" Value="#F00" />
<Setter Property="Width" Value="60" />
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>

<Style x:Key="TextBlockHeading" TargetType="TextBlock" BasedOn="{StaticResource MetroTextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Margin" Value="2,0" />
<Setter Property="Padding" Value="6,0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Foreground" Value="#B00" />
</Style>
<Style x:Key="TextBlockLabel" TargetType="TextBlock" BasedOn="{StaticResource TextBlockHeading}">
<Setter Property="Padding" Value="2,0" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style x:Key="TextBlockLabelSmall" TargetType="TextBlock" BasedOn="{StaticResource TextBlockLabel}">
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="4,0" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
</mah:MetroWindow.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
Expand All @@ -12,7 +41,7 @@
</Grid.RowDefinitions>
<!-- Multi-line TextBox for editing -->
<Border BorderBrush="#622" BorderThickness="1" Grid.Row="0">
<TextBox x:Name="ChecklistTextBox"
<TextBox x:Name="ChecklistTextBox"
AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Expand All @@ -28,21 +57,39 @@
</Border>
<TextBlock Grid.Row="1" Text="One checklist item line. You can use &lt;b&gt; for bold. Use \n for new line." Foreground="#A30"/>
<!-- Buttons -->
<StackPanel Orientation="Horizontal"
Grid.Row="2"
HorizontalAlignment="Right"
<Grid Grid.Row="2"
HorizontalAlignment="Stretch"
Margin="0,10,0,0">
<Button Content="OK"
Width="75"
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="List title:"
VerticalAlignment="Center"
Margin="0,0,8,0"
Style="{StaticResource TextBlockLabelSmall}"/>
<TextBox Grid.Column="1" Width="120"
HorizontalAlignment="Left"
Margin="0,0"
Text="{Binding ListTitle}"
Style="{StaticResource TextBoxSmall}"
/>
<Button Grid.Column="2" Content="OK"
Width="55"
Margin="0,0,10,0"
IsDefault="True"
Style="{StaticResource AccentedDialogSquareButton}"
Click="OKButton_Click" />
<Button Content="Cancel"
Width="75"
<Button Grid.Column="3" Content="Cancel"
Width="55"
IsCancel="True"
Style="{StaticResource AccentedDialogSquareButton}"
Click="CancelButton_Click" />
</StackPanel>
</Grid>
</Grid>
</mah:MetroWindow>


Loading

0 comments on commit 88cc20d

Please sign in to comment.