Example #1
0
        private void buttonAddEvent_Click(object sender, EventArgs e)
        {
            string selected = this.comboBoxEvents.SelectedItem.ToString();
            Event  ev       = null;

            if (selected == "Timed")
            {
                AddTimedEvent form = new AddTimedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ev = form.GetEvent();
                }
            }
            else if (selected == "CPU Usage")
            {
                AddCPUUsageEvent form = new AddCPUUsageEvent();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ev = form.GetEvent();
                }
            }
            else if (selected == "HDD Usage")
            {
                AddHDDUsageEvent form = new AddHDDUsageEvent();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ev = form.GetEvent();
                }
            }
            else if (selected == "Download Speed")
            {
                AddDownloadSpeedEvent form = new AddDownloadSpeedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ev = form.GetEvent();
                }
            }
            else if (selected == "Upload Speed")
            {
                AddUploadSpeedEvent form = new AddUploadSpeedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ev = form.GetEvent();
                }
            }
            else if (selected == "Process Finished")
            {
                AddProcessFinishedEvent form = new AddProcessFinishedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ev = form.GetEvent();
                }
            }
            else
            {
                throw new Exception("Could not handle input");
            }

            if (ev != null)
            {
                _Controller.AddEvent(ev);
            }
        }
Example #2
0
        private void buttonAddEvent_Click(object sender, EventArgs e)
        {
            string selected = this.comboBoxEvents.SelectedItem.ToString();
            Event ev = null;

            if (selected == "Timed")
            {
                AddTimedEvent form = new AddTimedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                    ev = form.GetEvent();
            }
            else if (selected == "CPU Usage")
            {
                AddCPUUsageEvent form = new AddCPUUsageEvent();
                if (form.ShowDialog() == DialogResult.OK)
                    ev = form.GetEvent();
            }
            else if (selected == "HDD Usage")
            {
                AddHDDUsageEvent form = new AddHDDUsageEvent();
                if (form.ShowDialog() == DialogResult.OK)
                    ev = form.GetEvent();
            }
            else if (selected == "Download Speed")
            {
                AddDownloadSpeedEvent form = new AddDownloadSpeedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                    ev = form.GetEvent();
            }
            else if (selected == "Upload Speed")
            {
                AddUploadSpeedEvent form = new AddUploadSpeedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                    ev = form.GetEvent();
            }
            else if (selected == "Process Finished")
            {
                AddProcessFinishedEvent form = new AddProcessFinishedEvent();
                if (form.ShowDialog() == DialogResult.OK)
                    ev = form.GetEvent();
            }
            else
                throw new Exception("Could not handle input");

            if (ev != null)
                _Controller.AddEvent(ev);
        }