private void updateManualInterventionControls()
 {
     if (HumanIntervention.IsSet())
     {
         labelHumanInterventionStatus.Text      = "Active";
         labelHumanInterventionStatus.ForeColor = unsafeColor;
         buttonManualIntervention.Text          = "Deactivate";
         toolTip.SetToolTip(labelHumanInterventionStatus, HumanIntervention.Info.Replace(";", "\n  "));
     }
     else
     {
         labelHumanInterventionStatus.Text      = "Inactive";
         buttonManualIntervention.Text          = "Activate";
         labelHumanInterventionStatus.ForeColor = safeColor;
         toolTip.SetToolTip(labelHumanInterventionStatus, "");
     }
 }
        private void buttonManualIntervention_Click(object sender, EventArgs e)
        {
            if (HumanIntervention.IsSet())
            {
                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork             += new DoWorkEventHandler(removeHumanInterventionFile);
                bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(afterRemoveHumanInterventionFile);
                bw.RunWorkerAsync();
            }
            else
            {
                DialogResult result = new InterventionForm().ShowDialog();
                if (result == DialogResult.OK)
                {
                    Log("Created operator intervention");
                }
            }

            updateManualInterventionControls();
            CheckSituation();
        }
        public override Reading getReading()
        {
            Reading r = new Reading
            {
                stale  = false,
                safe   = !HumanIntervention.IsSet(),
                usable = true,
            };

            _status = string.Format("{0}", r.safe ? "Not set" : HumanIntervention.Info);
            if (r.safe != _wasSafe)
            {
                activityMonitor.Event(new Event.SafetyEvent(
                                          sensor: WiseName,
                                          details: _status,
                                          before: Event.SafetyEvent.ToSensorSafety(_wasSafe),
                                          after: Event.SafetyEvent.ToSensorSafety(r.safe)));
            }
            _wasSafe = r.safe;
            return(r);
        }
 private void removeHumanInterventionFile(object sender, DoWorkEventArgs e)
 {
     HumanIntervention.Remove();
 }
Beispiel #5
0
 private void cmdOK_Click(object sender, EventArgs e)
 {
     _operator = textBoxOperator.Text;
     HumanIntervention.Create(_operator, textBoxReason.Text);
     Close();
 }