diff --git a/XplorePlane/Views/Setting/CameraSettingsWindow.xaml b/XplorePlane/Views/Setting/CameraSettingsWindow.xaml index 413c33d..a0e9ddc 100644 --- a/XplorePlane/Views/Setting/CameraSettingsWindow.xaml +++ b/XplorePlane/Views/Setting/CameraSettingsWindow.xaml @@ -2,56 +2,149 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="相机参数设置" - Width="320" Height="420" + Width="340" Height="440" WindowStartupLocation="CenterOwner" - ResizeMode="NoResize" - ShowInTaskbar="False"> - + ResizeMode="NoResize" ShowInTaskbar="False" + Background="#F5F5F5" FontFamily="Microsoft YaHei UI"> + + + + + + + + + + + + + + + + + + + + + + + - - - + + - \ No newline at end of file + diff --git a/XplorePlane/Views/Setting/CameraSettingsWindow.xaml.cs b/XplorePlane/Views/Setting/CameraSettingsWindow.xaml.cs index e9f43f9..338c524 100644 --- a/XplorePlane/Views/Setting/CameraSettingsWindow.xaml.cs +++ b/XplorePlane/Views/Setting/CameraSettingsWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Windows; +using System.Windows.Input; namespace XplorePlane.Views { @@ -9,5 +10,24 @@ namespace XplorePlane.Views InitializeComponent(); DataContext = viewModel; } + + private void ApplyAll_Click(object sender, RoutedEventArgs e) + { + var dc = DataContext; + if (dc == null) return; + var type = dc.GetType(); + ExecuteCommand(type, dc, "ApplyExposureCommand"); + ExecuteCommand(type, dc, "ApplyGainCommand"); + ExecuteCommand(type, dc, "ApplyWidthCommand"); + ExecuteCommand(type, dc, "ApplyHeightCommand"); + ExecuteCommand(type, dc, "ApplyPixelFormatCommand"); + } + + private static void ExecuteCommand(System.Type type, object dc, string cmdName) + { + var prop = type.GetProperty(cmdName); + if (prop?.GetValue(dc) is ICommand cmd && cmd.CanExecute(null)) + cmd.Execute(null); + } } -} \ No newline at end of file +}