private void method_0(object sender, FirmwareUpdateProgressEventArgs e)
        {
            if (this.prgComm.InvokeRequired)
            {
                base.BeginInvoke(new EventHandler <FirmwareUpdateProgressEventArgs>(this.method_0), sender, e);
            }
            else if (e.Failed)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    MessageBox.Show(e.Message, Class15.SZ_PROMPT);
                }
                base.Close();
            }
            else if (e.Closed)
            {
                /* Roger Clark. Prevent the form closing immediatly after Read or Write complete
                 *              this.Refresh();
                 *              base.Close();
                 */
            }
            else
            {
                this.prgComm.Value = (int)e.Percentage;
                if (e.Percentage == (float)this.prgComm.Maximum)
                {
                    this.IsSucess = true;


                    if (this.IsRead)
                    {
                        //MessageBox.Show(Class15.dicCommon["ReadComplete"]);
                        this.lblPrompt.Text = "Read complete";
                    }
                    else
                    {
                        //MessageBox.Show(Class15.dicCommon["WriteComplete"]);
                        this.lblPrompt.Text = "Write complete";
                    }
                    this.btnOK.Visible     = true;
                    this.btnCancel.Visible = false;
                }
                else
                {
                    this.lblPrompt.Text = string.Format("{0}%", this.prgComm.Value);
                }
            }
        }
예제 #2
0
        private void progressCallback(object sender, FirmwareUpdateProgressEventArgs e)
        {
            if (this.prgComm.InvokeRequired)
            {
                base.BeginInvoke(new EventHandler <FirmwareUpdateProgressEventArgs>(this.progressCallback), sender, e);
            }
            else if (e.Failed)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    MessageBox.Show(e.Message, Settings.SZ_PROMPT);
                }
                base.Close();
            }
            else if (e.Closed)
            {
                /* Roger Clark. Prevent the form closing immediatly after Read or Write complete
                 *              this.Refresh();
                 *              base.Close();
                 */
            }
            else
            {
                this.prgComm.Value = (int)e.Percentage;
                if (e.Percentage == (float)this.prgComm.Maximum)
                {
                    this.IsSucess = true;

                    if (_closeWhenFinished)
                    {
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                        return;
                    }

                    switch (CodeplugComms.CommunicationMode)
                    {
                    case CodeplugComms.CommunicationType.codeplugRead:
                    case CodeplugComms.CommunicationType.DMRIDRead:
                    case CodeplugComms.CommunicationType.calibrationRead:
                        this.lblPrompt.Text = Settings.dicCommon["ReadComplete"];
                        break;

                    case CodeplugComms.CommunicationType.codeplugWrite:
                    case CodeplugComms.CommunicationType.DMRIDWrite:
                    case CodeplugComms.CommunicationType.calibrationWrite:
                        this.lblPrompt.Text = Settings.dicCommon["WriteComplete"];
                        break;
                    }

                    /*
                     * if (this.IsRead)
                     * {
                     *      //MessageBox.Show(Class15.dicCommon["ReadComplete"]);
                     *      this.lblPrompt.Text = Settings.dicCommon["WriteComplete"];
                     * }
                     * else
                     * {
                     *      //MessageBox.Show(Class15.dicCommon["WriteComplete"]);
                     *      this.lblPrompt.Text = Settings.dicCommon["WriteComplete"];
                     * }
                     */
                    this.btnOK.Visible     = true;
                    this.btnCancel.Visible = false;
                }
                else
                {
                    this.lblPrompt.Text = string.Format("{0}%", this.prgComm.Value);
                }
            }
        }