Beispiel #1
0
        public FirmwareWindow(lr4 lx4Device, string CurrentFwVersion)
        {
            InitializeComponent();

            lbCurrentVersion.Text = CurrentFwVersion;

            FwMsgBox.AppendText("Messages...\n");
            UpdateIsRunning = false;
            FwUpdater       = new FirmwareUpdate(lx4Device, FwMsgBox);

            cbReleases.Items.Add("Searching...");
            cbReleases.SelectedIndex = 0;
            LrfFirmware = new ReleaseCatalog();
            cbReleases.Items.Clear();
            if (LrfFirmware.Catalog.Length == 0)
            {
                cbReleases.Items.Add("Error connecting");
                cbReleases.SelectedIndex = 0;
            }
            else
            {
                for (int i = 0; i < LrfFirmware.Catalog.Length; i++)
                {
                    string s = LrfFirmware.Catalog[i].Product + " : "
                               + LrfFirmware.Catalog[i].FirmwareVersion + "    ("
                               + LrfFirmware.Catalog[i].ReleaseDate + ")";
                    cbReleases.Items.Add(s);
                }
                cbReleases.SelectedIndex = cbReleases.Items.Count - 1;
            }
        }
Beispiel #2
0
 private void btnUpdateFromFileClicked(object sender, EventArgs e)
 {
     if (!UpdateIsRunning)   // Prevent reentry on multiple clicks
     {
         UpdateIsRunning = true;
         FwMsgBox.AppendText("Updating firmware from local file\n");
         FwUpdater.UpdateFirmware(BrowsedToFilename);
         UpdateIsRunning = false;
     }
 }
Beispiel #3
0
        private void btnUpdateFromWebClicked(object sender, EventArgs e)
        {
            var client = new WebClient();

            try
            {
                int CatalogIndex = cbReleases.SelectedIndex;
                FwMsgBox.AppendText("Flashing firmware version " + LrfFirmware.Catalog[CatalogIndex].FirmwareVersion + "\n");

                // Download a firmware release binary to a local file and then flash it
                client.DownloadFile(LrfFirmware.Catalog[CatalogIndex].FileUrl, LrfFirmware.Catalog[CatalogIndex].FileName);
                UpdateIsRunning = true;
                FwUpdater.UpdateFirmware(LrfFirmware.Catalog[CatalogIndex].FileName);
                lbCurrentVersion.Text = LrfFirmware.Catalog[CatalogIndex].FirmwareVersion;
                UpdateIsRunning       = false;
            }
            finally
            {
                client.Dispose();
            }
        }