Fixed saving of custom steam folder setting

Related to issue #1072
This commit is contained in:
Travis Nickles 2020-01-25 05:27:36 -06:00
parent a94573362f
commit 68844a3a7a
3 changed files with 14 additions and 11 deletions

View File

@ -296,9 +296,9 @@
<local:LanguagePackControl Margin="{StaticResource spaceMargin}" /> <local:LanguagePackControl Margin="{StaticResource spaceMargin}" />
<StackPanel Margin="{StaticResource spaceMargin}"> <StackPanel Margin="{StaticResource spaceMargin}">
<CheckBox x:Name="customSteamCk" Content="Use custom Steam Folder" Margin="{StaticResource spaceMargin}" <CheckBox x:Name="customSteamCk" Content="Use custom Steam Folder" Margin="{StaticResource spaceMargin}"
IsChecked="{Binding UseCustomSteamFolder}" Click="CustomSteamCk_Click" /> IsChecked="{Binding UseCustomSteamFolder}" />
<TextBox x:Name="customSteamTxt" Text="{Binding CustomSteamFolder, UpdateSourceTrigger=LostFocus}" <TextBox x:Name="customSteamTxt" Text="{Binding CustomSteamFolder, UpdateSourceTrigger=LostFocus}"
IsEnabled="False" /> IsEnabled="{Binding UseCustomSteamFolder}" />
</StackPanel> </StackPanel>
<GroupBox Width="200" Header="Utils" BorderThickness="2" Margin="{StaticResource spaceMargin}" <GroupBox Width="200" Header="Utils" BorderThickness="2" Margin="{StaticResource spaceMargin}"

View File

@ -1244,12 +1244,6 @@ Suspend support not enabled.", true);
Close(); Close();
} }
private void CustomSteamCk_Click(object sender, RoutedEventArgs e)
{
bool state = customSteamCk.IsChecked == true;
customSteamTxt.IsEnabled = state;
}
private void SwipeTouchCk_Click(object sender, RoutedEventArgs e) private void SwipeTouchCk_Click(object sender, RoutedEventArgs e)
{ {
bool status = swipeTouchCk.IsChecked == true; bool status = swipeTouchCk.IsChecked == true;

View File

@ -157,8 +157,17 @@ namespace DS4WinWPF.DS4Forms.ViewModels
public string UdpIpAddress { get => DS4Windows.Global.getUDPServerListenAddress(); public string UdpIpAddress { get => DS4Windows.Global.getUDPServerListenAddress();
set => DS4Windows.Global.setUDPServerListenAddress(value); } set => DS4Windows.Global.setUDPServerListenAddress(value); }
public int UdpPort { get => DS4Windows.Global.getUDPServerPortNum(); set => DS4Windows.Global.setUDPServerPort(value); } public int UdpPort { get => DS4Windows.Global.getUDPServerPortNum(); set => DS4Windows.Global.setUDPServerPort(value); }
public bool UseCustomSteamFolder { get => DS4Windows.Global.UseCustomSteamFolder; public bool UseCustomSteamFolder
set => DS4Windows.Global.UseCustomSteamFolder = value; } {
get => DS4Windows.Global.UseCustomSteamFolder;
set
{
DS4Windows.Global.UseCustomSteamFolder = value;
UseCustomSteamFolderChanged?.Invoke(this, EventArgs.Empty);
}
}
public event EventHandler UseCustomSteamFolderChanged;
public string CustomSteamFolder public string CustomSteamFolder
{ {
get => DS4Windows.Global.CustomSteamFolder; get => DS4Windows.Global.CustomSteamFolder;
@ -166,7 +175,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
{ {
string temp = DS4Windows.Global.CustomSteamFolder; string temp = DS4Windows.Global.CustomSteamFolder;
if (temp == value) return; if (temp == value) return;
if (Directory.Exists(temp)) if (Directory.Exists(value) || value == string.Empty)
{ {
DS4Windows.Global.CustomSteamFolder = value; DS4Windows.Global.CustomSteamFolder = value;
} }