Files
bodyshop-uploader/BodyshopUploader/Views/Main.xaml
2022-02-07 13:31:51 -08:00

282 lines
15 KiB
XML

<Window x:Class="BodyshopPartner.Views.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:p="clr-namespace:BodyshopPartner.Properties"
xmlns:properties="clr-namespace:BodyshopPartner.Properties"
xmlns:util="clr-namespace:BodyshopPartner.Utils"
xmlns:vm="clr-namespace:BodyshopPartner.ViewModels"
xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d"
Title="{x:Static p:Resources.Title_Main}"
Height="800"
Width="800"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
Loaded="Window_Loaded"
Name="MainWindow"
Closing="Window_Closing">
<Window.DataContext>
<vm:MainViewModel />
</Window.DataContext>
<Window.Resources>
<util:OpenMainWindowCommand x:Key="OpenMainWindowCommand" />
<util:MonitorStatusConverter x:Key="MonitorStatusConverter" />
<util:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />
<Style TargetType="StackPanel">
<Setter Property="Margin"
Value="8" />
</Style>
<Style TargetType="TextBox"
BasedOn="{StaticResource MaterialDesignFloatingHintTextBox}">
<Setter Property="Margin"
Value="8" />
</Style>
<Style TargetType="materialDesign:PackIcon">
<Setter Property="Margin"
Value="8" />
</Style>
<Style TargetType="Image">
<Setter Property="Margin"
Value="8" />
</Style>
</Window.Resources>
<DockPanel>
<ProgressBar DockPanel.Dock="Bottom"
Value="{Binding Progress}"
IsIndeterminate="{Binding IndeterminateLoading}"
Height="8" />
<tb:TaskbarIcon DockPanel.Dock="Top"
IconSource="../favicon.ico"
DoubleClickCommand="{Binding OpenMainWindowCommand}"
DoubleClickCommandParameter="{Binding ElementName=MainWindow}"
PopupActivation="LeftClick"
MenuActivation="RightClick">
<!--<tb:TaskbarIcon.TrayPopup>
<Border Background="{DynamicResource MaterialDesignPaper}"
BorderBrush="Black"
BorderThickness="2">
<DockPanel Margin="12">
<TextBlock DockPanel.Dock="Top"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="{x:Static p:Resources.Label_MonitorStatus}" />
<ItemsControl ItemsSource="{Binding MonitoringPaths}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Style="{StaticResource MaterialDesignBody2TextBlock}"
Margin="8"
Text="{Binding FilePath}" />
<TextBlock Grid.Column="1"
Style="{StaticResource MaterialDesignBody2TextBlock}"
Margin="8"
Text="{Binding FolderMonitor.EnableRaisingEvents,
Converter={StaticResource MonitorStatusConverter}}" />
</Grid>
<Separator Margin="2"
Width="150" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DockPanel>
</Border>
</tb:TaskbarIcon.TrayPopup>-->
<tb:TaskbarIcon.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.Label_Show}"
Command="{Binding OpenMainWindowCommand}"
CommandParameter="{Binding ElementName=MainWindow}" />
<MenuItem Header="{x:Static p:Resources.Label_Restart}"
Command="{Binding StartFolderMonitorsCommand}" />
<MenuItem Header="{x:Static p:Resources.Label_StopAllMonitors}"
Command="{Binding StopFolderMonitorsCommand}" />
<MenuItem Header="Exit"
Command="{Binding QuitCommand}" />
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
</tb:TaskbarIcon>
<StackPanel DockPanel.Dock="Right">
<ComboBox ItemsSource="{Binding ShopData}"
Margin="4"
SelectedItem="{Binding ActiveShop}"
Style="{StaticResource MaterialDesignFloatingHintComboBox}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_ActiveShop}"
DisplayMemberPath="ShopName">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
<Button Command="{Binding LogoutCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Actions_Logout}" />
<Separator />
<CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=AutoStartMonitor}"
Margin="8"
Content="{x:Static p:Resources.Label_AutoStartMonitor}" />
<CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}"
Margin="8"
Content="{x:Static p:Resources.Label_StartWithWindows}"
Command="{Binding StartWithWindowsCommand}"
CommandParameter="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}" />
<Button Command="{Binding AddMonitoringPathCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
ToolTip="{x:Static p:Resources.Label_AddMonitoringPath}"
Content="{x:Static p:Resources.Label_AddFolder}" />
<Button Command="{Binding StartFolderMonitorsCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_StartAllMonitors}" />
<Button Command="{Binding StopFolderMonitorsCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_StopAllMonitors}" />
<Button Command="{Binding RemoveAllMonitoringPathCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_RemoveAllPaths}" />
<Separator />
<Button Command="{Binding BrowseForQbFolderCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_BrowseForQb}" />
<Button Command="{Binding BrowseForEmsFolderCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_BrowseForEmsExport}" />
<Button Command="{Binding BrowseForPaintScalePathCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_BrowsePaintScalePath}" />
<Button Command="{Binding BrowseForArmsPathPathCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_BrowseArmsExportPath}" />
<Button Command="{Binding ConfigurePaintScaleCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_ConfigurePaintScale}" />
<Button Command="{Binding ConfigureArmsExportCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_ConfigureArmsExport}" />
<!--<Button Command="{Binding TestCommand}"
Margin="8"
Content="OE Test" />-->
<!--<Button Click="Button_Click"
Margin="8"
Content="Test" />
<Separator />-->
<!--<Button DockPanel.Dock="Top"
Margin="8"
Command="{Binding TestCommand}"
Content="DEVELOPER TEST" />-->
<Label DockPanel.Dock="Top"
Margin="8"
HorizontalAlignment="Center"
Content="{Binding AppVersion}" />
<StackPanel Visibility="{Binding UpdateAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">
<Button Content="Update"
Command="{Binding InstallUpdatesCommand}" />
<ProgressBar Margin="8"
Value="{Binding UpdateProgress}" />
</StackPanel>
<Label DockPanel.Dock="Top"
Margin="8"
HorizontalAlignment="Center"
Content="CONNECTED TO TEST"
Visibility="{Binding TestMode, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<DataGrid Grid.Row="0"
ItemsSource="{Binding MonitoringPaths}"
AutoGenerateColumns="False"
VerticalContentAlignment="Center"
IsReadOnly="True"
HorizontalContentAlignment="Center"
Margin="8"
CanUserAddRows="False"
CanUserSortColumns="True"
materialDesign:DataGridAssist.CellPadding="4 2 2 2"
materialDesign:DataGridAssist.ColumnHeaderPadding="4 2 2 2">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding FilePath}"
Header="{x:Static p:Resources.Label_FilePath}" />
<DataGridTextColumn Binding="{Binding FolderMonitor.EnableRaisingEvents, Converter={StaticResource MonitorStatusConverter}}"
Header="{x:Static p:Resources.Label_Status}" />
<DataGridTemplateColumn Header="{x:Static p:Resources.Label_Actions}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Command="{Binding DataContext.RemoveMonitoringPathCommand,
ElementName=MainWindow}"
CommandParameter="{Binding .}"
Style="{StaticResource MaterialDesignOutlinedButton}"
Margin="4"
Content="{x:Static p:Resources.Label_Remove}" />
<Button Command="{Binding DataContext.RestartMonitoringPathCommand,
ElementName=MainWindow }"
CommandParameter="{Binding .}"
Style="{StaticResource MaterialDesignOutlinedButton}"
Margin="4"
Content="{x:Static p:Resources.Label_Restart}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<DockPanel Grid.Row="1"
Height="Auto">
<TextBox DockPanel.Dock="Top"
Text="{Binding Source={x:Static properties:Settings.Default},
Path=QuickBooksFilePath}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_QbFilePath}"
TextChanged="TextBox_TextChanged" />
<TextBox DockPanel.Dock="Top"
Text="{Binding Source={x:Static properties:Settings.Default},
Path=EmsExportPath}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_EmsExport}"
TextChanged="EmsExportPath_TextChanged" />
<TextBox DockPanel.Dock="Top"
Text="{Binding Source={x:Static properties:Settings.Default},
Path=PaintScalePath}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_PaintScalePath}"
TextChanged="PaintScalePath_TextChanged" />
<TextBox DockPanel.Dock="Top"
Text="{Binding Source={x:Static properties:Settings.Default},
Path=ArmsExportPath}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_ArmsExportPath}"
TextChanged="ArmsExportPath_TextChanged" />
<TextBox Height="Auto"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_InteractionLog}"
Text="{Binding HttpServerLog}"
TextWrapping="Wrap"
IsReadOnly="True"
AcceptsReturn="True" />
</DockPanel>
</Grid>
</DockPanel>
</Window>