private void Delete_Quantification_btn_clk(object sender, RoutedEventArgs e) { ObservableCollection <Quantification> selected_quants = new ObservableCollection <Quantification>(); for (int i = 0; i < this.quant_listView.SelectedItems.Count; ++i) { Quantification selected_mod = this.quant_listView.SelectedItems[i] as Quantification; selected_quants.Add(selected_mod); } Quantification none_quant = new Quantification("None"); Quantification N15_quant = new Quantification("15N_Labeling"); if (selected_quants.Contains(none_quant)) { MessageBox.Show(Message_Helper.QU_NONE_NOT_DELETE); return; } if (selected_quants.Contains(N15_quant)) { MessageBox.Show(Message_Helper.QU_N15_NOT_DELETE); return; } for (int i = 0; i < selected_quants.Count; ++i) { quantifications.Remove(selected_quants[i]); } is_update[2] = true; is_update_f(); }
public Quantification_Edit_Dialog(MainWindow mainW) { this.mainW = mainW; InitializeComponent(); Quantification quant = mainW.quant_listView.SelectedItem as Quantification; this.name_txt.Text = quant.Name; }
public static ObservableCollection <Quantification> load_Quant(string quant_ini_path) { ObservableCollection <Quantification> quantifications = new ObservableCollection <Quantification>(); StreamReader sr = new StreamReader(quant_ini_path, Encoding.Default); string line = sr.ReadLine(); //@NUMBER_LABEL=X while (!sr.EndOfStream) { line = sr.ReadLine(); if (line == "") { continue; } string[] strs = line.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries); if (strs.Length == 1) { quantifications.Add(new Quantification(strs[0], "")); } else { Quantification quant = new Quantification(strs[0], strs[1]); line = strs[1]; strs = line.Split(new char[] { ':', '{', '}' }, StringSplitOptions.RemoveEmptyEntries); List <Quant_Simple> qss = new List <Quant_Simple>(); for (int i = 1; i < strs.Length; i += 3) { if (strs[i - 1][0] == 'R') { char aa_name = strs[i][0]; string tmp_str = strs[i + 1]; string[] strs2 = tmp_str.Split(','); string label0 = strs2[0]; string label1 = strs2[1]; qss.Add(new Quant_Simple(aa_name, label0, label1)); } } quant.All_quant = qss; quantifications.Add(quant); } } sr.Close(); return(quantifications); }
private void quant_clk(object sender, MouseButtonEventArgs e) { Quantification selected_quant = this.quant_listView.SelectedItem as Quantification; if (selected_quant == null) { return; } if (selected_quant.Name == "None") { MessageBox.Show(Message_Helper.QU_NONE_NOT_EDIT); return; } if (selected_quant.Name == "15N_Labeling") { MessageBox.Show(Message_Helper.QU_N15_NOT_EDIT); return; } Quantification_Edit_Dialog qed = new Quantification_Edit_Dialog(this); qed.ShowDialog(); }
int IComparable.CompareTo(Object obj) { Quantification temp = (Quantification)obj; return(this.Name.CompareTo(temp.Name)); }
private void Apply_btn_clk(object sender, RoutedEventArgs e) { string name = name_txt.Text; if (name == "") { MessageBox.Show(Message_Helper.QU_NAME_NULL_Message); return; } Quantification new_q = new Quantification(name); for (int i = 0; i < this.grid.RowDefinitions.Count; ++i) { if (this.grid.Children[i].Visibility == Visibility.Collapsed) { continue; } StackPanel sp = this.grid.Children[i] as StackPanel; TextBox aa_tbx = sp.Children[1] as TextBox; TextBox label0_tbx = sp.Children[3] as TextBox; TextBox label1_tbx = sp.Children[5] as TextBox; string aa_str = aa_tbx.Text; string label0_str = label0_tbx.Text; string label1_str = label1_tbx.Text; bool is_right = false; if (aa_str.Length == 1 && (aa_str[0] == '*' || (aa_str[0] >= 'A' && aa_str[0] <= 'Z'))) { is_right = true; } if (!is_right) { MessageBox.Show(Message_Helper.QU_AA_A_TO_Z_Message); return; } is_right = false; for (int j = 0; j < mainW.elements.Count; ++j) { if (mainW.elements[j].Name == label0_str) { is_right = true; break; } } if (!is_right) { MessageBox.Show(Message_Helper.QU_LABEL0_NAME_Message); return; } is_right = false; for (int j = 0; j < mainW.elements.Count; ++j) { if (mainW.elements[j].Name == label1_str) { is_right = true; break; } } if (!is_right) { MessageBox.Show(Message_Helper.QU_LABEL1_NAME_Message); return; } Quant_Simple qs = new Quant_Simple(aa_str[0], label0_str, label1_str); new_q.All_quant.Add(qs); } new_q.All_quant_str = Quantification.get_string(new_q.Name, new_q.All_quant); bool is_in = false; for (int i = 0; i < mainW.quantifications.Count; ++i) { if (mainW.quant_listView.SelectedIndex != i && mainW.quantifications[i].Name == new_q.Name) { is_in = true; break; } } if (is_in) { MessageBox.Show(Message_Helper.NAME_IS_USED_Message); return; } if (!Config_Helper.IsNameRight(new_q.Name)) { MessageBox.Show(Message_Helper.NAME_WRONG); return; } int index = mainW.quant_listView.SelectedIndex; mainW.quantifications[index] = new_q; mainW.quant_listView.Items.Refresh(); mainW.is_update[2] = true; mainW.is_update_f(); mainW.quant_listView.SelectedItem = new_q; mainW.quant_listView.ScrollIntoView(new_q); this.Close(); }