コード例 #1
0
        // codeplug
        private void WriteButton_Click(object sender, EventArgs e)
        {
            if (FilenameTextBox.Text.Equals(""))
            {
                ThemeMessageBox.ShowMessageBox("Please open a codeplug!");
                return;
            }
            byte[] cp     = File.ReadAllBytes(FilenameTextBox.Text);
            byte[] header = new byte[4];
            Array.Copy(cp, 0, header, 0, 4);
            UInt32 inn = BitConverter.ToUInt32(header, 0);

            if (inn != 0x53756644)
            {
                StatusLabel.Text = "writing codeplug...";
                (new Thread(() => {
                    tr = new TyteraRadio(TyteraRadio.RadioModel.RM_MD380);
                    Thread.CurrentThread.IsBackground = true;
                    tr.WriteCodeplug(FilenameTextBox.Text);
                    tr.Reboot();
                    //this.StatusLabel.Text = "Done";
                    //this.nsProgressBar.Value = 0;
                })).Start();
            }
            else
            {
                ThemeMessageBox.ShowMessageBox("Invalid file type.  Must be .dfu");
                return;
            }
        }
コード例 #2
0
        private void FlashUserDBButton_Click(object sender, EventArgs e)
        {
            if (File.Exists("userdb.bin"))
            {
                StatusLabel.Text = "writing userdb.bin ...";
                tr = new TyteraRadio(TyteraRadio.RadioModel.RM_MD380);

                /*tr.WriteUserDB("userdb.bin");
                 * tr.Reboot();*/

                nsProgressBar.Minimum = 0;
                nsProgressBar.Maximum = 100;
                bw = new BackgroundWorker();

                bw.WorkerSupportsCancellation = true;
                bw.WorkerReportsProgress      = true;
                bw.DoWork          += new DoWorkEventHandler(bw_DoWorkWriteUserDB);
                bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
                nsProgressBar.Value = 0;

                bw.RunWorkerAsync();

                /*(new Thread(() => {
                 *  Thread.CurrentThread.IsBackground = true;
                 *  //tr = new TyteraRadio(TyteraRadio.RadioModel.RM_MD380);
                 *  tr.WriteUserDB("userdb.bin");
                 *  tr.Reboot();
                 * })).Start();*/
            }
            else
            {
                ThemeMessageBox.ShowMessageBox("Please download a userdb!");
            }
        }
コード例 #3
0
 private void FlashFirmwareButton_Click(object sender, EventArgs e)
 {
     if (File.Exists("gps_fw.bin") && File.Exists("nongps_fw.bin"))
     {
         ThemeMessageBox.ShowMessageBox("Please download only one firmware!");
     }
     else
     {
         if (File.Exists("gps_fw.bin"))
         {
             StatusLabel.Text = "writing gps_fw.bin ...";
             (new Thread(() => {
                 tr = new TyteraRadio(TyteraRadio.RadioModel.RM_MD380);
                 Thread.CurrentThread.IsBackground = true;
                 tr.WriteFirmware("gps_fw.bin");
                 tr.Reboot();
             })).Start();
         }
         else if (File.Exists("nongps_fw.bin"))
         {
             StatusLabel.Text = "writing nongps_fw.bin ...";
             (new Thread(() => {
                 tr = new TyteraRadio(TyteraRadio.RadioModel.RM_MD380);
                 Thread.CurrentThread.IsBackground = true;
                 tr.WriteFirmware("nongps_fw.bin");
                 tr.Reboot();
             })).Start();
         }
     }
 }
コード例 #4
0
 private void FlashFirmwareFileButton_Click(object sender, EventArgs e)
 {
     if (!FilenameTextBox.Text.Equals(""))
     {
         StatusLabel.Text = "writing firmware ...";
         (new Thread(() => {
             tr = new TyteraRadio(TyteraRadio.RadioModel.RM_MD380);
             Thread.CurrentThread.IsBackground = true;
             tr.WriteFirmware(FilenameTextBox.Text);
             tr.Reboot();
         })).Start();
     }
     else
     {
         ThemeMessageBox.ShowMessageBox("Please open a firmware!");
     }
 }