예제 #1
0
        private void OpenFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter           = "镜像文件 (*.img)|*.img|  二进制文件 (*.bin)|*.bin | 全部文件|*";
            ofd.FilterIndex      = 0;
            ofd.RestoreDirectory = true;

            var result = ofd.ShowDialog();

            if (result == DialogResult.OK)
            {
                _openFilePath     = ofd.FileName;
                openfiletext.Text = _openFilePath;

                ImgBinFileInfo.ImageBinFileFullPath = _openFilePath;
                FileInfo fileinfo = new FileInfo(_openFilePath);
                ImgBinFileInfo.ImageBinFileLen  = fileinfo.Length;
                ImgBinFileInfo.ImageBinFileName = fileinfo.Name;

                InitCalFileMd5work();
                //
                CalFileMD5work.RunWorkerAsync();
            }
        }
예제 #2
0
 private void InitCalFileMd5work()
 {
     if (CalFileMD5work != null && CalFileMD5work.WorkerSupportsCancellation)
     {
         CalFileMD5work?.CancelAsync();
     }
     // CalFileMD5work
     //
     CalFileMD5work = new BackgroundWorker();
     this.CalFileMD5work.WorkerReportsProgress      = true;
     this.CalFileMD5work.WorkerSupportsCancellation = true;
     this.CalFileMD5work.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.CalFileMD5work_DoWork);
     this.CalFileMD5work.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.CalFileMD5work_ProgressChanged);
     this.CalFileMD5work.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.CalFileMD5work_RunWorkerCompleted);
 }