This commit is contained in:
sc committed 2024-11-15 00:03:41 +08:00
commit 5be2df4dda
3 files changed
+89 -35

No files matched your search

+44 -19
View File
@@ -23,12 +23,32 @@ using LiveChartsCore.Motion;
using SunlightCentralizedControlManagement_SCCM_.Properties;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using TouchSocket.Core;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
public class NotifyPropertyBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void Notify([CallerMemberName] string propName = "")
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}
protected void SetProperty<T>(ref T prop, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(prop, value) == false)
{
prop = value;
Notify(propertyName);
}
}
}
public partial class CurveDiagramViewModel : ObservableObject//ViewModelBase
{
public ISeries[] Series { get; set; }
public static ISeries[] Series { get; set; }
//x轴时间格式
public Axis[] XAxes { get; set; } =
{
@@ -104,31 +124,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}, //PH轴
};
private readonly Random _r = new Random();
private readonly ObservableCollection<DateTimePoint> MTT_values;
private readonly ObservableCollection<DateTimePoint> MTL_values;
private readonly ObservableCollection<DateTimePoint> MTH_values;
private readonly ObservableCollection<DateTimePoint> MST_values;
private readonly ObservableCollection<DateTimePoint> MUT_values;
private readonly ObservableCollection<DateTimePoint> STTA_values;
private readonly ObservableCollection<DateTimePoint> STLA_values;
private readonly ObservableCollection<DateTimePoint> STTB_values;
private readonly ObservableCollection<DateTimePoint> STLB_values;
private readonly ObservableCollection<DateTimePoint> STTC_values;
private readonly ObservableCollection<DateTimePoint> STLC_values;
private static Random _r = new Random();
private static ObservableCollection<DateTimePoint> MTT_values;
private static ObservableCollection<DateTimePoint> MTL_values;
private static ObservableCollection<DateTimePoint> MTH_values;
private static ObservableCollection<DateTimePoint> MST_values;
private static ObservableCollection<DateTimePoint> MUT_values;
private static ObservableCollection<DateTimePoint> STTA_values;
private static ObservableCollection<DateTimePoint> STLA_values;
private static ObservableCollection<DateTimePoint> STTB_values;
private static ObservableCollection<DateTimePoint> STLB_values;
private static ObservableCollection<DateTimePoint> STTC_values;
private static ObservableCollection<DateTimePoint> STLC_values;
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
DataTable CDB = new DataTable();
private int CDB_Count;//长度
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private static string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
static DataTable CDB = new DataTable();
private static int CDB_Count;//长度
public CurveDiagramViewModel()
{
if (!string.IsNullOrEmpty(MainWindowViewModel.SYS_WorkNumder))
Curve("");
}
public static void Curve(string SYSWorkNumder)
{
if (!string.IsNullOrEmpty(SYSWorkNumder))
{
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + MainWindowViewModel.SYS_WorkNumder + "'order by Time", null).Tables[0];
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + SYSWorkNumder + "'order by Time", null).Tables[0];
SQLiteHelpers.Close();
CDB_Count = CDB.Rows.Count;