Skip to content

Commit

Permalink
Merge branch 'main' into nr/chore/rememberCheckBoxStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyCuban committed Nov 15, 2024
2 parents a7f69ff + 917c6ef commit f07dc8c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ValheimServer/ValheimServer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,7 @@

<CheckBox x:Name="serverVisibilityCheckBox" IsChecked="{Binding ServerVisibilityCheckBox}" Content="{x:Static res:Resources.Server_Visibilty}" Grid.Column="3" Grid.Row="1"/>

<CheckBox x:Name="serverCrossPlayCheckBox" IsChecked="{Binding ServerCrossPlayCheckBox}" Content="{x:Static res:Resources.Server_Crossplay}" Grid.Column="3" Grid.Row="2"/>

</Grid>
</Window>
9 changes: 9 additions & 0 deletions ValheimServer/ValheimServer/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ValheimServer/ValheimServer/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<data name="Port_Name" xml:space="preserve">
<value>Port Number:</value>
</data>
<data name="Server_Crossplay" xml:space="preserve">
<value>Crossplay</value>
</data>
<data name="Server_Name" xml:space="preserve">
<value>Server Name:</value>
</data>
Expand Down
34 changes: 33 additions & 1 deletion ValheimServer/ValheimServer/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class MainWindowViewModel : ObservableObject
private string _passwordTextBox;
private string _hiddenTextBox;
private bool _serverVisibilityCheckBox = true;
private bool _serverCrossPlayCheckBox = false;

/// <summary>
/// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
Expand Down Expand Up @@ -190,6 +191,22 @@ public bool ServerVisibilityCheckBox
}
}

/// <summary>
/// Gets or Sets a value indicating whether the checkbox is visible.
/// </summary>
public bool ServerCrossPlayCheckBox
{
get
{
return _serverCrossPlayCheckBox;
}

set
{
SetProperty(ref _serverCrossPlayCheckBox, value);
}
}

private int ServerVisibiltyCheck
{
get
Expand All @@ -205,6 +222,21 @@ private int ServerVisibiltyCheck
}
}

private string ServerCrossPlayCheck
{
get
{
if (_serverCrossPlayCheckBox == true)
{
return "-crossplay";
}
else
{
return " ";
}
}
}

[RelayCommand]
private void SteamButtonClick()
{
Expand Down Expand Up @@ -254,7 +286,7 @@ private void ServerStartButtonClick()
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $@"/K set SteamAppId=892970 && {_installFolder}\\valheim_server.exe -nographics -batchmode -name ""{_serverTextBox}"" -port {_portTextBox} -world ""{_worldTextBox}"" -password ""{_passwordTextBox}"" -public {ServerVisibiltyCheck}",
Arguments = $@"/K set SteamAppId=892970 && {_installFolder}\\valheim_server.exe -nographics -batchmode -name ""{_serverTextBox}"" -port {_portTextBox} -world ""{_worldTextBox}"" -password ""{_passwordTextBox}"" -public {ServerVisibiltyCheck} {ServerCrossPlayCheck}",
UseShellExecute = false,
};

Expand Down

0 comments on commit f07dc8c

Please sign in to comment.