Example #1
0
 private void tsrMainToolStrip_SetVoltageRequested(object sender, VoltageEventArgs e)
 {
     byte num = BitConverter.GetBytes(Convert.ToInt32((double) (255.0 - (309.0 / e.Voltage))))[0];
     TelegramContainer container = createSeries(Task.SetVoltage, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x15, num } }, new Telegram.Callback(processSimpleCommunicationReplyTelegram), true);
     container[0].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(container[0].telegram.data.Buf, container[0].telegram.data.NumItems));
     if (_teleProcessor == null)
     {
         if (_ioph.telegramSeriesFromMainWin(container, SeriesExecutionState.Run, true) == -1)
         {
             MessageBox.Show("Device is BUSY!");
         }
     }
     else if (_teleProcessor.initSeries(container))
     {
         _teleProcessor.execTelegramSeries();
     }
     else
     {
         MessageBox.Show("Device is BUSY!");
     }
 }
Example #2
0
 private void tsrMainToolStrip_SetVoltageRequested(object sender, VoltageEventArgs e)
 {
     this.setVoltage(e.Voltage);
 }
Example #3
0
 private void tsrMainToolStrip_SetVoltageRequested(object sender, VoltageEventArgs e)
 {
     byte num = BitConverter.GetBytes(Convert.ToInt32((double) (255.0 - (309.0 / e.Voltage))))[0];
     TelegramContainer telegramSeries = this.createSeries(Task.SetVoltage, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x15, num } }, null, new bool[] { true });
     if (this._teleProcessor == null)
     {
         telegramSeries[0].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(telegramSeries[0].telegram.data.Buf, telegramSeries[0].telegram.data.NumItems));
         this.sbProgressBar.Reset();
         this.sbProgressBar.EndPoint = telegramSeries.Count;
         this.sbDeviceStatePane.Text = this.getStatusString((Task) telegramSeries[0].telegram.UserDataExt.StoredUserData["Task"]);
         if (this._adtRec.isSimuation)
         {
             this.logSimulationModeCommandSeries(telegramSeries);
         }
         else if (this._ioph.telegramSeriesFromMainWin(telegramSeries, SeriesExecutionState.Run, true) == -1)
         {
             MessageBox.Show("Device is BUSY!");
         }
     }
     else if (this._teleProcessor.initSeries(telegramSeries))
     {
         this._teleProcessor.execTelegramSeries();
     }
     else
     {
         MessageBox.Show("Device is BUSY!");
     }
 }
Example #4
0
 private void tsrMainToolStrip_SetVoltageRequested(object sender, VoltageEventArgs e)
 {
     byte num = BitConverter.GetBytes(Convert.ToInt32((double) (255.0 - (309.0 / e.Voltage))))[0];
     if (this._teleProcessor.initSeries(this.createSeries(Task.SetVoltage, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x15, num } }, null)))
     {
         this._teleProcessor.execTelegramSeries();
     }
     else
     {
         MessageBox.Show("Device is BUSY!");
     }
 }
Example #5
0
 private void tsbSetVoltage_Click(object sender, EventArgs e)
 {
     if (SetVoltageRequested != null)
     {
         double num;
         if (ParseDouble(tstVoltage.Text, out num))
         {
             num = Math.Round(num, 1);
         }
         else
         {
             MessageBox.Show("Could not parse the entered value!\nPlease enter another value!", "Power Supply Setting Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             tstVoltage.Text = _currentVoltage.ToString("0.#");
             tstVoltage.SelectAll();
             return;
         }
         if (num < _minVoltage)
         {
             num = _minVoltage;
             MessageBox.Show("Minimum supply voltage is " + _minVoltage.ToString("0.#") + " V!", "Power Supply Setting Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             tstVoltage.Text = num.ToString("0.#");
         }
         if (num > _maxVoltage)
         {
             num = _maxVoltage;
             MessageBox.Show("Maximum supply voltage is " + _maxVoltage.ToString("0.#") + " V!", "Power Supply Setting Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             tstVoltage.Text = num.ToString("0.#");
         }
         VoltageEventArgs args = new VoltageEventArgs {
             Voltage = num
         };
         _currentVoltage = num;
         SetVoltageRequested(sender, args);
     }
 }