private static IObservable <ShowViewParameters> ShowView(this XafApplication application)
        {
            return(application.WhenWindowCreated().When(TemplateContext.ApplicationWindow)
                   .SelectMany(window => {
                var modelView = application.Model.ToReactiveModule <IModelReactiveModuleOneView>().OneView;
                if (modelView.View != null)
                {
                    var showViewParameters = new ShowViewParameters();
                    var dialogController = new OneViewDialogController();
                    dialogController.AcceptAction.Caption = "Configure";
                    dialogController.CancelAction.Active[""] = false;
                    showViewParameters.Controllers.Add(dialogController);
                    showViewParameters.NewWindowTarget = NewWindowTarget.Separate;
                    showViewParameters.Context = TemplateContext.PopupWindow;

                    showViewParameters.TargetWindow = TargetWindow.NewWindow;
                    showViewParameters.CreatedView = application.CreateView(modelView.View);
                    application.ShowViewStrategy.ShowView(showViewParameters, new ShowViewSource(null, null));
                    return showViewParameters.ReturnObservable();
                }

                return Observable.Empty <ShowViewParameters>();
            })
                   .TraceOneView()
                   .WhenNotDefault());
        }
예제 #2
0
        public static IObservable <ShowViewParameters> ShowOneViewParameters(this XafApplication application, IObjectSpace objectSpace = null)
        {
            var modelView = application.Model.ToReactiveModule <IModelReactiveModuleOneView>().OneView;

            if (modelView.View != null)
            {
                objectSpace ??= application.CreateObjectSpace(modelView.View.AsObjectView.ModelClass.TypeInfo.Type);
                var showViewParameters = new ShowViewParameters();
                var dialogController   = new OneViewDialogController();
                dialogController.AcceptAction.Caption    = "Configure";
                dialogController.CancelAction.Active[""] = false;
                showViewParameters.Controllers.Add(dialogController);
                showViewParameters.NewWindowTarget = NewWindowTarget.Separate;
                showViewParameters.Context         = TemplateContext.PopupWindow;
                showViewParameters.TargetWindow    = TargetWindow.NewWindow;
                showViewParameters.CreatedView     = application.NewView(modelView.View, objectSpace);
                return(showViewParameters.ReturnObservable());
            }

            return(Observable.Empty <ShowViewParameters>());
        }