private void Create_historyOper() { if (historyOper == null) { historyOper = new HistoryOperator(); historyOper.CanDatapool = CDataPool.GetDataPoolObject(); } }
private void comboBox_PumpErr_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex >= 0 && comboBox2.SelectedIndex >= 0 && comboBox_PumpErr.SelectedIndex >= 0) { ((CheckBox)rb_Error_Pump).Checked = CDataPool.GetDataPoolObject().GetBoolValue( comboBox1.SelectedIndex, comboBox_PumpErr.SelectedIndex, (CmdDataType)rb_Error_Pump.Tag); } }
private void Create_WarnErrOper() { if (WarnErrOper == null) { WarnErrOper = new WarnErrOperator(); WarnErrOper.CanDatapool = CDataPool.GetDataPoolObject(); WarnErrOper.OnWarnErrChanged += new EventHandler(DoWarn); } }
public void Create_pvHistory() { if (pvHistory == null) { pvHistory = new PageViewHistory(); pvHistory.Location = bigviewLocation; pvHistory.Size = bigviewsize; pvHistory.Enabled = false; pvHistory.CanDatapool = CDataPool.GetDataPoolObject(); pvHistory.HistoryOper = this.historyOper; this.Controls.Add(this.pvHistory); } }
private void timerLoad_Tick(object sender, EventArgs e) { //this.timerLoad.Enabled = false; if (isFontExists()) LoadFont(); UpdateWarnErrorLabel(0, 0); bigviewLocation = new System.Drawing.Point(0, panel_Head.Height); smallviewLocation = new System.Drawing.Point(0, panel_Head.Height); smallviewsize = new System.Drawing.Size(this.Width, this.Height - panel_Head.Height); bigviewsize = new System.Drawing.Size(this.Width, this.Height - panel_Head.Height); #if WindowsCE AdvaCanBusObj = AdvaCanBus.GetAdvaCanBus(); CDataPool.GetDataPoolObject().LoadFromFile(); //AdvaCanBusObj.CanDatapool = CDataPool.GetDataPoolObject(); if (!AdvaCanBusObj.Open()) { //MessageBox.Show(AdvaCanBusObj.canErrStrArray[AdvaCanBusObj.CanErrCode]); MessageBox.Show(AdvaCanBusObj.canErrStrArray[AdvaCanBusObj.CanErrCode], "", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); return; } #else //this.FormBorderStyle = FormBorderStyle.Fixed3D; this.ControlBox = true; this.MinimizeBox = true; this.MaximizeBox = false; CDataPool.GetDataPoolObject().LoadFromFile(); #endif //imageLabel_MAC_Click(null, new EventArgs()); Application.DoEvents(); Create_WarnErrOper(); Create_historyOper(); WarnErrThreadStart(); historyRecordThreadStart(); }
private void DoUpdate() { if (comboBox1.SelectedIndex >= 0 && comboBox2.SelectedIndex >= 0 && comboBox_PumpErr.SelectedIndex >= 0) { foreach (KeyValuePair <Control, List <MotionStateType> > item in doubleDic) { ((ComboBox)item.Key).SelectedIndex = CDataPool.GetDataPoolObject().GetintValue( comboBox1.SelectedIndex, comboBox2.SelectedIndex, (CmdDataType)item.Key.Tag); } foreach (KeyValuePair <Control, List <Int32> > item in IntDic) { item.Key.Text = CDataPool.GetDataPoolObject().GetRealValue( comboBox1.SelectedIndex, comboBox2.SelectedIndex, (CmdDataType)item.Key.Tag).ToString(); } foreach (KeyValuePair <Control, List <bool> > item in boolDic) { if (item.Key == rb_Error_Pump) { ((CheckBox)item.Key).Checked = CDataPool.GetDataPoolObject().GetBoolValue( comboBox1.SelectedIndex, comboBox_PumpErr.SelectedIndex, (CmdDataType)item.Key.Tag); } else { ((CheckBox)item.Key).Checked = CDataPool.GetDataPoolObject().GetBoolValue( comboBox1.SelectedIndex, comboBox2.SelectedIndex, (CmdDataType)item.Key.Tag); } } comboBox_PumpErr.SelectedIndex = 0; } }
private void OnClick(object Sender, EventArgs e) { KeypadForm f = KeypadForm.GetKeypadForm("0", KeypadMode.Normal); if (f.ShowDialog() == DialogResult.OK) { ((ImageLabel)Sender).Text = f.KeyText; if (Sender == il_Pressure_Pump || // 泵站压力 4 Sender == rb__PowerSupply || Sender == il_Voltage) // 控制器电压 4 { IntDic[(Control)Sender] [comboBox1.SelectedIndex] = Convert.ToInt32(f.KeyText); } else if (Sender == il_idControl) { CDataPool.GetDataPoolObject().out_id_controledPump = Convert.ToByte(f.KeyText); } else if (Sender == il_idrongyu) { CDataPool.GetDataPoolObject().out_id_redundantPump = Convert.ToByte(f.KeyText); } else { //in_Pressure_Pump_Real_3301_3304.Add(0); //in_Voltage_Real_3301_3304.Add(0); IntDic[(Control)Sender] [comboBox1.SelectedIndex * 8 + comboBox2.SelectedIndex] = Convert.ToInt32(f.KeyText); } } }
private void panel_Head_MouseUp(object sender, MouseEventArgs e) { DateTime MouseUpTime = DateTime.Now; TimeSpan ts = (TimeSpan)(MouseUpTime - MouseDownTime); if (ts.TotalMilliseconds >= mouselast) { KeypadForm f = KeypadForm.GetKeypadForm("", KeypadMode.password); if (f.ShowDialog() == DialogResult.OK) { //退出程序,进入wince if (f.KeyText == password_EnterWinCE) { System.Diagnostics.Process.Start("explorer.exe", ""); //System.Diagnostics.Process.Start("\\NORFlash\\001\\COPY.bat", ""); Application.DoEvents(); Application.Exit(); } else if (f.KeyText == password_Update) //软件升级 { if (File.Exists("\\HardDisk\\AdvaMACSysUpdater.exe")) { System.Diagnostics.Process.Start("\\HardDisk\\AdvaMACSysUpdater.exe", ""); Application.DoEvents(); Application.Exit(); } else if (File.Exists("\\USB Hard Disk\\AdvaMACSysUpdater.exe")) { System.Diagnostics.Process.Start("\\USB Hard Disk\\AdvaMACSysUpdater.exe", ""); Application.DoEvents(); Application.Exit(); } } #if WindowsCE #else else if (f.KeyText == password_Test) //test { if (_VirtualSetForm == null) _VirtualSetForm = new VirtualSetForm(); _VirtualSetForm.Show(); } #endif else if (f.KeyText == password_Reset) //系统数据复位 { CDataPool.GetDataPoolObject().Reset(); if (WarnErrOper != null) WarnErrOper.Reset(); if (historyOper != null) historyOper.Reset(); } else if (f.KeyText == password_Backup_History)//历史记录备份 { FileCpyForm.GetFileCpyForm().StartCopy(); } } } }
public PageViewMAC() { InitializeComponent(); this.ForeColor = Color.Black; currentFont = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular); _candatapool = CDataPool.GetDataPoolObject(); //pump美化 pumpIcon = AdvaMACSystemRes.pump; pumpImages = new ImagesContaner(); pumpImages.DNImg = AdvaMACSystemRes.pumpborder_checked; pumpImages.UPImg = AdvaMACSystemRes.pumpborder; pumpImages.DNImgDisable = AdvaMACSystemRes.pumpborder_disable; pumpImages.UPImgDisaable = AdvaMACSystemRes.pumpborder_disable; //button美化 buttonImages = new ImagesContaner(); buttonImages.DNImg = AdvaMACSystemRes.MAC_down; buttonImages.UPImg = AdvaMACSystemRes.MAC_up; buttonImages.DNImgDisable = AdvaMACSystemRes.MAC_disable; buttonImages.UPImgDisaable = AdvaMACSystemRes.MAC_disable; //cylinder美化 progressBarImages = new CProgressBarImagesContainer(); progressBarImages.BgImage = AdvaMACSystemRes.graybar; progressBarImages.FrontImage = AdvaMACSystemRes.greenbar; progressBarImages.FrontImage_Unpass = AdvaMACSystemRes.redbar; progressBarImages.WarningImage = AdvaMACSystemRes.yellowbar; progressBarImages.SettingImage = AdvaMACSystemRes.bluebar; //new pumps pumpList = new List <CPumpButton>(); for (int j = 0; j < pumpNumber; j++) { CPumpButton pumpBlock = new CPumpButton(); pumpList.Add(pumpBlock); } //new cylinders cylinderList = new List <CylinderCellBlock>(); for (int i = 0; i < cylinderNumber; i++) { CylinderCellBlock cylinder = new CylinderCellBlock(); cylinderList.Add(cylinder); } //new buttons controlModeButton = new ImageButton(); //controlButtonList = new List<ImageButton>(); //autoModeButton = new ImageButton(); //controlButtonList.Add(autoModeButton); //manualModeButton = new ImageButton(); //controlButtonList.Add(manualModeButton); stateButtonList = new List <ImageButton>(); PumpSettingButton = new ImageButton(); //stateButtonList.Add(PumpSettingButton); PumpInstallButton = new ImageButton(); stateButtonList.Add(PumpInstallButton); cylinderExtendButton = new ImageButton(); stateButtonList.Add(cylinderExtendButton); //cylinderStopButton = new ImageButton(); //stateButtonList.Add(cylinderStopButton); cylinderRetractButton = new ImageButton(); stateButtonList.Add(cylinderRetractButton); this.SuspendLayout(); //pumps for (int j = 0; j < pumpNumber; j++) { CPumpButton pumpBlock = pumpList[j]; pumpBlock.Size = new Size(PumpWidth, PumpHeight); pumpBlock.Location = new Point(PumpMarginLeft, PumpMarginTop + j * (PumpHeight + PumpSpacingY)); pumpBlock.Toggle = true; pumpBlock.PumpIndex = j; pumpBlock.IMGContainer = pumpImages; pumpBlock.TransParent = true; pumpBlock.Icon = pumpIcon; pumpBlock.Click += new EventHandler(pumpBlock_Click); this.Controls.Add(pumpBlock); } //cylinders for (int i = 0; i < cylinderNumber; i++) { CylinderCellBlock cylinder = cylinderList[i]; cylinder.Size = new Size(CBWidth, CBHeight); cylinder.Location = new Point(CBMarginLeft + (i % 2) * (CBWidth + CBSpacingX), CBMarginTop + (i / 2) * (CBHeight + CBSpacingY)); cylinder.OnCylinderClicked += new OnCylinderClickHandler(cylinder_OnCylinderClicked); cylinder.IMGContainer = progressBarImages; //cylinder.Font = currentFont; this.Controls.Add(cylinder); } //buttons controlModeButton.Size = new Size(ButtonWidth, ButtonHeight); controlModeButton.Location = new Point(ButtonMarginLeft, ButtonMarginTop); controlModeButton.Font = currentFont; controlModeButton.IMGContainer = buttonImages; controlModeButton.Checked = false; controlModeButton.Toggle = false; //controlModeButton.CheckedChanged += new EventHandler(controlModeButton_CheckedChanged); //controlModeButton.MouseUp += new MouseEventHandler(controlModeButton_MouseUp); //controlModeButton.Click += new EventHandler(controlModeButton_Click); controlModeButton.Text = "自动模式"; this.Controls.Add(controlModeButton); //for (int k = 0; k < controlButtonList.Count; k++) //{ // ImageButton button = controlButtonList[k]; // button.Size = new Size(ButtonWidth, ButtonHeight); // button.Location = new Point(ButtonMarginLeft, ButtonMarginTop + k * (ButtonHeight + ButtonSpacingY)); // button.Font = currentFont; // button.IMGContainer = buttonImages; // button.Toggle = true; // button.Click += new EventHandler(controlModeButton_Click); // this.Controls.Add(button); //} //autoModeButton.Name = "auto"; //manualModeButton.Name = "manual"; //autoModeButton.Text = "自动模式"; //manualModeButton.Text = "手动模式"; for (int k = 0; k < stateButtonList.Count; k++) { ImageButton button = stateButtonList[k]; button.Size = new Size(ButtonWidth, ButtonHeight); button.Location = new Point(ButtonMarginLeft + (k + 1) * (ButtonWidth + ButtonSpacingX), ButtonMarginTop); button.Font = currentFont; button.IMGContainer = buttonImages; button.Toggle = false; this.Controls.Add(button); } cylinderExtendButton.Text = "油缸伸出"; //cylinderExtendButton.Click += new EventHandler(cylinderExtendButton_Click); cylinderExtendButton.MouseDown += new MouseEventHandler(cylinderExtendButton_MouseDown); cylinderExtendButton.MouseUp += new MouseEventHandler(cylinderExtendButton_MouseUp); //cylinderStopButton.Text = "油缸停止"; //cylinderStopButton.Click += new EventHandler(cylinderStopButton_Click); cylinderRetractButton.Text = "油缸缩回"; //cylinderRetractButton.Click += new EventHandler(cylinderRetractButton_Click); cylinderRetractButton.MouseDown += new MouseEventHandler(cylinderRetractButton_MouseDown); cylinderRetractButton.MouseUp += new MouseEventHandler(cylinderRetractButton_MouseUp); cylinderExtendButton.Enabled = false; //cylinderStopButton.Enabled = false; cylinderRetractButton.Enabled = false; PumpInstallButton.Text = "启动泵站"; PumpInstallButton.Click += new EventHandler(PumpInstallButton_Click); //PumpInstallButton.MouseDown += new MouseEventHandler(); //PumpInstallButton.MouseUp += new MouseEventHandler(); PumpInstallButton.Enabled = false; PumpSettingButton.Text = "轴力设定"; PumpSettingButton.Click += new EventHandler(PumpSettingButton_Click); //PumpSettingButton.MouseDown += new MouseEventHandler(); //PumpSettingButton.MouseUp += new MouseEventHandler(); PumpSettingButton.Enabled = false; this.ResumeLayout(false); }
private void VirtualSetForm_Click(object sender, EventArgs e) { label11.Text = "被控泵站 " + CDataPool.GetDataPoolObject().out_id_controledPump.ToString(); label12.Text = "冗余泵站" + CDataPool.GetDataPoolObject().out_id_redundantPump.ToString(); }
public VirtualSetForm() { InitializeComponent(); /* * List<int> in_Pressure_Real_3001_3008 = new List<int>();// 油缸压力当前值 4*8 * List<int> in_Position_Real_3101_3108 = new List<int>();// 油缸当前长度值 4*8 * * List<MotionStateType> in_cylinderState_Real_3201_3208 = new List<MotionStateType>();// 油缸运行状态 4*8 * List<MotionStateType> in_MachLockState_Real_3201_3208 = new List<MotionStateType>();// 油缸机械锁运行状态 4*8 * * List<int> in_Pressure_Pump_Real_3301_3304 = new List<int>();// 泵站压力 4 * List<int> in_Voltage_Real_3301_3304 = new List<int>();// 控制器电压 4 * List<bool> in_PowerSupply_3301_3304 = new List<bool>();// 控制器检测当前供电 0:市电 1:发电机 4 * * List<bool> in_Limit_5_3301_3304 = new List<bool>();// 油缸5mm接近开关限位 4*8 * List<bool> in_Limit_10_3301_3304 = new List<bool>();// 油缸10mm接近开关限位 4*8 * * List<bool> in_Warn_HighPressure_3401_3404 = new List<bool>();// 油缸压力过高 4*8 * List<bool> in_Warn_LowPressure_3401_3404 = new List<bool>();// 油缸压力过低 4*8 * List<bool> in_Warn_HighPosition_3401_3404 = new List<bool>();// 油缸长度过高 4*8 * List<bool> in_Warn_LowPosition_3401_3404 = new List<bool>();// 油缸长度过低 4*8 * * * List<bool> in_Error_Pump_3501_3504 = new List<bool>();//泵站及控制器 故障 4*16 * List<bool> in_Error_PressureSenser_3501_3504 = new List<bool>();//油缸压力传感器故障 4*8 * List<bool> in_Error_PositionSenser_3501_3504 = new List<bool>();//油缸长度传感器故障 4*8 * * List<bool> in_Error_cylinder_extend_3511_3514 = new List<bool>();//油缸伸出电磁阀线路短路 4*8 * List<bool> in_Error_cylinder_retract_3511_3514 = new List<bool>();//油缸缩回电磁阀线路短路 4*8 * List<bool> in_Error_MachLock_extend_3511_3514 = new List<bool>();//油缸机械锁伸出电磁阀线路短路 4*8 * List<bool> in_Error_MachLock_retract_3511_3514 = new List<bool>();//油缸机械锁缩回电磁阀线路短路 4*8 * */ id_controledPump.Add(CDataPool.GetDataPoolObject().out_id_controledPump); id_redundantPump.Add(CDataPool.GetDataPoolObject().out_id_redundantPump); this.SuspendLayout(); IntDic.Add(il_Presure, CDataPool.GetDataPoolObject().in_Pressure_Real_3001_3008); IntDic.Add(il_Position, CDataPool.GetDataPoolObject().in_Position_Real_3101_3108); IntDic.Add(il_Pressure_Pump, CDataPool.GetDataPoolObject().in_Pressure_Pump_Real_3301_3304); IntDic.Add(il_Voltage, CDataPool.GetDataPoolObject().in_Voltage_Real_3301_3304); IntDic.Add(rb__PowerSupply, CDataPool.GetDataPoolObject().in_PowerSupply_3301_3304); IntDic.Add(il_idControl, id_controledPump); IntDic.Add(il_idrongyu, id_redundantPump); doubleDic.Add(comboBoxcylinderState, CDataPool.GetDataPoolObject().in_cylinderState_Real_3201_3208); doubleDic.Add(comboBoxMachLockState, CDataPool.GetDataPoolObject().in_MachLockState_Real_3201_3208); //boolDic.Add(rb__PowerSupply, CDataPool.GetDataPoolObject().in_PowerSupply_3301_3304); boolDic.Add(rb_Limit_5, CDataPool.GetDataPoolObject().in_Limit_5_3301_3304); boolDic.Add(rb_Limit_10, CDataPool.GetDataPoolObject().in_Limit_10_3301_3304); boolDic.Add(rb_Warn_HighPressure, CDataPool.GetDataPoolObject().in_Warn_HighPressure_3401_3404); boolDic.Add(rb_Warn_LowPosition, CDataPool.GetDataPoolObject().in_Warn_LowPosition_3401_3404); boolDic.Add(rb_Warn_HighPosition, CDataPool.GetDataPoolObject().in_Warn_HighPosition_3401_3404); boolDic.Add(rb_Warn_LowPressure, CDataPool.GetDataPoolObject().in_Warn_LowPressure_3401_3404); boolDic.Add(rb_Error_cylinder_extend, CDataPool.GetDataPoolObject().in_Error_cylinder_extend_shortcircuit_3511_3514); boolDic.Add(rb_Error_MachLock_retract, CDataPool.GetDataPoolObject().in_Error_MachLock_retract_shortcircuit_3511_3514); boolDic.Add(rb_Error_Pump, CDataPool.GetDataPoolObject().in_Error_Pump_3501_3504); boolDic.Add(rb_Error_cylinder_retract, CDataPool.GetDataPoolObject().in_Error_cylinder_retract_shortcircuit_3511_3514); boolDic.Add(rb_Error_MachLock_extend, CDataPool.GetDataPoolObject().in_Error_MachLock_extend_shortcircuit_3511_3514); boolDic.Add(rb_Error_PressureSenser, CDataPool.GetDataPoolObject().in_Error_PressureSenser_3501_3504); boolDic.Add(rb_Error_PositionSenser, CDataPool.GetDataPoolObject().in_Error_PositionSenser_3501_3504); boolDic.Add(rb_CompAct_Pump, CDataPool.GetDataPoolObject().in_CompAct_Pump_1010_1013); boolDic.Add(rb_StartFailed_Pump, CDataPool.GetDataPoolObject().in_StartFailed_Pump_1010_1013); boolDic.Add(rb_Estop1, CDataPool.GetDataPoolObject().in_EStop_1010_1013); WarnLst.Add(rb_Warn_HighPressure); WarnLst.Add(rb_Warn_LowPosition); WarnLst.Add(rb_Warn_HighPosition); WarnLst.Add(rb_Warn_LowPressure); ErrLst.Add(rb_Error_cylinder_extend); ErrLst.Add(rb_Error_MachLock_retract); ErrLst.Add(rb_Error_Pump); ErrLst.Add(rb_Error_cylinder_retract); ErrLst.Add(rb_Error_MachLock_extend); ErrLst.Add(rb_Error_PressureSenser); ErrLst.Add(rb_Error_PositionSenser); foreach (KeyValuePair <Control, List <MotionStateType> > item in doubleDic) { ((ComboBox)item.Key).SelectedIndexChanged += new EventHandler(OnSelectChanged); } foreach (KeyValuePair <Control, List <Int32> > item in IntDic) { ((ImageLabel)item.Key).Click += new EventHandler(OnClick); } foreach (KeyValuePair <Control, List <bool> > item in boolDic) { #if WindowsCE ((CheckBox)item.Key).CheckStateChanged += new EventHandler(OnCheckedChanged); #else ((CheckBox)item.Key).CheckedChanged += new EventHandler(OnCheckedChanged); #endif } comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; comboBox_PumpErr.SelectedIndex = 0; this.ResumeLayout(false); }