Пример #1
0
        private void ShowView(CrudType action, SubGrupo target)
        {
            this._container.RegisterInstance <SubGrupo>(target);
            ISubGroupPresenter presenter = this._container.Resolve <ISubGroupPresenter>("ISubGroupPresenter");

            presenter.CloseViewRequested += delegate(object sender, EventArgs eventArgs)
            {
                if (eventArgs is CloseViewEventArgs)
                {
                    if ((eventArgs as CloseViewEventArgs).CloseViewOption == CloseViewType.Submit)
                    {
                        var repository = _container.Resolve <ISubGroupRepository>();

                        switch (action)
                        {
                        case CrudType.Create:
                            repository.Add(presenter.SubGrupo);
                            break;

                        case CrudType.Update:
                            repository.Update(presenter.SubGrupo);
                            break;
                        }
                        SearchCommand.Execute(this);
                    }
                    else
                    {
                        if (action == CrudType.Update)
                        {
                            SearchCommand.Execute(this);
                        }
                    }
                }
            };

            IBreadCrumbPresenter breadCrumb = this._container.Resolve <IBreadCrumbPresenter>();

            if (breadCrumb != null)
            {
                breadCrumb.AddCrumb(action.GetDescription(), presenter);
            }
        }
Пример #2
0
 public void SetPresenter(ISubGroupPresenter presenter)
 {
     this.DataContext = presenter;
 }