Beispiel #1
0
        private void permutsListBox_DoubleClick(Object sender, EventArgs e)
        {
            var index = permutsListBox.SelectedIndex;

            if (index != -1)
            {
                var form   = new AddPermutsForm(permuts[index].Key, permuts[index].Value, permuts[index].Final);
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (permuts.Any((x) => (permuts[index] != x) && (x.Key == form.From)))
                    {
                        {
                            MessageBox.Show("Замена с такого значения уже имеется!");
                            return;
                        }
                    }
                    permuts[index].Key   = form.From;
                    permuts[index].Value = form.To;
                    permuts[index].Final = form.IsFinal;
                    permutsListBox.Items.RemoveAt(index);
                    permutsListBox.Items.Insert(index, string.Format("{0} ->{1} {2}", form.From, (form.IsFinal ? "." : string.Empty), form.To));
                }
            }
        }
Beispiel #2
0
        private void addPermutsButton_Click(Object sender, EventArgs e)
        {
            var form   = new AddPermutsForm();
            var result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (permuts.Any((x) => x.Key == form.From))
                {
                    MessageBox.Show("Замена с такого значения уже имеется!");
                    return;
                }
                permuts.Add(new Triple <string, string, bool>(form.From, form.To, form.IsFinal));
                permutsListBox.Items.Add(string.Format("{0} ->{1} {2}", form.From, (form.IsFinal ? "." : string.Empty), form.To));
            }
        }