BOB/BOB/ViewModels/Dialogs/CANViewModel.cs
2025-12-04 17:11:48 +08:00

108 lines
2.8 KiB
C#

using BOB.Singleton;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace BOB.ViewModels.Dialogs
{
public class CANViewModel : BindableBase, IDialogAware
{
#region
private string _Title = "同星CAN";
public string Title
{
get { return _Title; }
set { SetProperty(ref _Title, value); }
}
private string _BLFPath;
public string BLFPath
{
get { return _BLFPath; }
set { SetProperty(ref _BLFPath, value); }
}
#endregion
#region
public ICommand SelectBLFPathCommand { get; set; }
public ICommand SaveBLFPathCommand { get; set; }
public ICommand StartTranscirbeCommand { get; set; }
public ICommand EndTranscirbeCommand { get; set; }
#endregion
private IEventAggregator _eventAggregator { get; set; }
private Devices _devices { get; set; }
private GlobalVariables _globalVariables { get; set; }
public CANViewModel(IContainerProvider containerProvider)
{
_devices = containerProvider.Resolve<Devices>();
_globalVariables = containerProvider.Resolve<GlobalVariables>();
_eventAggregator = containerProvider.Resolve<IEventAggregator>();
SelectBLFPathCommand = new DelegateCommand(SelectBLFPath);
SaveBLFPathCommand = new DelegateCommand(SaveBLFPath);
StartTranscirbeCommand = new DelegateCommand(StartTranscirbe);
EndTranscirbeCommand = new DelegateCommand(EndTranscirbe);
}
#region
private void EndTranscirbe()
{
}
private void StartTranscirbe()
{
}
private void SaveBLFPath()
{
}
private void SelectBLFPath()
{
var dialog = new SaveFileDialog
{
Title = "保存 CAN报文回放 BLF 文件",
Filter = "BLF 文件 (*.blf)|*.blf|所有文件 (*.*)|*.*",
DefaultExt = ".blf",
FileName = "log.blf",
OverwritePrompt = true
};
if (dialog.ShowDialog() == true)
{
BLFPath = Path.GetFullPath(dialog.FileName);
}
}
#endregion
#region dialog规范
public DialogCloseListener RequestClose { get; set; }
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
public void OnDialogOpened(IDialogParameters parameters)
{
}
#endregion
}
}