Ejemplo n.º 1
0
        /// <summary>
        /// Populate the list of available files to download.
        /// </summary>
        private async Task OnUpdateFirmware()
        {
            try
            {
                // Get the file
                System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
                openFileDialog1.InitialDirectory = "";
                openFileDialog1.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*|bin files (*.bin)|*.bin";//"txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog1.FilterIndex      = 2;
                //openFileDialog1.RestoreDirectory = true;
                openFileDialog1.Multiselect = true;

                UploadFileSize     = 0;
                UploadFileProgress = 0;

                if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    // Call the command to start the upload process async
                    //ExecuteUpdateFirmwareCommand.Execute(openFileDialog1.FileNames);
                    await Task.Run(() => _adcpConn.UpdateFirmware(openFileDialog1.FileNames));
                }
            }
            catch (AccessViolationException ae)
            {
                log.Error("Error trying to open firmware file", ae);
            }
            catch (Exception e)
            {
                log.Error("Error trying to open firmware file", e);
            }
        }