mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-26 16:41:50 +01:00
Take advantage of data binding for UDP Server settings controls
Related to issue #1151
This commit is contained in:
parent
a51d789177
commit
7339afdd61
@ -281,11 +281,11 @@
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Height="20" Margin="{StaticResource spaceMargin}">
|
||||
<CheckBox x:Name="useUdpServerCk" Content="UDP Server" IsChecked="{Binding UseUDPServer}" Click="UseUdpServerCk_Click" />
|
||||
<TextBox x:Name="udpServerTxt" IsEnabled="False" Text="{Binding UdpIpAddress, UpdateSourceTrigger=LostFocus,FallbackValue='127.0.0.1'}"
|
||||
<TextBox x:Name="udpServerTxt" IsEnabled="{Binding UseUDPServer,Mode=OneWay}" Text="{Binding UdpIpAddress, UpdateSourceTrigger=LostFocus,FallbackValue='127.0.0.1'}"
|
||||
Margin="8,0,0,0" />
|
||||
<Label Content="Port" Padding="0" Margin="20,0,0,0" />
|
||||
<!--<TextBox x:Name="updPortNum" IsEnabled="False" Text="{Binding UdpPort, UpdateSourceTrigger=LostFocus,FallbackValue='26760'}" />-->
|
||||
<xctk:IntegerUpDown d:IsHidden="True" x:Name="updPortNum" IsEnabled="False" MinWidth="20" Margin="8,0,0,0"
|
||||
<!--<TextBox x:Name="updPortNum" IsEnabled="{Binding UseUDPServer}" Text="{Binding UdpPort, UpdateSourceTrigger=LostFocus,FallbackValue='26760'}" />-->
|
||||
<xctk:IntegerUpDown d:IsHidden="True" x:Name="updPortNum" IsEnabled="{Binding UseUDPServer,Mode=OneWay}" MinWidth="20" Margin="8,0,0,0"
|
||||
Value="{Binding UdpPort, UpdateSourceTrigger=LostFocus,FallbackValue='26760'}" ButtonSpinnerLocation="Right" Increment="1" Maximum="65535" Minimum="0" />
|
||||
</StackPanel>
|
||||
<!--<StackPanel Orientation="Horizontal">
|
||||
|
@ -1041,8 +1041,6 @@ Suspend support not enabled.", true);
|
||||
private async void UseUdpServerCk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool status = useUdpServerCk.IsChecked == true;
|
||||
udpServerTxt.IsEnabled = status;
|
||||
updPortNum.IsEnabled = status;
|
||||
if (!status)
|
||||
{
|
||||
App.rootHub.ChangeMotionEventStatus(status);
|
||||
|
@ -153,7 +153,18 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
}
|
||||
}
|
||||
public event EventHandler CheckEveryUnitChanged;
|
||||
public bool UseUDPServer { get => DS4Windows.Global.isUsingUDPServer(); set => DS4Windows.Global.setUsingUDPServer(value); }
|
||||
public bool UseUDPServer
|
||||
{
|
||||
get => DS4Windows.Global.isUsingUDPServer();
|
||||
set
|
||||
{
|
||||
if (DS4Windows.Global.isUsingUDPServer() == value) return;
|
||||
DS4Windows.Global.setUsingUDPServer(value);
|
||||
UseUDPServerChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
public event EventHandler UseUDPServerChanged;
|
||||
|
||||
public string UdpIpAddress { get => DS4Windows.Global.getUDPServerListenAddress();
|
||||
set => DS4Windows.Global.setUDPServerListenAddress(value); }
|
||||
public int UdpPort { get => DS4Windows.Global.getUDPServerPortNum(); set => DS4Windows.Global.setUDPServerPort(value); }
|
||||
|
Loading…
Reference in New Issue
Block a user