Exemple #1
0
        private void TaskControl_Click(object sender, RoutedEventArgs e)
        {
            var btn = (ProcButton)sender;

            if (btn.Name == "task_mode_switch")
            {
                if (!Current.App.IsTerminalInitFinished)
                {
                    Current.App.ErrorMsg = "信息初始化尚未完成,请稍后!";
                    return;
                }

                Current.App.TaskMode = Current.App.TaskMode == TaskMode.自动任务 ? TaskMode.手动任务 : TaskMode.自动任务;
                MessageBox.Show(string.Format("成功切换为{0}!", Current.App.TaskMode), "提示", MessageBoxButton.OK);
                Logging.AddEvent(string.Format("点击【切换{0}】", Current.App.TaskMode), Arthur.App.Model.EventType.信息);
            }
            else if (btn.Name == "task_reset")
            {
                Current.Task.Status = Model.TaskStatus.完成;
                Logging.AddEvent("点击【任务复位】", Arthur.App.Model.EventType.信息);
            }
        }
Exemple #2
0
        private void RunningControl_Click(object sender, RoutedEventArgs e)
        {
            if (Arthur.App.Current.Option.RemainingMinutes <= 0)
            {
                MessageBox.Show("软件已经过期,无法操作!");
                return;
            }

            var btn = (ProcButton)sender;

            if (btn.Name == "start")
            {
                if (TimerExec.IsRunning)
                {
                    Current.App.ErrorMsg = "系统已经在运行,请勿重复启动!";
                    return;
                }

                if (Current.App.RunStatus == RunStatus.异常)
                {
                    Current.App.ErrorMsg = "请先复位!";
                    return;
                }

                var result = Running.Start();
                if (result.IsSucceed)
                {
                    Logging.AddEvent("点击【启动】", Arthur.App.Model.EventType.信息);
                }
                else
                {
                    Running.ShowErrorMsg(result.Msg);
                }
            }
            else if (btn.Name == "stop")
            {
                if (!TimerExec.IsRunning)
                {
                    Current.App.ErrorMsg = "系统没有在运行,操作无效!";
                    return;
                }

                var result = Running.Stop();
                if (result.IsSucceed)
                {
                    Logging.AddEvent("点击【停止】", Arthur.App.Model.EventType.信息);
                }
                else
                {
                    Running.ShowErrorMsg(result.Msg);
                }
            }
            else if (btn.Name == "reset")
            {
                if (Current.App.RunStatus == RunStatus.运行)
                {
                    Current.App.ErrorMsg = "系统正在运行,复位无效,请停止运行后再执行复位操作!";
                    return;
                }

                var result = Running.Reset();
                if (result.IsSucceed)
                {
                    Logging.AddEvent("点击【复位】", Arthur.App.Model.EventType.信息);
                }
                else
                {
                    Running.ShowErrorMsg(result.Msg);
                }
            }
        }