public MainWindow() { InitializeComponent(); DecryptButton.IsEnabled = false; EncryptButton.IsEnabled = false; _backgroundWorker = new BackgroundWorker(); _backgroundWorker.WorkerReportsProgress = true; _encryptionWorker = new EncryptionWorker(_backgroundWorker); }
private void StartEncryptionThread() { this.m_ProgressBar.Value = 0.0; this.m_ProgressPercentage.Content = "0%"; // This method runs on the main thread. LockUI(); EncryptionWorker eworker = new EncryptionWorker(EncryptionWorkType.ENCRYPT, inputPath, outputPath, a, b, X0_ncm, r, X0_ws, Ke); // Start the asynchronous operation. BGWorker = new BackgroundWorker(); BGWorker.DoWork += BGWorker_DoWork; BGWorker.ProgressChanged += BGWorker_ProgressChanged; BGWorker.RunWorkerCompleted += BGWorker_RunWorkerCompleted; BGWorker.RunWorkerAsync(eworker); }