private IList<UserControl> UserControls = new List<UserControl>(); // The Usercontrols at each step. /// <summary> /// Load the UserControls /// </summary> public MainWindow() { InitializeComponent(); // Create Facet Categories Pivot.CreateFacetCategories(Up); // Set the default BLAST parameters. Up.WebServerPort = 8085; Up.BlastUseBrowserProxy = true; Up.BlastMaxNumHits = 5; Up.BlastMaxEvalue = 1.0e-20; Up.BlastMinPercentIdentity = 80.0; Up.BlastMinPercentQueryCoverage = 40.0; Up.QuerySequences = new List<ISequence>(); Up.Log = ""; CurrentStep = 0; // Start at Step 0. // Load the UserControls for each step. UserControl0 uc0 = new UserControl0(Up); UserControls.Add(uc0); UserControl9 uc9 = new UserControl9(Up); UserControls.Add(uc9); strVersion.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); }
/// <summary> /// Run task for a particular step. /// </summary> /// <param name="task"></param> /// <returns></returns> private void RunTask(string task) { bool res = false; switch (task) { case "UserControl0": break; case "UserControl1": Util.SetupDirectories(Up.ProjectDir); break; case "UserControl2": if ((!File.Exists(Up.ProjectDir + "\\genes.fasta")) || (File.Exists(Up.ProjectDir + "\\genes.fasta") && (Up.FastaFile != ""))) { FastaParser parser = new FastaParser(); try { Up.QuerySequences = parser.Parse(Up.FastaFile).ToList(); } catch { FatalErrorDialog("Error parsing FASTA file. Please confirm that the input file is in FASTA format. If the problem persists file a bug report at blip.codeplex.com. The application will now be closed."); } File.Copy(Up.FastaFile, Up.ProjectDir + "\\genes.fasta", true); } break; case "UserControl3": break; case "UserControl4": UserControl4 uc4 = (CurrentControl as UserControl4); BlastUtil.RecordBlastThresholds(Up, uc4, ((ComboBoxItem)uc4.BlastProgram.SelectedItem).Content.ToString(), uc4.BlastDatabase.SelectedItem.ToString(), uc4.BlastAlgorithm.SelectedItem.ToString()); /* MessageBox.Show(String.Format("Recorded Parameters:\n{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}", Up.BlastProgram, Up.BlastDatabase, Up.BlastGeneticCode, Up.BlastAlgorithm, Up.BlastMaxEvalue, Up.BlastMaxNumHits, Up.BlastMinPercentIdentity, Up.BlastMinPercentQueryCoverage )); */ LaunchBlastPipeline(Up.ProjectDir + "\\genes.fasta"); break; case "UserControl5": LogMessage("Set Pivot parameters.\r\n"); break; case "UserControl6": UserControl6 uc6 = (CurrentControl as UserControl6); //Pivot.RecordPivotParameters(Up, uc6.CollectionNameBox.Text, uc6.CollectionTitleBox.Text); Pivot.RecordPivotParameters(Up, "blip", uc6.CollectionTitleBox.Text); break; case "UserControl7": break; case "UserControl8": UserControl8 uc8 = (CurrentControl as UserControl8); // progressBar1.Maximum = Up.QuerySequences.Count(); // progressBar1.Minimum = 0; // progressBar1.Value = 0; uc8.SaveImagePreviewState(); res = WriteCollection(); break; case "UserControl9": UserControl9 uc9 = (CurrentControl as UserControl9); if (uc9.createProject.IsChecked == true) { Debug.WriteLine("NEW"); UserControls.Clear(); UserControl0 uc0 = new UserControl0(Up); UserControls.Add(uc0); UserControl9 c9 = new UserControl9(Up); UserControls.Add(c9); UserControl1 uc1 = new UserControl1(Up); UserControls.Add(uc1); UserControl2 uc2 = new UserControl2(Up); UserControls.Add(uc2); //UserControl3 uc3 = new UserControl3(Up); //UserControls.Add(uc3); UserControl6 c6 = new UserControl6(Up); UserControls.Add(c6); UserControl4 c4 = new UserControl4(Up); UserControls.Add(c4); UserControl5 uc5 = new UserControl5(Up); UserControls.Add(uc5); UserControl8 c8 = new UserControl8(Up); UserControls.Add(c8); UserControl7 uc7 = new UserControl7(Up); UserControls.Add(uc7); } if (uc9.loadProject.IsChecked == true) { UserControls.Clear(); UserControl0 uc0 = new UserControl0(Up); UserControls.Add(uc0); UserControl9 c9 = new UserControl9(Up); UserControls.Add(c9); UserControl10 c10 = new UserControl10(Up); UserControls.Add(c10); UserControl11 c11 = new UserControl11(Up); UserControls.Add(c11); } break; case "UserControl10": UserControl10 uc10 = (CurrentControl as UserControl10); Debug.WriteLine("UC10"); Action<object> action = (object obj) => { StartWebServer("/", Up.CxmlDir, Up.WebServerPort); }; Task t1 = new Task(action, "BLiP_WS"); t1.Start(); Previous_Button.IsEnabled = false; Next_Button.IsEnabled = false; Finish_Button.IsEnabled = true; break; default: break; } }