Example #1
0
        void createCommand()
        {
            CreateClassHoursTimesValue createWin = new CreateClassHoursTimesValue(Models.Enums.OperatorEnum.Add, this.GetCurrentRuleEnum());

            createWin.Closed += (s, arg) =>
            {
                if (createWin.DialogResult.Value)
                {
                    // 1.向UI中插入
                    var last  = this.Rules.LastOrDefault();
                    var index = last == null ? 0 : Convert.ToInt32(last.NO);

                    // 2.创建对象
                    createWin.Add.NO = index + 1;

                    // 3.更新界面
                    this.Rules.Add(createWin.Add);
                }
            };
            createWin.ShowDialog();
        }
Example #2
0
        void modifyCommand(object obj)
        {
            UIClassHourRule rule = obj as UIClassHourRule;

            CreateClassHoursTimesValue createWin = new CreateClassHoursTimesValue(Models.Enums.OperatorEnum.Modify, this.GetCurrentRuleEnum(), rule);

            createWin.Closed += (s, arg) =>
            {
                var modify = createWin.Modify;
                if (createWin.DialogResult.Value)
                {
                    rule.IsActive       = modify.IsActive;
                    rule.Weight         = modify.Weight;
                    rule.Periods        = modify.Periods;
                    rule.MaxConcurrency = modify.MaxConcurrency;
                    rule.MaxOccupy      = modify.MaxOccupy;
                    rule.ClassHours     = modify.ClassHours;
                    rule.RaiseChanged();
                }
            };
            createWin.ShowDialog();
        }