-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
157 lines (138 loc) · 8.25 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:md="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
xmlns:local="clr-namespace:Elite_Dangerous_Addon_Launcher_V2"
x:Name="Main"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="Elite_Dangerous_Addon_Launcher_V2.MainWindow"
Title="{Binding ElementName=Main, Path=ApplicationVersion, StringFormat='ED AddOn Helper v{0}'}"
Height="450" Width="741"
TextElement.Foreground="{DynamicResource MaterialDesign.Brush.Foreground}"
Background="{DynamicResource MaterialDesign.Brush.Background}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
FontFamily="{DynamicResource MaterialDesignFont}">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Light" />
</ResourceDictionary.MergedDictionaries>
<ContextMenu x:Key="myContextMenu">
<MenuItem Header="Copy to profile..."
ItemsSource="{Binding Source={x:Static local:AppState.Instance}, Path=OtherProfiles}">
<MenuItem.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Header" Value="{Binding Name}"/>
<EventSetter Event="Click" Handler="ProfileMenuItem_Click"/>
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
</ContextMenu>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="10,10,2,2">
<StackPanel Orientation="Horizontal">
<Button x:Name="Bt_AddApp" Content="Add App" Width="131" Margin="10,0"
Click="Bt_AddApp_Click_1" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button Content="Toggle Theme" Click="ToggleThemeButton_Click"
Style="{DynamicResource MaterialDesignRaisedButton}" Margin="0,0,10,0" Width="131" />
<TextBlock Text="Profile:" VerticalAlignment="Center" Margin="0,0,10,0" />
<ComboBox x:Name="Cb_Profiles"
ItemsSource="{Binding Profiles}"
SelectedItem="{Binding CurrentProfile}"
DisplayMemberPath="Name"
SelectionChanged="Cb_Profiles_SelectionChanged"
Width="137" />
<CheckBox x:Name="DefaultCheckBox" Content="Default"
IsChecked="{Binding IsDefault, Mode=TwoWay}"
Margin="10,0" Height="15" Checked="DefaultCheckbox_Checked" Unchecked="CheckBox_Unchecked" />
<Button x:Name="Btn_Launch" Content="Launch" Width="106"
Click="Btn_Launch_Click" Style="{DynamicResource MaterialDesignRaisedButton}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Expander Header="Profiles.." Width="200">
<StackPanel>
<Button x:Name="Bt_AddProfile" Content="Add Profile" Click="Bt_AddProfile_Click_1" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Bt_RemoveProfile" Content="Remove Profile" Click="Bt_RemoveProfile_Click_1" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Bt_CopyProfile" Content="Copy Profile" Click="Bt_CopyProfile_Click" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Bt_RenameProfile" Content="Rename Profile" Click="Bt_RenameProfile_Click" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Btn_Import" Content="Import" Click="ImportProfiles" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Btn_Export" Content="Export" Click="ExportProfiles" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Logs" Content="Logs" Click="Btn_ShowLogs" Style="{DynamicResource MaterialDesignRaisedButton}" />
</StackPanel>
</Expander>
<CheckBox x:Name="CloseAllAppsCheckbox" Content="Close apps on Exit"
DataContext="{x:Static local:AppState.Instance}"
IsChecked="{Binding CloseAllApps, Mode=TwoWay}" Checked="CloseAllAppsCheckbox_Checked_1" Unchecked ="CloseAllAppsCheckbox_Unchecked_1"
/>
</StackPanel>
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DataGrid x:Name="AddonDataGrid"
Grid.Column="0"
AutoGenerateColumns="False"
SelectionUnit="FullRow"
CanUserAddRows="False"
IsReadOnly="True"
GridLinesVisibility="None"
HorizontalGridLinesBrush="Transparent"
ItemsSource="{Binding CurrentProfile.Apps}"
SelectedItem="{Binding SelectedApp}"
CellEditEnding="AddonDataGrid_CellEditEnding"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.DropHandler="{Binding CurrentProfile.DropHandler}"
Style="{StaticResource MaterialDesignDataGrid}"
ContextMenuOpening="AddonDataGrid_ContextMenuOpening">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource MaterialDesignDataGridRow}">
<Setter Property="ContextMenu" Value="{StaticResource myContextMenu}"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="App Name" Binding="{Binding Name}" />
<DataGridTemplateColumn Header="Enabled">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsEnabled, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Edit">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Edit" Click="Btn_Edit_Click" CommandParameter="{Binding}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Delete">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Delete" Click="DeleteButton_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Image Source="/app.png"
Grid.Column="1"
Width="125"
Margin="10,0"
Height="128"
VerticalAlignment="Top" />
</Grid>
</Grid>
</Window>