コード例 #1
0
        /// <summary>
        /// 放弃
        /// </summary>
        void Abandon(object obj)
        {
            var confirm = this.ShowDialog("提示信息", "确认放弃使用课表?", CustomControl.Enums.DialogSettingType.OkAndCancel, CustomControl.Enums.DialogType.Warning);

            if (confirm == CustomControl.Enums.DialogResultType.OK)
            {
                PrechargeResultWindow window = obj as PrechargeResultWindow;
                window.IsUseResult  = false;
                window.DialogResult = true;
            }
        }
コード例 #2
0
        /// <summary>
        /// 关闭
        /// </summary>
        /// <param name="obj"></param>
        void close(object obj)
        {
            PrechargeResultWindow window = obj as PrechargeResultWindow;

            window.DialogResult = false;
        }
コード例 #3
0
        public void precharge(UIResult result)
        {
            var sample = WebAPI.Instance.SampleTask(result.TaskID);

            if (sample.Item1)
            {
                // 预览
                PrechargeResultWindow precharge = new PrechargeResultWindow(result.Name, sample.Item2);
                precharge.Closed += (s, arg) =>
                {
                    // 如果预览结果为True.
                    if (precharge.DialogResult == true)
                    {
                        var results = ResultDataManager.GetResults(base.LocalID);
                        var local   = CommonDataManager.GetLocalCase(base.LocalID);

                        if (precharge.IsUseResult)
                        {
                            var value = WebAPI.Instance.ConfirmTask(result.TaskID);
                            if (value.Item1)
                            {
                                result.IsUsed = true;
                                local.Serizlize(results);

                                // 更新界面
                                var uiTask = this.Results.FirstOrDefault(r => r.TaskID.Equals(result.TaskID));
                                if (uiTask != null)
                                {
                                    uiTask.IsUsed = true;
                                    uiTask.RaiseChanged();
                                }

                                this.ShowDialog("提示信息", "操作成功!", DialogSettingType.NoButton, DialogType.None);
                            }
                            else
                            {
                                this.ShowDialog("提示信息", "操作失败!", DialogSettingType.OnlyOkButton, DialogType.Warning);
                            }
                        }
                        else
                        {
                            var value = WebAPI.Instance.AbandonTask(result.TaskID);
                            if (value.Item1)
                            {
                                this.Results.Remove(result);
                                results.RemoveAll(r => r.TaskID == result.TaskID);
                                local.Serizlize(results);

                                this.ShowDialog("提示信息", "操作成功!", DialogSettingType.NoButton, DialogType.None);
                            }
                            else
                            {
                                this.ShowDialog("提示信息", "操作失败!", DialogSettingType.OnlyOkButton, DialogType.Warning);
                            }
                        }
                    }
                };
                precharge.ShowDialog();
            }
            else
            {
                this.ShowDialog("提示信息", sample.Item3, DialogSettingType.OnlyOkButton, DialogType.Warning);
            }
        }