using CompressorXN_Model.Enums;
using CompressorXN_Model.ViewModel.Plc;
using CompressorXN_Model.ViewModel.Response;
using HslCommunication.Profinet.Omron;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
namespace CompressorXN_Common
{
///
/// 全局变量
///
public static class GlobalVar
{
///
/// 系统版本号
///
public static string SystemVersion { get; set; }
///
/// Ini文件路径
///
public static string IniFilePath { get; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemConfig.ini");
public static CancellationTokenSource Home_cts;//用于控制HOME界面线程
///
/// PLC点位--设备信息
///
public static DeviceInfo deviceInfo = null;
public static AgreementMsgVM agreementMsgVM = new AgreementMsgVM();
///
/// 使用中产品型号(机种码)
///
public static int ProductTypeIndex;
///
/// 实时转速
///
public static int RealSpeed { get; set; } = 0;
#region 启动方式
public static event Action StartTypeValueChanged;
private static string _startType=string.Empty;
///
/// 产品型号名称
///
public static string StartType
{
get { return _startType; }
set
{
string oldValue = _startType;
_startType = value;
if (oldValue != _startType && StartTypeValueChanged != null)
{
StartTypeValueChanged(oldValue, value);
}
}
}
#endregion
public static event Action ValueChanged;
private static string _productTypeName;
///
/// 产品型号名称
///
public static string ProductTypeName
{
get { return _productTypeName; }
set
{
string oldValue = _productTypeName;
_productTypeName = value;
if (oldValue != _productTypeName && ValueChanged != null)
{
ValueChanged(oldValue, value);
}
}
}
#region TMS
public static StepEnum stepEnum;
public static int DevHandle = 0;
public static Byte WriteCANIndex = 0;
public static Byte ReadCANIndex = 0;
public static bool CAN_ReadMsgFlag = false;
public static bool CAN_SendMsgFlag = false;
public static bool LIN_SendMsgFlag = false;
public static bool LIN_GetMsgFlag = false;
#endregion
#region 曲线
public static List times = new List();
public static List OutPress = new List();//出口压力
public static List InPress = new List();//进口压力
public static List JarPress = new List();//罐压力
public static List Voltage = new List();//电压
public static List Current = new List();//电流
public static List Noise = new List();//噪音
public static List X_Vibrate = new List();//X轴震动
public static List Y_Vibrate = new List();//Y轴震动
public static List Z_Vibrate = new List();//Z轴震动
#endregion
#region PLC相关
///
/// 读取PLC的频率
///
public static int ReadPlcRate = 1000;
///
/// PLC IP地址
///
public static string PlcIpAddress { get; set; } = "127.0.0.1";
///
/// PLC端口
///
public static int PlcPort { get; set; } = 44818;
///
/// PLC连接状态
///
public static bool PlcConnectState { get; set; } = false;
///
/// PLC链接对象
///
public static OmronCipNet omronCipNet = null;
#endregion
}
}