コード例 #1
0
        protected static void GenerateCancelForm(IInputForm form, IEnumerable <Entity> entities, object context)
        {
            IInputFormControl <string> commentControl = form.AddStringControl("Причина", true);

            commentControl.Name       = "Comment";
            commentControl.IsRequired = true;
        }
コード例 #2
0
 public MainPresenter(IMainForm mainform, IInputForm iform, IMessageService mservice, IHRBuisnessLogic buisnesslogic)
 {
     _mainform                    = mainform;
     _iform                       = iform;
     _mservice                    = mservice;
     _buisnesslogic               = buisnesslogic;
     _mainform.FormShown         += _mainform_FormShown;
     _iform.InputButtonClick     += _iform_InputButtonClick;
     _mainform.InputBDMenuClick  += _mainform_InputBDMenuClick;
     _mainform.OutputBDMenuClick += _mainform_OutputBDMenuClick;
     _mainform.ShowResult        += _mainform_ShowResult;
     _mainform.OnAddUser         += _mainform_OnAddUser;
     _mainform.SetActiveUser      = "******";
     _buisnesslogic.Message      += _buisnesslogic_Message;
 }
コード例 #3
0
        public InputForm(string figure)
        {
            this.figure = figure;
            switch (figure)
            {
            case "Прямоугольник":
                inputForm = new RecComponent();
                break;

            case "Круг":
                inputForm = new CirComponent();
                break;

            case "Треугольник":
                inputForm = new TriComponent();
                break;
            }
            inputForm.InitializeComponent(this);
        }
コード例 #4
0
        public MainPresenter(ImodeSelectionForm selectForm, IFileManager manager,
                             IMessageService service, ISelfAssesForm selfAsses, IInputForm inputForm,
                             IResultForm resultForm)
        {
            _selectForm     = selectForm;
            _manager        = manager;
            _messageService = service;
            _inputForm      = inputForm;
            _selfAsses      = selfAsses;
            _resultForm     = resultForm;

            _selectForm.FinishMatrixClick  += _selectForm_FinishMatrixClick;
            _selectForm.SelfAssesClick     += _selectForm_SelfAssesClick;
            _selectForm.AlterChangeClick   += _selectForm_AlterChangeClick;
            _inputForm.FileOpenClick       += _matrixForm_FileOpenClick;
            _inputForm.FileSaveClick       += _inputForm_FileSaveClick;
            _inputForm.ButAlterChangeClick += _inputForm_WriteAlternatives;
            _inputForm.ButProcessingClick  += _inputForm_ProcessingMatrixClick;
            _selfAsses.ChoiceClick         += _selfAsses_ChoiceClick;
            matrix = new PreferenceMatrix(manager.Alternatives.Length);
        }
コード例 #5
0
        public static async Task <DataTransaction> ChangeStageAsync(EntityWorkflowTransition transition, IEnumerable <Entity> entities, IEntitySetExtensionContext context)
        {
            if (!entities.Any())
            {
                return(null);
            }

            Dictionary <string, object> inputValues;

            if (transition.ShowInputForm)
            {
                if (!await Task.Run(() => transition.ValidateEntities(entities)))
                {
                    return(null);
                }

                IInputForm form = InputFormFactory.Instance.CreateForm();
                form.Caption = transition.CommandText;

                if (transition.HasConfirmation)
                {
                    form.AddTextBlock(transition.GetConfimationText(entities, context));
                }

                transition.GenerateInputForm(form, entities, context);

                if (transition.HasComment && !form.Controls.Any(c => c.Name == "Comment"))
                {
                    form.AddStringControl("Комментарий", true).Name = "Comment";
                }

                if (form.Controls.Any(c => c is IInputFormSelectEntityControl))
                {
                    if (!await form.Show())
                    {
                        return(null);
                    }
                }
                else
                {
                    if (!form.ShowDialog())
                    {
                        return(null);
                    }
                }

                inputValues = form.Controls.ToDictionary(c => string.IsNullOrEmpty(c.Name) ? c.Label : c.Name, c => c.Value);
            }
            else
            {
                inputValues = new Dictionary <string, object>(0);
                if (transition.HasConfirmation)
                {
                    if (MessageBox.Show(Application.Current.MainWindow, transition.GetConfimationText(entities, context), transition.CommandText,
                                        MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                    {
                        return(null);
                    }
                }
            }

            return(await ProgressFeedback.Run("Смена стадии", progress =>
            {
                progress.Cancelable = false;

                string transitionName = transition.ToString();
                string toStageName = transition.ToStage?.ToString();

                if (string.IsNullOrWhiteSpace(toStageName) || transitionName == toStageName)
                {
                    progress.Progress(transitionName);
                }
                else
                {
                    progress.Progress($"{transitionName} — {toStageName}");
                }

                return transition.Execute(entities, null, inputValues, context);
            }));
        }
 public void GenerateInputForm(IInputForm form, IEnumerable <Entity> entities, object context)
 {
     InputFormGenerate?.Invoke(form, entities, context);
 }
コード例 #7
0
        protected static void GenerateDoneForm(IInputForm form, IEnumerable <Entity> entities, object context)
        {
            IInputFormControl <string> commentControl = form.AddStringControl("Комментарий", true);

            commentControl.Name = "Comment";
        }
コード例 #8
0
 public void GenerateInputForm(IInputForm form, IEnumerable <Entity> entities, object context)
 {
     _provider.GenerateInputForm(form, entities, context);
 }