private void CancelProcessing_Click(object sender, RoutedEventArgs e) { MainBackgroundWorker.CancelAsync(); MainBackgroundWorkHelper.BackgroundWorker_AbortProcessing(); StatusTextBlock.Text = "Cancelling Processing of data"; IsEnabled = false; }
public Main() { InitializeComponent(); positionProgressbar(); // Create a temp folder for the current application process. processFolder = Path.GetTempPath(); processFolder = Path.Combine(processFolder, "DVTk"); processFolder = Path.Combine(processFolder, "SRV"); processFolder = Path.Combine(processFolder, Process.GetCurrentProcess().Id.ToString()); Directory.CreateDirectory(processFolder); string ucumFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles), @"DVTk\Definition Files\UCUM\UCUM Contents.xml"); Ucum.Tools.InitUcum(ucumFolder); this.templatesFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); this.templatesFolder = Path.Combine(this.templatesFolder, "Templates"); // Check if the templates folder actually exists. if (!Directory.Exists(this.templatesFolder)) { MessageBox.Show(this, "The Templates folder was not found, please make sure the application is installed correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.mainBackgroundWorker = new MainBackgroundWorker(templatesFolder); this.mainBackgroundWorker.RunWorkerCompleted += MainBackgroundWorkerHandleRunWorkerCompleted; this.mainBackgroundWorker.ProgressChanged += MainBackgroundWorkerHandleProgressChanged; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (MultithreadingEnabled) { MainBackgroundWorker.RunWorkerAsync(); } }
protected virtual void WorkerWindowShown(object sender, EventArgs e) { if (Action != default) { MainBackgroundWorker.RunWorkerAsync(Action); } }