Files
CapMachine/CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs
2024-07-05 17:43:02 +08:00

141 lines
3.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using CapMachine.Core;
using CapMachine.Wpf.PrismEvent;
using Prism.Commands;
using Prism.Events;
using Prism.Services.Dialogs;
using SharpDX.Direct3D9;
using System;
using System.Windows;
namespace CapMachine.Wpf.ViewModels
{
public class RealTimeChartViewModel : NavigationViewModel
{
/// <summary>
/// 实例化函数
/// </summary>
public RealTimeChartViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator)
{
DialogService = dialogService;
FreeSql = freeSql;
EventAggregator = eventAggregator;
}
/// <summary>
/// 弹窗服务
/// </summary>
public IDialogService DialogService { get; }
/// <summary>
/// FreeSQL 实例
/// </summary>
public IFreeSql FreeSql { get; }
/// <summary>
/// 事件聚合器
/// </summary>
public IEventAggregator EventAggregator { get; }
private DelegateCommand _ChartConfigCmd;
/// <summary>
/// 编辑曲线数据
/// </summary>
public DelegateCommand ChartConfigCmd
{
set
{
_ChartConfigCmd = value;
}
get
{
if (_ChartConfigCmd == null)
{
_ChartConfigCmd = new DelegateCommand(() => ChartConfigCmdMethod());
}
return _ChartConfigCmd;
}
}
/// <summary>
/// 编辑曲线数据执行方法
/// </summary>
private void ChartConfigCmdMethod()
{
//弹窗
DialogService.ShowDialog("DialogChartRtConfigView", new DialogParameters() { { "Name", "" } }, (par) =>
{
if (par.Result == ButtonResult.OK)
{
//程序名称
var ReturnValue = par.Parameters.GetValue<string>("Name");
//返回数据刷新Chart
EventAggregator.GetEvent<ChartRtActionEvent>().Publish(ChartActionType.ReLoadChart);
}
else if (par.Result == ButtonResult.Cancel)
{
//取消
}
});
}
#region 线
//private LightningChart _LightningChartInstance;
///// <summary>
///// LightningChart 实例
///// </summary>
//public LightningChart LightningChartInstance
//{
// get { return _LightningChartInstance; }
// set { _LightningChartInstance = value; RaisePropertyChanged(); }
//}
///// <summary>
///// 获取实例
///// </summary>
///// <param name="chart"></param>
//public void SetChart(LightningChart chart)
//{
// LightningChartInstance = chart;
//}
//private AxisYCollection _YAxes=new AxisYCollection();
///// <summary>
///// Y轴配置
///// </summary>
//public AxisYCollection YAxes
//{
// get { return _YAxes; }
// set { _YAxes = value; RaisePropertyChanged(); }
//}
//private AxisXCollection _XAxes = new AxisXCollection();
///// <summary>
///// X轴配置
///// </summary>
//public AxisXCollection XAxes
//{
// get { return _XAxes; }
// set { _XAxes = value; RaisePropertyChanged(); }
//}
//private SampleDataSeriesCollection _ChartDataSeries;
///// <summary>
///// 曲线集合数据
///// </summary>
//public SampleDataSeriesCollection ChartDataSeries
//{
// get { return _ChartDataSeries; }
// set { _ChartDataSeries = value; RaisePropertyChanged(); }
//}
#endregion
}
}