예제 #1
0
        public static void CreateNewSequationWindow()
        {
            var mainWin = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;

            NewSequation ns = new NewSequation();

            List <string> elements = Scheme.Scheme.getActionsNames();

            foreach (string s in elements)
            {
                ComboBoxItem InnerItem = new ComboBoxItem();
                InnerItem.Content = s;
                ns.ChoseAction.Items.Add(InnerItem);
            }
            ns.Show();
            ns.Create.Click += (i, e) =>
            {
                if (ns.ChoseAction.Text == "")
                {
                }
                else
                {
                    ActiveAction = ns.ChoseAction.Text;
                    Act.Items.Add(ActiveAction);
                    List <string> at  = Scheme.Scheme.getExsistedAtributesNames(ActiveAction);
                    List <string> val = new List <string>();
                    if (at != null)
                    {
                        foreach (string a in at)
                        {
                            val.Add("1");
                        }
                        Experts.Add(ActiveAction, at, val);
                    }
                    ns.Close();
                }
            };
        }
예제 #2
0
        public static void DeleteSequationWindow()
        {
            var mainWin = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;

            if (Act.SelectedItem != null)
            {
                string tmp = Act.SelectedItem.ToString();
                Act.SelectedItem = null;
                Act.Items.Remove(tmp);
                Experts.Remove(tmp);
            }
            else
            {
                List <string> elements = new List <string>();
                foreach (var item in Act.Items)
                {
                    elements.Add(item.ToString());
                }
                NewSequation ns = new NewSequation();
                foreach (string s in elements)
                {
                    ns.ChoseAction.Items.Add(s);
                }
                ns.Create.Content = "Удалить";
                ns.Show();
                ns.Create.Click += (i, e) =>
                {
                    if (ns.ChoseAction.Text != "")
                    {
                        Act.Items.Remove(ns.ChoseAction.Text);
                        Experts.Remove(ns.ChoseAction.Text);
                        ns.Close();
                    }
                };
            }
        }