コード例 #1
0
        private void BtnAddTaskClick(object sender, RoutedEventArgs e)
        {
            StackPanelTask.Children.Add(new CheckBox()
            {
                Content = ComboBoxNameEvents.SelectedValue, Height = 40
            });
            if (ComboBoxNameEvents.SelectedItem != null)
            {
                object task = null;
                switch (ComboBoxNameEvents.SelectedValue)
                {
                case "Відкрити в Chrome": { task = OpenURLChromeControl.LoadParameters(ref GridInfoEvent); } break;

                case "Виключити/Деактивувати ПК": { task = CMDControl.LoadParameters(ref GridInfoEvent); } break;

                case "Відкрити файл": { task = OpenFileControl.LoadParameters(ref GridInfoEvent); } break;

                case "Говорити": { task = TalkControl.LoadParameters(ref GridInfoEvent); } break;

                case "Нагадати": { task = NotificationControl.LoadParameters(ref GridInfoEvent); } break;
                }
                if (task != null)
                {
                    PageAddEventData.AddStorage.Tasks.Add(task);
                }
            }
        }
コード例 #2
0
        private void ComboBoxNameEventsSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ComboBoxNameEvents.SelectedItem != null)
            {
                switch (ComboBoxNameEvents.SelectedValue)
                {
                case "Відкрити в Chrome": { OpenURLChromeControl.GetGrid(ref GridInfoEvent); } break;

                case "Виключити/Деактивувати ПК": { CMDControl.GetGrid(ref GridInfoEvent); } break;

                case "Відкрити файл": { OpenFileControl.GetGrid(ref GridInfoEvent); } break;

                case "Говорити": { TalkControl.GetGrid(ref GridInfoEvent); } break;

                case "Нагадати": { NotificationControl.GetGrid(ref GridInfoEvent); } break;
                }
            }
        }
コード例 #3
0
        public static void LoadFileEvents()
        {
            Thread loading = new Thread(new ThreadStart(() => {
                try{
                    XMLData.document.Load(XMLData.PathFile);
                    XmlElement root = XMLData.document.DocumentElement;
                    for (int i = 0; i < root.ChildNodes.Count; ++i)
                    {
                        EventModel Event  = new EventModel();
                        Event.Name        = root.ChildNodes[i].Attributes["Name"].Value.ToString();
                        Event.Description = root.ChildNodes[i].Attributes["Description"].Value.ToString();
                        for (int j = 0; j < root.ChildNodes[i].ChildNodes.Count; ++j)
                        {
                            switch (root.ChildNodes[i].ChildNodes[j].Attributes["Name"].Value.ToString())
                            {
                            case "Відкрити в Chrome": { OpenURLChromeControl.LoadOpenURLChromeForXML(ref Event, root.ChildNodes[i].ChildNodes[j]); } break;

                            case "Виключити/Деактивувати ПК": { CMDControl.LoadOpenURLChromeForXML(ref Event, root.ChildNodes[i].ChildNodes[j]); } break;

                            case "Відкрити файл": { OpenFileControl.LoadOpenURLChromeForXML(ref Event, root.ChildNodes[i].ChildNodes[j]); } break;

                            case "Говорити": { TalkControl.LoadOpenURLChromeForXML(ref Event, root.ChildNodes[i].ChildNodes[j]); } break;

                            case "Нагадати": { NotificationControl.LoadOpenURLChromeForXML(ref Event, root.ChildNodes[i].ChildNodes[j]); } break;
                            }
                        }
                        EventData.Events.Add(Event);
                    }
                }
                catch (Exception s) { MessageBox.Show(s.Message); }
            }));

            if (ControlThreads.ContaintName("XMLLoad"))
            {
                ControlThreads.RemoveKey("XMLLoad");
            }
            ControlThreads.AddThread("XMLLoad", loading);
            loading.Start();
        }