/// <summary>
 /// Initializes a new instance of the DisabledAction class.
 /// </summary>
 /// <param name="disActions">DisabledActions bitmask value.</param>
 public DisabledAction(DisabledActions disabledActions)
 {
     InitializeComponent();
     ReadCb.Text = Gurux.DeviceSuite.Properties.Resources.ReadTxt;
     WriteCb.Text = Gurux.DeviceSuite.Properties.Resources.WriteTxt;
     MonitorCB.Text = Gurux.DeviceSuite.Properties.Resources.MonitorTxt;
     ScheduleCB.Text = Gurux.DeviceSuite.Properties.Resources.ScheduleTxt;
     DisabledActionsTB.Text = Gurux.DeviceSuite.Properties.Resources.AdvancedTxt;
     //Update helps from the resources.
     this.helpProvider1.SetHelpString(this.ReadCb, Gurux.DeviceSuite.Properties.Resources.DisableReadText);
     this.helpProvider1.SetHelpString(this.WriteCb, Gurux.DeviceSuite.Properties.Resources.DisableWriteText);
     this.helpProvider1.SetHelpString(this.MonitorCB, Gurux.DeviceSuite.Properties.Resources.DisableMonitorText);
     this.helpProvider1.SetHelpString(this.ScheduleCB, Gurux.DeviceSuite.Properties.Resources.DisableScheduleText);
     //Notifications will update this.
     DisabledActions = 0;
     ReadCb.Checked = (disabledActions & DisabledActions.Read) != 0;
     WriteCb.Checked = (disabledActions & DisabledActions.Write) != 0;
     MonitorCB.Checked = (disabledActions & DisabledActions.Monitor) != 0;
     ScheduleCB.Checked = (disabledActions & DisabledActions.Schedule) != 0;
 }
 /// <summary>
 /// Toggle value.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An EventArgs that contains the event data.</param>
 private void WriteCb_CheckedChanged(object sender, EventArgs e)
 {
     DisabledActions ^= DisabledActions.Write;
 }
 /// <summary>
 /// Toggle value.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An EventArgs that contains the event data.</param>
 private void ReadCb_CheckedChanged(object sender, EventArgs e)
 {
     DisabledActions ^= DisabledActions.Read;
 }
 /// <summary>
 /// Toggle value.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An EventArgs that contains the event data.</param>
 private void ScheduleCB_CheckedChanged(object sender, EventArgs e)
 {
     DisabledActions ^= DisabledActions.Schedule;
 }
 /// <summary>
 /// Toggle value.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An EventArgs that contains the event data.</param>
 private void MonitorCB_CheckedChanged(object sender, EventArgs e)
 {
     DisabledActions ^= DisabledActions.Monitor;
 }
示例#6
0
 static internal bool CanExecute(DisabledActions disabledActions, DeviceStates status, bool read)
 {
     //If monitoring.
     if ((status & DeviceStates.Monitoring) != 0)
     {
         return (disabledActions & DisabledActions.Monitor) == 0;
     }
     //If scheduling.
     if ((status & DeviceStates.Scheduling) != 0)
     {
         return (disabledActions & DisabledActions.Schedule) == 0;
     }
     //Can read.
     if (read)
     {
         return (disabledActions & DisabledActions.Read) == 0;
     }
     //Can write.
     return (disabledActions & DisabledActions.Write) == 0;
 }