private void UpdateNotificationStatus() { // Also update notifications button task count and enabled status. int count = AppConfigHelper.TaskCount(); btnNotifications.Text = "Pending notifications (" + count.ToString() + ")..."; btnNotifications.Enabled = count > 0; // If any of the tasks are status=Ready, turn background color to OrangeRed. btnNotifications.BackColor = Color.LightGray; foreach (BioSeqTask task in AppConfigHelper.TaskList.Values) { if (task.TaskStatus == "Ready") { btnNotifications.BackColor = Color.OrangeRed; } } txtStandardReference.Text = AppConfigHelper.BuildTreeDomesticReference; // This may have been updated by the Build tree function. if (btnNotifications.Enabled && !NotificationsIsOpen) { //btnNotifications_Click(null, null); // Automatically open the notifications dialog if it is not open. frm = new BioSeqDBNotifications(); frm.FormClosedEvent += NotificationsClosed; frm.StatusChangeEvent += ModelessDialogEvent; frm.Show(this); NotificationsIsOpen = true; } }
private void cmbAnalysis_SelectedIndexChanged(object sender, EventArgs e) { switch (cmbAnalysis.Text) { case "Centrifuge...": BioSeqCentrifuge frmCentrifuge = new BioSeqCentrifuge(); DialogResult rc = frmCentrifuge.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. CreateNewTask("Centrifuge", AppConfigHelper.TaskMemo, string.Empty); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "Nextstrain...": BioSeqNextstrain frmNextstrain = new BioSeqNextstrain(); rc = frmNextstrain.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. CreateNewTask("Nextstrain", AppConfigHelper.TaskMemo, string.Empty); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "Salmonella Serotyping...": BioSeqSalmonella frmSalmonella = new BioSeqSalmonella(); rc = frmSalmonella.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. CreateNewTask("Salmonella", AppConfigHelper.TaskMemo, string.Empty); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "Search...": BioSeqAnalysis frm = new BioSeqAnalysis(cmbAnalysis.Text, SampleList()); rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. string memo = string.IsNullOrEmpty(AppConfigHelper.TaskMemo) ? "Search for " + (AppConfigHelper.SampleChecked("Search") ? AppConfigHelper.SampleID("Search") : AppConfigHelper.InputPath("Search")) + "." : AppConfigHelper.TaskMemo; CreateNewTask("Search", memo, AppConfigHelper.CurrentDBName()); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "InfluenzaA...": BioSeqInfluenzaA frmInfluenzaA = new BioSeqInfluenzaA(); rc = frmInfluenzaA.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. CreateNewTask("InfluenzaA", AppConfigHelper.TaskMemo, string.Empty); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "Build tree...": mnuBuildTree_Click(sender, e); break; case "Kraken2...": frm = new BioSeqAnalysis(cmbAnalysis.Text, SampleList()); rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. string memo = string.IsNullOrEmpty(AppConfigHelper.TaskMemo) ? "Kraken2 analysis for " + (AppConfigHelper.SampleChecked("Kraken2") ? AppConfigHelper.SampleID("Kraken2") : AppConfigHelper.InputPath("Kraken2")) + "." : AppConfigHelper.TaskMemo; CreateNewTask("Kraken2", memo, AppConfigHelper.CurrentDBName()); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "Quast...": frm = new BioSeqAnalysis(cmbAnalysis.Text, SampleList()); rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. string memo = string.IsNullOrEmpty(AppConfigHelper.TaskMemo) ? "Quast analysis for " + (AppConfigHelper.SampleChecked("Quast") ? AppConfigHelper.SampleID("Quast") : AppConfigHelper.InputPath("Quast")) + "." : AppConfigHelper.TaskMemo; CreateNewTask("Quast", memo, AppConfigHelper.CurrentDBName()); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "BBMap...": frm = new BioSeqAnalysis("BBMap", SampleList()); rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. string memo = string.IsNullOrEmpty(AppConfigHelper.TaskMemo) ? "BBMap analysis for " + (AppConfigHelper.SampleChecked("BBMap") ? AppConfigHelper.SampleID("BBMap") : AppConfigHelper.InputPath("BBMap")) + "." : AppConfigHelper.TaskMemo; CreateNewTask("BBMap", memo, AppConfigHelper.CurrentDBName()); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; case "VFabricate...": frm = new BioSeqAnalysis(cmbAnalysis.Text, SampleList()); rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; SeqDBHelper.backgroundTaskComplete += new SeqDBHelper.taskCompleteEvent(backupgroundTaskComplete); // Schedule a clean up task. string memo = string.IsNullOrEmpty(AppConfigHelper.TaskMemo) ? "VFabricate analysis for " + (AppConfigHelper.SampleChecked("VFabricate") ? AppConfigHelper.SampleID("VFabricate") : AppConfigHelper.InputPath("VFabricate")) + "." : AppConfigHelper.TaskMemo; CreateNewTask("VFabricate", memo, AppConfigHelper.CurrentDBName()); UpdateNotificationStatus(); // Completion will arrive in the Notifications dialog. backgroundWorker.RunWorkerAsync(); Cursor.Current = Cursors.Default; } break; } cmbAnalysis.SelectedIndex = 0; // Position back to -- Select analysis --. }