CAN功能移植兼容
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
using Logger;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Microsoft.Win32;
|
||||
using Model.Models;
|
||||
using Notifications.Wpf.Core;
|
||||
using System.Collections.Concurrent;
|
||||
@@ -147,7 +148,9 @@ namespace ADP.ViewModels
|
||||
public ICommand NewCommand { get; set; }
|
||||
public ICommand SetDefaultCommand { get; set; }
|
||||
public ICommand ShowDialogManagerViewCommand { get; set; }
|
||||
public ICommand SelectCANSignalMonitorCommand { get; set; }
|
||||
public ICommand SelectCANMessageCommand { get; set; }
|
||||
public ICommand GetFileStringCommand { get; set; }
|
||||
#endregion
|
||||
|
||||
public ShellViewModel(IContainerProvider containerProvider)
|
||||
@@ -177,7 +180,9 @@ namespace ADP.ViewModels
|
||||
SaveAsCommand = new DelegateCommand(SaveAs);
|
||||
SaveCommand = new DelegateCommand(Save);
|
||||
SetDefaultCommand = new DelegateCommand(SetDefault);
|
||||
SelectCANSignalMonitorCommand = new DelegateCommand(SelectCANSignalMonitor);
|
||||
SelectCANMessageCommand = new DelegateCommand(SelectCANMessage);
|
||||
GetFileStringCommand = new DelegateCommand(GetFileString);
|
||||
|
||||
_globalInfo.ContextDic.Add("default", new ScopedContext());
|
||||
|
||||
@@ -200,7 +205,7 @@ namespace ADP.ViewModels
|
||||
_uiRefreshTimer.Start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void RefreshAllContextProperties()
|
||||
{
|
||||
RaisePropertyChanged(nameof(RunState));
|
||||
@@ -211,6 +216,37 @@ namespace ADP.ViewModels
|
||||
}
|
||||
|
||||
#region 命令处理与事件
|
||||
private void GetFileString()
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Title = "选择文件",
|
||||
Filter = "所有文件 (*.*)|*.*",
|
||||
};
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string filePath = openFileDialog.FileName;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Clipboard.SetDataObject(filePath);
|
||||
});
|
||||
}
|
||||
}
|
||||
private void SelectCANSignalMonitor()
|
||||
{
|
||||
var canfd = CurrentConfig?.CANFD;
|
||||
if (canfd == null || _globalInfo.CurrentScope == "default")
|
||||
{
|
||||
LoggerHelper.Warn("当前作用域未配置 CAN 设备,无法打开报文选择窗口。");
|
||||
return;
|
||||
}
|
||||
|
||||
_dialogService.ShowDialog("CollectCANSignalSettingView", new DialogParameters
|
||||
{
|
||||
{ "SystemConfig", CurrentConfig }
|
||||
}, _ => { });
|
||||
}
|
||||
|
||||
private void SelectCANMessage()
|
||||
{
|
||||
var canfd = CurrentConfig?.CANFD;
|
||||
|
||||
@@ -158,13 +158,30 @@
|
||||
Foreground="Black" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<!-- CAN信号监控 -->
|
||||
<MenuItem Header="CAN信号监控"
|
||||
Foreground="Black"
|
||||
Command="{Binding SelectCANSignalMonitorCommand}">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="Message"
|
||||
Foreground="Black" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<!-- CAN报文选择 -->
|
||||
<MenuItem Header="CAN报文选择"
|
||||
Foreground="Black"
|
||||
Command="{Binding SelectCANMessageCommand}">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="Message"
|
||||
Foreground="Black" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<!-- 获得文件路径字符串 -->
|
||||
<MenuItem Header="获得文件路径字符串"
|
||||
Foreground="Black"
|
||||
Command="{Binding GetFileStringCommand}">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="File"
|
||||
Foreground="Black" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
Reference in New Issue
Block a user