public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { var svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); AlarmCollection _AlarmCollection = (AlarmCollection)value; string text = "";// value as string; if (svc != null && text != null) { using (AlarmForm form = new AlarmForm(_AlarmCollection.m_VarNameID_VariableGrid)) { form.Value = text; if (svc.ShowDialog(form) == DialogResult.OK) { if (form.updated) { ((VariableGrid)((DCS.Tools.ObjectWrapper)(context.Instance)).SelectedObject).Modified = true; ((MainForm)((System.Windows.Forms.Control)(svc)).TopLevelControl).UpateVariableFromPropertygrid(); } return(form.Refvariablegrid.m_AlarmCollection); } } } return(value); }
/// <summary> /// Create an alarm. /// </summary> public void CreateAlarm(IMessageActivity message, AlarmForm alarmInfo) { if (alarmInfo.Time == null) { throw new ArgumentException("The alarm time can't be null."); } var resumptionCookie = new ResumptionCookie(message).GZipSerialize(); var alarm = new Alarm(alarmInfo.Name, alarmInfo.Time.Value, resumptionCookie); _alarms.Add(alarmInfo.Name, alarm); alarm.Enable(); }
private void Alarm_button_Click(object sender, EventArgs e) { AlarmForm form = new AlarmForm(Administration.User, AlarmAdministration); form.Alarm_Refresh(); this.Visible = false; var closing = form.ShowDialog(); if (closing == DialogResult.OK) { AlarmAdministration = form.AlarmAdministration; WriteToBinaryFile <List <Alarm> >(@"Alarm.bin", AlarmAdministration.Alarm_list); Visible = true; } }
public void ProductionAfter() { //气压中断 DoType.阀1胶桶气压控制.Set(false); Debug.WriteLine("阀1胶桶气压控制 关闭"); //声光提示 蜂鸣器 三色灯闪烁 阻塞 ManualResetEvent stop = new ManualResetEvent(false); Machine.Instance.LightTower.SetMessage(new Drive.MachineStates.LightTowerMessage() { Type = Drive.MachineStates.LightTowerType.Yellow, Shining = true, Beep = true, MessageType = 3 }); Dictionary <DialogResult, Action> dic = new Dictionary <DialogResult, Action>(); dic.Add(DialogResult.Yes, new Action(() => { stop.Set(); })); dic.Add(DialogResult.No, new Action(() => { })); List <string> info = new List <string>(); info.Add("生产完成"); DialogResult dr = new AlarmForm(dic, info).ShowDialog(); switch (dr) { case DialogResult.Yes: break; case DialogResult.No: //程序终止 Executor.Instance.Stop(); break; } //stop.WaitOne(); }