Esempio n. 1
0
        public Enzymes_Edit_Dialog(MainWindow mainW)
        {
            this.mainW = mainW;
            InitializeComponent();
            Enzyme enzy = mainW.enzyme_listView.SelectedItem as Enzyme;

            this.name_txt.Text   = enzy.Name;
            this.cleave_txt.Text = enzy.Cleave_site;
            string n_c = enzy.N_C;

            switch (n_c)
            {
            case "N":
                n_c = "N-term";
                break;

            case "C":
                n_c = "C-term";
                break;
            }
            this.N_C_comboBox.Text = n_c;
            this.ignore_txt.Text   = enzy.Ignore_site;
            if (this.ignore_txt.Text == "_")
            {
                this.ignore_txt.Text = "";
            }
        }
Esempio n. 2
0
        private void enzy_clk(object sender, MouseButtonEventArgs e)
        {
            Enzyme selected_enz = this.enzyme_listView.SelectedItem as Enzyme;

            if (selected_enz == null)
            {
                return;
            }
            Enzymes_Edit_Dialog eed = new Enzymes_Edit_Dialog(this);

            eed.ShowDialog();
        }
Esempio n. 3
0
        private void Delete_Enzymes_btn_clk(object sender, RoutedEventArgs e)
        {
            ObservableCollection <Enzyme> selected_enzymes = new ObservableCollection <Enzyme>();

            for (int i = 0; i < this.enzyme_listView.SelectedItems.Count; ++i)
            {
                Enzyme selected_enzyme = this.enzyme_listView.SelectedItems[i] as Enzyme;
                selected_enzymes.Add(selected_enzyme);
            }
            for (int i = 0; i < selected_enzymes.Count; ++i)
            {
                enzymes.Remove(selected_enzymes[i]);
            }
            is_update[3] = true;
            is_update_f();
        }
Esempio n. 4
0
        private void Apply_btn_clk(object sender, RoutedEventArgs e)
        {
            string       name   = this.name_txt.Text;
            string       cleave = this.cleave_txt.Text;
            string       ignore = this.ignore_txt.Text;
            ComboBoxItem cbi    = this.N_C_comboBox.SelectedItem as ComboBoxItem;
            string       n_c    = cbi.Content as string;

            switch (n_c)
            {
            case "N-term":
                n_c = "N";
                break;

            case "C-term":
                n_c = "C";
                break;
            }
            bool is_flag = true;

            for (int i = 0; i < cleave.Length; ++i)
            {
                if (cleave[i] < 'A' || cleave[i] > 'Z')
                {
                    is_flag = false;
                    break;
                }
            }
            if (!is_flag)
            {
                MessageBox.Show(Message_Helper.EN_CLEAVE_A_TO_Z_Message);
                return;
            }
            if (cleave == "")
            {
                MessageBox.Show(Message_Helper.EN_CLEAVE_NULL_Message);
                return;
            }
            is_flag = true;
            for (int i = 0; i < ignore.Length; ++i)
            {
                if (ignore[i] < 'A' || ignore[i] > 'Z')
                {
                    is_flag = false;
                    break;
                }
            }
            if (!is_flag)
            {
                MessageBox.Show(Message_Helper.EN_IGNORE_A_TO_Z_Message);
                return;
            }
            if (ignore == "")
            {
                ignore = "_";
            }
            Enzyme enzyme = new Enzyme(name, cleave, ignore, n_c);

            if (mainW.enzymes.Contains(enzyme))
            {
                MessageBox.Show(Message_Helper.NAME_IS_USED_Message);
                return;
            }
            if (!Config_Helper.IsNameRight(enzyme.Name))
            {
                MessageBox.Show(Message_Helper.NAME_WRONG);
                return;
            }
            mainW.add_enzymes.Add(enzyme);
            mainW.enzymes.Add(enzyme);
            mainW.is_update[3] = true;
            mainW.is_update_f();
            mainW.enzyme_listView.SelectedItem = enzyme;
            mainW.enzyme_listView.ScrollIntoView(enzyme);
            this.Close();
        }
Esempio n. 5
0
        int IComparable.CompareTo(Object obj)
        {
            Enzyme temp = (Enzyme)obj;

            return(this.Name.CompareTo(temp.Name));
        }