新增设置窗体

This commit is contained in:
zhengxuan.zhang
2026-05-06 14:13:19 +08:00
parent db8a37410f
commit 9a8831c945
5 changed files with 178 additions and 0 deletions
@@ -65,6 +65,7 @@ namespace XplorePlane.ViewModels
public DelegateCommand OpenLibraryVersionsCommand { get; }
public DelegateCommand OpenUserManualCommand { get; }
public DelegateCommand OpenCameraSettingsCommand { get; }
public DelegateCommand OpenSettingsCommand { get; }
public DelegateCommand NewCncProgramCommand { get; }
public DelegateCommand SaveCncProgramCommand { get; }
public DelegateCommand LoadCncProgramCommand { get; }
@@ -145,6 +146,7 @@ namespace XplorePlane.ViewModels
private Window _detectorConfigWindow;
private Window _plcAddrConfigWindow;
private Window _realTimeLogViewerWindow;
private Window _settingsWindow;
private Window _toolboxWindow;
private Window _raySourceConfigWindow;
private object _imagePanelContent;
@@ -212,6 +214,7 @@ namespace XplorePlane.ViewModels
OpenLibraryVersionsCommand = new DelegateCommand(() => ShowWindow(new Views.LibraryVersionsWindow(), "关于"));
OpenUserManualCommand = new DelegateCommand(ExecuteOpenUserManual);
OpenCameraSettingsCommand = new DelegateCommand(ExecuteOpenCameraSettings);
OpenSettingsCommand = new DelegateCommand(ExecuteOpenSettings);
NewCncProgramCommand = new DelegateCommand(() => ExecuteCncEditorAction(vm => vm.NewProgramCommand.Execute()));
SaveCncProgramCommand = new DelegateCommand(() => ExecuteCncEditorAction(vm => vm.SaveProgramCommand.Execute()));
LoadCncProgramCommand = new DelegateCommand(() => ExecuteCncEditorAction(vm => vm.LoadProgramCommand.Execute()));
@@ -377,6 +380,21 @@ namespace XplorePlane.ViewModels
}
}
private void ExecuteOpenSettings()
{
try
{
ShowOrActivate(_settingsWindow, w => _settingsWindow = w,
() => new Views.SettingsWindow(this), "Settings");
}
catch (Exception ex)
{
_logger.Error(ex, "Failed to open settings window");
MessageBox.Show($"Failed to open settings window: {ex.Message}",
"Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void ExecuteAxisReset()
{
var result = MessageBox.Show("确认执行轴复位操作?", "轴复位",
+13
View File
@@ -391,6 +391,19 @@
</telerik:RadRibbonTab>
<telerik:RadRibbonTab Header="设置">
<telerik:RadRibbonGroup Header="全局设置">
<telerik:RadRibbonGroup.Variants>
<telerik:GroupVariant Priority="0" Variant="Large" />
</telerik:RadRibbonGroup.Variants>
<telerik:RadRibbonButton
Size="Large"
SmallImage="/Assets/Icons/setting.png"
Command="{Binding OpenSettingsCommand}"
Text="全局设置" />
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup
telerik:ScreenTip.Description="Show the Alignment tab of the Format Cells dialog box."
telerik:ScreenTip.Title="Format Cells: Alignment"
@@ -1,4 +1,8 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Linq;
using Telerik.Windows.Controls;
using XplorePlane.ViewModels;
namespace XplorePlane.Views
@@ -12,6 +16,8 @@ namespace XplorePlane.Views
{
InitializeComponent();
DataContext = viewModel;
}
}
}
@@ -0,0 +1,128 @@
<Window x:Class="XplorePlane.Views.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="系统设置"
Width="860"
Height="620"
MinWidth="760"
MinHeight="540"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
Background="#F5F5F5">
<Window.Resources>
<Style x:Key="SectionTitleStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="#1F1F1F" />
<Setter Property="Margin" Value="0,0,0,12" />
</Style>
<Style x:Key="CardStyle" TargetType="Border">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="#D9D9D9" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Padding" Value="16" />
<Setter Property="Margin" Value="0,0,0,12" />
</Style>
<Style x:Key="ActionButtonStyle" TargetType="Button">
<Setter Property="Height" Value="32" />
<Setter Property="MinWidth" Value="110" />
<Setter Property="Margin" Value="0,0,10,10" />
<Setter Property="Padding" Value="12,0" />
</Style>
</Window.Resources>
<DockPanel Margin="12">
<TabControl Background="White">
<TabItem Header="通用">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="16">
<TextBlock Style="{StaticResource SectionTitleStyle}" Text="通用设置" />
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock FontSize="13"
FontWeight="SemiBold"
Text="界面与使用习惯" />
<CheckBox Margin="0,12,0,0"
Content="启动时默认显示实时图像" />
<CheckBox Margin="0,8,0,0"
Content="允许自动恢复上次工作状态" />
<CheckBox Margin="0,8,0,0"
Content="启用状态栏详细提示" />
</StackPanel>
</Border>
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock FontSize="13"
FontWeight="SemiBold"
Text="调试" />
<WrapPanel>
<Button Command="{Binding OpenLibraryVersionsCommand}"
Content="版本信息"
Style="{StaticResource ActionButtonStyle}" />
</WrapPanel>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</TabItem>
<TabItem Header="报告">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="16">
<TextBlock Style="{StaticResource SectionTitleStyle}" Text="报告设置" />
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock FontSize="13"
FontWeight="SemiBold"
Text="报告模板" />
<TextBlock Margin="0,10,0,8"
Foreground="#666666"
Text="这里预留报告输出相关设置,可继续扩展公司信息、模板路径、签核信息和导出规则。" />
<Grid Margin="0,4,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="报告标题:" />
<TextBox Grid.Column="1"
Height="30"
Padding="8,0"
Text="检测报告" />
</Grid>
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="模板路径:" />
<TextBox Grid.Column="1"
Height="30"
Padding="8,0"
Text="C:\Reports\Templates\Default" />
</Grid>
<CheckBox Margin="0,12,0,0"
Content="导出时自动附带原始图像" />
<CheckBox Margin="0,8,0,0"
Content="导出时自动附带处理结果图像" />
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl>
</DockPanel>
</Window>
@@ -0,0 +1,13 @@
using System.Windows;
namespace XplorePlane.Views
{
public partial class SettingsWindow : Window
{
public SettingsWindow(object viewModel)
{
InitializeComponent();
DataContext = viewModel;
}
}
}