Exemple #1
0
        public static bool WaitForDevice(UInt16 vid, UInt16 pid)
        {
            if (Fel.DeviceExists(vid, pid))
            {
                return(true);
            }
            var form = new WaitingFelForm(vid, pid);

            form.ShowDialog();
            return(form.DialogResult == DialogResult.OK);
        }
 private void buttonDriver_Click(object sender, EventArgs e)
 {
     try
     {
         buttonDriver.Enabled = WaitingFelForm.InstallDriver() != 0;
     }
     catch (Exception ex)
     {
         Tasks.ErrorForm.Show(this, ex);
     }
 }
 public WaitingShellForm()
 {
     InitializeComponent();
     buttonDriver.Left = labelDriver.Left + labelDriver.Width;
     if (WaitingFelForm.DriverInstalled())
     {
         labelDriver.Visible  = false;
         buttonDriver.Visible = false;
     }
     timer.Enabled = true;
 }
Exemple #4
0
        public static bool WaitForDevice(IWin32Window owner)
        {
            if (Fel.DeviceExists())
            {
                return(true);
            }
            var form = new WaitingFelForm();

            form.ShowDialog(owner);
            return(form.DialogResult == DialogResult.OK);
        }
Exemple #5
0
        DialogResult WaitForFelFromThread()
        {
            if (InvokeRequired)
            {
                return((DialogResult)Invoke(new Func <DialogResult>(WaitForFelFromThread)));
            }
            SetStatus(Resources.WaitingForDevice);
            if (fel != null)
            {
                fel.Close();
            }
            TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Paused);
            var result = WaitingFelForm.WaitForDevice(vid, pid, this);

            if (result)
            {
                fel = new Fel();
                if (!File.Exists(fes1Path))
                {
                    throw new FileNotFoundException(fes1Path + " not found");
                }
                if (!File.Exists(ubootPath))
                {
                    throw new FileNotFoundException(ubootPath + " not found");
                }
                fel.Fes1Bin  = File.ReadAllBytes(fes1Path);
                fel.UBootBin = File.ReadAllBytes(ubootPath);
                fel.Open(vid, pid);
                SetStatus(Resources.UploadingFes1);
                fel.InitDram(true);
                TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Normal);
                return(DialogResult.OK);
            }
            TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Normal);
            return(DialogResult.Abort);
        }