-
Notifications
You must be signed in to change notification settings - Fork 4
/
MainWindow.xaml
201 lines (200 loc) · 14.1 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<Window x:Class="ValheimServerWarden.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
xmlns:local="clr-namespace:ValheimServerWarden"
mc:Ignorable="d"
Title="Valheim Server Warden" Height="475" Width="800" Closed="Window_Closed" StateChanged="Window_StateChanged" Closing="Window_Closing" Icon="/Resources/vsw2_256.png" IsVisibleChanged="Window_IsVisibleChanged" Loaded="Window_Loaded">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Image x:Key="Remove" Source="Resources/Cancel_32x.png"/>
<Image x:Key="RemoveGrey" Source="Resources/Cancel_grey_32x.png"/>
<Image x:Key="Details" Source="Resources/ListView_32x.png"/>
<Image x:Key="Log" Source="Resources/Log_32x.png"/>
<Image x:Key="Start" Source="Resources/StartWithoutDebug_32x.png"/>
<Image x:Key="StartGrey" Source="Resources/StartWithoutDebug_grey_32x.png"/>
<Image x:Key="Stop" Source="Resources/Stop_32x.png"/>
<Image x:Key="StopGrey" Source="Resources/Stop_grey_32x.png"/>
<Storyboard x:Key="WorkingStoryboard" x:Name="storyboardWorking">
<DoubleAnimation
Storyboard.TargetName="WorkingRotation"
Storyboard.TargetProperty="Angle"
From="0.0" To="360" Duration="0:0:1" RepeatBehavior="Forever" />
</Storyboard>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TabControl x:Name="tabsMain" Grid.Row="0">
<TabItem Header="Servers">
<DataGrid x:Name="dgServers" Margin="0" CellEditEnding="dgServers_CellEditEnding" SelectionMode="Single" CanUserAddRows="False" AutoGenerateColumns="False" RowEditEnding="dgServers_RowEditEnding" BeginningEdit="dgServers_BeginningEdit" CanUserDeleteRows="False" ContextMenuOpening="dgServers_ContextMenuOpening">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}"/>
<DataGridTextColumn Header="Port" Binding="{Binding Path=Port}"/>
<DataGridTextColumn Header="World" Binding="{Binding Path=World}"/>
<DataGridTextColumn Header="Password" Binding="{Binding Path=Password}"/>
<DataGridCheckBoxColumn Header="Autostart" Binding="{Binding Path=Autostart}"/>
<DataGridCheckBoxColumn Header="Log" Binding="{Binding Path=RawLog}"/>
<DataGridTextColumn Header="Status" IsReadOnly="True" Binding="{Binding Path=Status, Mode=OneWay}"/>
<DataGridTextColumn Header="# Players" IsReadOnly="True" Binding="{Binding Path=PlayerCount, Mode=OneWay}"/>
</DataGrid.Columns>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem x:Name="serversMenuAdd" Header="Add" Click="serversMenuAdd_Click">
<MenuItem.Icon>
<Image Source="Resources/Add_32x.png"/>
</MenuItem.Icon>
</MenuItem>
<Separator x:Name="serversmenuSep1"></Separator>
<MenuItem x:Name="serversMenuRemove" Header="Remove" Click="serversMenuRemove_Click">
<MenuItem.Icon>
<DynamicResource ResourceKey="Remove"/>
</MenuItem.Icon>
</MenuItem>
<Separator x:Name="serversmenuSep2"></Separator>
<MenuItem x:Name="serversMenuDetails" Header="Details" Click="serversMenuDetails_Click">
<MenuItem.Icon>
<Image Source="Resources/ListView_32x.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="serversMenuLog" Header="Raw Server Log" Click="serversMenuLog_Click">
<MenuItem.Icon>
<Image Source="Resources/Log_32x.png"/>
</MenuItem.Icon>
</MenuItem>
<Separator x:Name="serversmenuSep3"></Separator>
<MenuItem x:Name="serversMenuStart" Header="Start" Click="serversMenuStart_Click">
<MenuItem.Icon>
<DynamicResource ResourceKey="Start"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="serversMenuStop" Header="Stop" Click="serversMenuStop_Click">
<MenuItem.Icon>
<DynamicResource ResourceKey="Stop"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="serversMenuWorking" Header="Working..." IsEnabled="False">
<MenuItem.Icon>
<Image Source="Resources/Refresh_32x.png" RenderTransformOrigin=".5,.5">
<Image.RenderTransform>
<RotateTransform x:Name="WorkingRotation"/>
</Image.RenderTransform>
</Image>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</DataGrid.ContextMenu>
</DataGrid>
</TabItem>
<TabItem Header="Settings">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="btnServerPath" Content="Default Server Path" Margin="10" HorizontalAlignment="Stretch" VerticalAlignment="Center" Click="btnServerPath_Click" Grid.Row="0" Grid.Column="0" ToolTip="Path to valheim_server.exe"/>
<TextBox x:Name="txtServerPath" ToolTip="Default dedicated server installation used for new servers" Margin="10" TextWrapping="Wrap" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Grid.Row="0" Grid.Column="1"/>
<Label Content="Default Server Type" Margin="10" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0"/>
<ComboBox x:Name="cmbServerType" Margin="10" Grid.Row="1" Grid.Column="1" SelectionChanged="cmbServerType_SelectionChanged"/>
<Button x:Name="btnSteamCmdPath" Content="SteamCMD Path" Margin="10" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" ToolTip="Path to steamcmd.exe" Click="btnSteamCmdPath_Click"/>
<TextBox x:Name="txtSteamCmdPath" ToolTip="Location of steamcmd.exe" Margin="10" TextWrapping="Wrap" VerticalAlignment="Center" IsReadOnly="True" IsTabStop="False" Grid.Row="2" Grid.Column="1"/>
</Grid>
<Border Grid.Row="1" Width="Auto" HorizontalAlignment="Left" Margin="10,5,0,10" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label x:Name="lblTheme" Content="Theme" HorizontalAlignment="Stretch" Margin="10,5,10,5" VerticalAlignment="Center" Grid.Row="0"/>
<RadioButton x:Name="radThemeLight" Content="Light" Margin="10,5,0,5" VerticalAlignment="Center" GroupName="AppTheme" Checked="radThemeLight_Checked" Grid.Row="1"/>
<RadioButton x:Name="radThemeDark" Content="Dark" Margin="135,5,0,5" GroupName="AppTheme" VerticalAlignment="Top" Checked="radThemeDark_Checked" Grid.Row="1"/>
</Grid>
</Border>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<CheckBox x:Name="chkAutoCheckUpdate" Content="Automatically check for update" ToolTip="Check for new version of app start" Margin="10,5" VerticalAlignment="Center" Grid.Column="0" Checked="chkAutoCheckUpdate_Click" Unchecked="chkAutoCheckUpdate_Click"/>
<Button x:Name="btnUpdateCheck" Content="Check Now" Margin="5,5" VerticalAlignment="Center" Click="btnUpdateCheck_Click" Grid.Column="1"/>
</Grid>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<CheckBox x:Name="chkRunningServerCheck" Content="Check for running servers on start" ToolTip="Check for any running servers on app start and provide the option to shut them down" Margin="10,5" Grid.Row="0" Grid.Column="0" Checked="chkRunningServerCheck_Checked" Unchecked="chkRunningServerCheck_Checked"/>
<CheckBox x:Name="chkStopOnClose" Content="Stop running servers on app close" ToolTip="Instead of preventing app closing when there are running servers, stop all running servers" Margin="10,5" Grid.Row="0" Grid.Column="1" Checked="chkStopOnClose_Checked" Unchecked="chkStopOnClose_Checked"/>
<CheckBox x:Name="chkStartMinimized" Content="Start minimized" ToolTip="Minimize app on startup" Margin="10,5" Grid.Row="1" Grid.Column="0" Checked="chkStartMinimized_Checked" Unchecked="chkStartMinimized_Checked"/>
<CheckBox x:Name="chkLog" Content="Create log file" ToolTip="Write app log outpute to a file (useful for troubleshooting)" Margin="10,5" Grid.Row="1" Grid.Column="1" Checked="chkLog_Checked" Unchecked="chkLog_Checked"/>
</Grid>
</Grid>
</TabItem>
<TabItem Header="Log">
<RichTextBox x:Name="txtLog" IsReadOnly="True" IsTabStop="False">
<RichTextBox.ContextMenu>
<ContextMenu x:Name="menuLog" Opened="menuLog_Opened">
<MenuItem x:Name="menuLogSelectAll" Header="Select All" Click="menuLogSelectAll_Click">
<MenuItem.Icon>
<Image Source="Resources/SelectAll_32x.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="menuLogCopy" Header="Copy" Click="menuLogCopy_Click">
<MenuItem.Icon>
<Image Source="Resources/Copy_32x.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="menuLogClear" Header="Clear" Click="menuLogClear_Click">
<MenuItem.Icon>
<Image Source="Resources/Cancel_32x.png"/>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</RichTextBox.ContextMenu>
</RichTextBox>
</TabItem>
</TabControl>
<StatusBar x:Name="statusbarMain" VerticalAlignment="Bottom" Grid.Row="1">
<StatusBarItem Margin="0,0,10,0">
<Button x:Name="btnReportBug" Height="26" ToolTip="Report a bug" Click="btnReportBug_Click">
<Button.Content>
<Image Source="Resources\Bug_32x.png"/>
</Button.Content>
</Button>
</StatusBarItem>
<StatusBarItem>
<Label x:Name="lblLastMessage" Margin="5"></Label>
</StatusBarItem>
</StatusBar>
</Grid>
</Window>