This commit is contained in:
Binary file not shown.
6
App.xaml
6
App.xaml
@@ -3,5 +3,11 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<!-- 全局样式定义 -->
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
38
Models/DeviceDataModel.cs
Normal file
38
Models/DeviceDataModel.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace MembranePoreTester.Models
|
||||
{
|
||||
public partial class DeviceDataModel : ObservableObject
|
||||
{
|
||||
// 灯条数据
|
||||
[ObservableProperty] private double _upperLampData1;
|
||||
[ObservableProperty] private double _lowerLampData1;
|
||||
[ObservableProperty] private double _upperLampData2;
|
||||
[ObservableProperty] private double _lowerLampData2;
|
||||
[ObservableProperty] private double _upperLampData3;
|
||||
[ObservableProperty] private double _lowerLampData3;
|
||||
[ObservableProperty] private double _upperLampData4;
|
||||
[ObservableProperty] private double _lowerLampData4;
|
||||
[ObservableProperty] private double _upperLampData5;
|
||||
[ObservableProperty] private double _lowerLampData5;
|
||||
[ObservableProperty] private double _upperLampData6;
|
||||
[ObservableProperty] private double _lowerLampData6;
|
||||
|
||||
// 面积系数
|
||||
[ObservableProperty] private double _leftEyeAreaCoeff;
|
||||
[ObservableProperty] private double _rightEyeAreaCoeff;
|
||||
[ObservableProperty] private double _saveRateCorrectionCoeff;
|
||||
|
||||
// 中灯
|
||||
[ObservableProperty] private double _middleLamp1;
|
||||
[ObservableProperty] private double _middleLamp2;
|
||||
[ObservableProperty] private double _middleLamp3;
|
||||
[ObservableProperty] private double _middleLamp4;
|
||||
[ObservableProperty] private double _middleLamp5;
|
||||
[ObservableProperty] private double _middleLamp6;
|
||||
[ObservableProperty] private double _middleLamp7;
|
||||
|
||||
// 电机限位
|
||||
[ObservableProperty] private double _motorLimit;
|
||||
}
|
||||
}
|
||||
50
Service/HardwareService.cs
Normal file
50
Service/HardwareService.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using MembranePoreTester.Models;
|
||||
|
||||
namespace MembranePoreTester.Services
|
||||
{
|
||||
public class HardwareService : IHardwareService
|
||||
{
|
||||
public DeviceDataModel LoadDeviceData()
|
||||
{
|
||||
// TODO: 实现硬件读取逻辑
|
||||
throw new NotImplementedException("请在此处实现硬件读取逻辑");
|
||||
}
|
||||
|
||||
public void SaveDeviceData(DeviceDataModel data)
|
||||
{
|
||||
// TODO: 实现硬件保存逻辑
|
||||
throw new NotImplementedException("请在此处实现硬件保存逻辑");
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
// TODO: 实现复位指令
|
||||
throw new NotImplementedException("请在此处实现复位指令");
|
||||
}
|
||||
|
||||
public void OpenLeftEye()
|
||||
{
|
||||
// TODO: 实现左眼开指令
|
||||
throw new NotImplementedException("请在此处实现左眼开指令");
|
||||
}
|
||||
|
||||
public void OpenRightEye()
|
||||
{
|
||||
// TODO: 实现右眼开指令
|
||||
throw new NotImplementedException("请在此处实现右眼开指令");
|
||||
}
|
||||
|
||||
public void ReverseMotor()
|
||||
{
|
||||
// TODO: 实现电机反转
|
||||
throw new NotImplementedException("请在此处实现电机反转");
|
||||
}
|
||||
|
||||
public void ForwardMotor()
|
||||
{
|
||||
// TODO: 实现电机正转
|
||||
throw new NotImplementedException("请在此处实现电机正转");
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Service/IHardwareService.cs
Normal file
22
Service/IHardwareService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using MembranePoreTester.Models;
|
||||
|
||||
namespace MembranePoreTester.Services
|
||||
{
|
||||
public interface IHardwareService
|
||||
{
|
||||
// 读取设备全部参数
|
||||
DeviceDataModel LoadDeviceData();
|
||||
|
||||
// 保存设备全部参数
|
||||
void SaveDeviceData(DeviceDataModel data);
|
||||
|
||||
// 控制命令
|
||||
void Reset();
|
||||
void OpenLeftEye();
|
||||
void OpenRightEye();
|
||||
void ReverseMotor();
|
||||
void ForwardMotor();
|
||||
|
||||
// 可扩展其他方法...
|
||||
}
|
||||
}
|
||||
112
Styles.xaml
Normal file
112
Styles.xaml
Normal file
@@ -0,0 +1,112 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- 主窗口背景 -->
|
||||
<SolidColorBrush x:Key="WindowBackground" Color="#1E1E2F" />
|
||||
|
||||
<!-- 卡片背景 -->
|
||||
<SolidColorBrush x:Key="CardBackground" Color="#2D2D3A" />
|
||||
|
||||
<!-- 按钮样式 -->
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="#3A6EA5" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="12,6" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="6"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#2C5A8C" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#1F3F60" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- 文本框样式 -->
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Background" Value="#3A3A4A" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="BorderBrush" Value="#555" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="6,4" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="CaretBrush" Value="White" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#3A6EA5" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- 标签样式 -->
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="Foreground" Value="#DDD" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<!-- GroupBox 样式 -->
|
||||
<Style TargetType="GroupBox">
|
||||
<Setter Property="BorderBrush" Value="#3A6EA5" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Background" Value="{StaticResource CardBackground}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Margin" Value="8" />
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="GroupBox">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="8">
|
||||
<Grid Margin="{TemplateBinding Padding}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0"
|
||||
Background="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="4,4,0,0"
|
||||
Margin="-8,-8,-8,0"
|
||||
Padding="8,4">
|
||||
<ContentPresenter ContentSource="Header"
|
||||
RecognizesAccessKey="True"
|
||||
TextElement.Foreground="White"
|
||||
TextElement.FontWeight="Bold"/>
|
||||
</Border>
|
||||
<ContentPresenter Grid.Row="1" Margin="0,8,0,0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
121
ViewModels/MainViewModel.cs
Normal file
121
ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MembranePoreTester.ViewModels;
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using MembranePoreTester.Models;
|
||||
using MembranePoreTester.Services;
|
||||
|
||||
namespace MembranePoreTester.ViewModels
|
||||
{
|
||||
public partial class MainViewModel : ViewModelBase
|
||||
{
|
||||
private readonly IHardwareService _hardwareService;
|
||||
|
||||
// 设备数据模型(界面绑定用)
|
||||
[ObservableProperty]
|
||||
private DeviceDataModel _deviceData = new DeviceDataModel();
|
||||
|
||||
// 通信状态
|
||||
[ObservableProperty]
|
||||
private string _communicationStatus = "未连接";
|
||||
|
||||
// 状态颜色
|
||||
[ObservableProperty]
|
||||
private SolidColorBrush _statusColor = new SolidColorBrush(Colors.Red);
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
// 注入硬件服务(实际项目中可用依赖注入)
|
||||
_hardwareService = new HardwareService();
|
||||
}
|
||||
|
||||
// 保存参数到硬件
|
||||
[RelayCommand]
|
||||
private void SaveParameters()
|
||||
{
|
||||
// 用户实现:调用硬件服务将 DeviceData 中的参数写入设备
|
||||
// _hardwareService.SaveDeviceData(DeviceData);
|
||||
CommunicationStatus = "参数已保存";
|
||||
StatusColor = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
// 从硬件读取参数
|
||||
[RelayCommand]
|
||||
private void LoadParameters()
|
||||
{
|
||||
// 用户实现:从硬件读取数据并更新 DeviceData
|
||||
// var data = _hardwareService.LoadDeviceData();
|
||||
// DeviceData = data;
|
||||
CommunicationStatus = "参数已读取";
|
||||
StatusColor = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
// 复位
|
||||
[RelayCommand]
|
||||
private void Reset()
|
||||
{
|
||||
// 用户实现:调用硬件复位
|
||||
// _hardwareService.Reset();
|
||||
CommunicationStatus = "复位指令已发送";
|
||||
}
|
||||
|
||||
// 左眼开
|
||||
[RelayCommand]
|
||||
private void OpenLeftEye()
|
||||
{
|
||||
// _hardwareService.OpenLeftEye();
|
||||
CommunicationStatus = "左眼开启指令已发送";
|
||||
}
|
||||
|
||||
// 右眼开
|
||||
[RelayCommand]
|
||||
private void OpenRightEye()
|
||||
{
|
||||
// _hardwareService.OpenRightEye();
|
||||
CommunicationStatus = "右眼开启指令已发送";
|
||||
}
|
||||
|
||||
// 反转
|
||||
[RelayCommand]
|
||||
private void Reverse()
|
||||
{
|
||||
// _hardwareService.ReverseMotor();
|
||||
CommunicationStatus = "反转指令已发送";
|
||||
}
|
||||
|
||||
// 正转
|
||||
[RelayCommand]
|
||||
private void Forward()
|
||||
{
|
||||
// _hardwareService.ForwardMotor();
|
||||
CommunicationStatus = "正转指令已发送";
|
||||
}
|
||||
|
||||
// 导航命令(供用户自行实现页面跳转)
|
||||
[RelayCommand]
|
||||
private void NavigateHome()
|
||||
{
|
||||
// 用户实现:切换到主页视图
|
||||
CommunicationStatus = "导航至主页";
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateTest()
|
||||
{
|
||||
CommunicationStatus = "导航至测试界面";
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateDataRecord()
|
||||
{
|
||||
CommunicationStatus = "导航至数据记录";
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateRecordScreen()
|
||||
{
|
||||
CommunicationStatus = "导航至记录画面";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using MembranePoreTester.Communication;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using MembranePoreTester.Communication;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace MembranePoreTester.ViewModels
|
||||
{
|
||||
public class ViewModelBase : INotifyPropertyChanged
|
||||
public class ViewModelBase : ObservableObject
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
189
Views/MainWindow.xaml
Normal file
189
Views/MainWindow.xaml
Normal file
@@ -0,0 +1,189 @@
|
||||
<Window x:Class="MembranePoreTester.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:MembranePoreTester"
|
||||
Title="设备控制系统"
|
||||
Width="1024" Height="768"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ResizeMode="NoResize"
|
||||
Background="{StaticResource WindowBackground}">
|
||||
<Grid Margin="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextBlock Grid.Row="0" Text="智能设备控制平台" FontSize="24" FontWeight="Bold"
|
||||
Foreground="White" HorizontalAlignment="Center" Margin="0,0,0,12"/>
|
||||
|
||||
<!-- 主要内容区 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧参数区 -->
|
||||
<ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="0,0,12,0">
|
||||
<!-- 灯条数据组 -->
|
||||
<GroupBox Header="灯条数据">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="上灯条数据1"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding DeviceData.UpperLampData1, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="下灯条数据1"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding DeviceData.LowerLampData1, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="上灯条数据2"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DeviceData.UpperLampData2, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="下灯条数据2"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding DeviceData.LowerLampData2, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0" Content="上灯条数据3"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding DeviceData.UpperLampData3, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="下灯条数据3"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding DeviceData.LowerLampData3, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="上灯条数据4"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="3" Text="{Binding DeviceData.UpperLampData4, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="2" Content="下灯条数据4"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding DeviceData.LowerLampData4, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="2" Content="上灯条数据5"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding DeviceData.UpperLampData5, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="2" Content="下灯条数据5"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding DeviceData.LowerLampData5, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="2" Content="上灯条数据6"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="3" Text="{Binding DeviceData.UpperLampData6, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="2" Content="下灯条数据6"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="3" Text="{Binding DeviceData.LowerLampData6, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 面积系数组 -->
|
||||
<GroupBox Header="面积系数">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="左眼面积系数"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding DeviceData.LeftEyeAreaCoeff, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="右眼面积系数"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding DeviceData.RightEyeAreaCoeff, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="保存率矫正系数"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DeviceData.SaveRateCorrectionCoeff, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 中灯数据组 -->
|
||||
<GroupBox Header="中灯数据">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="中灯1"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp1, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="中灯2"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp2, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="中灯3"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp3, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="中灯4"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp4, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0" Content="中灯5"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp5, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="中灯6"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp6, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
|
||||
<Label Grid.Row="6" Grid.Column="0" Content="中灯7"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding DeviceData.MiddleLamp7, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- 右侧控制区 -->
|
||||
<StackPanel Grid.Column="1" Margin="12,0,0,0">
|
||||
<!-- 电机限位 -->
|
||||
<GroupBox Header="电机状态">
|
||||
<StackPanel Margin="5">
|
||||
<Label Content="电机限位"/>
|
||||
<TextBox Text="{Binding DeviceData.MotorLimit, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12"/>
|
||||
<Button Content="保存参数" Command="{Binding SaveParametersCommand}" Margin="0,5"/>
|
||||
<Button Content="读取参数" Command="{Binding LoadParametersCommand}" Margin="0,5"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 控制按钮组 -->
|
||||
<GroupBox Header="设备控制">
|
||||
<WrapPanel Margin="5">
|
||||
<Button Content="复位" Command="{Binding ResetCommand}" Width="80" Margin="5"/>
|
||||
<Button Content="左眼开" Command="{Binding OpenLeftEyeCommand}" Width="80" Margin="5"/>
|
||||
<Button Content="反转" Command="{Binding ReverseCommand}" Width="80" Margin="5"/>
|
||||
<Button Content="右眼开" Command="{Binding OpenRightEyeCommand}" Width="80" Margin="5"/>
|
||||
<Button Content="正转" Command="{Binding ForwardCommand}" Width="80" Margin="5"/>
|
||||
</WrapPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- 通信状态(可选) -->
|
||||
<GroupBox Header="通信状态">
|
||||
<TextBlock Text="{Binding CommunicationStatus}" Foreground="{Binding StatusColor}" FontWeight="Bold" Margin="5"/>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 底部导航栏 -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,12,0,0">
|
||||
<Button Content="主页" Command="{Binding NavigateHomeCommand}" Width="100" Margin="5"/>
|
||||
<Button Content="测试界面" Command="{Binding NavigateTestCommand}" Width="100" Margin="5"/>
|
||||
<Button Content="数据记录" Command="{Binding NavigateDataRecordCommand}" Width="100" Margin="5"/>
|
||||
<Button Content="记录画面" Command="{Binding NavigateRecordScreenCommand}" Width="100" Margin="5"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
14
Views/MainWindow.xaml.cs
Normal file
14
Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Windows;
|
||||
using MembranePoreTester.ViewModels;
|
||||
|
||||
namespace MembranePoreTester
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new MainViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Report\" />
|
||||
<Folder Include="Views\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user