protected virtual void ShowViewVariantParameterDialog(SingleChoiceActionExecuteEventArgs e, string mode)
        {
            string viewCaption = string.Empty;
            ViewVariantParameterObject parameter = new ViewVariantParameterObject(rootModelViewVariants);

            if (mode == STR_NewViewVariant_Id)
            {
                parameter.Caption = string.Format("{0}_{1:g}", View.Caption, DateTime.Now);
                viewCaption       = CaptionHelper.GetLocalizedText("Texts", "NewViewVariantParameterCaption");
            }
            if (mode == STR_EditViewVariant_Id && (changeVariantController != null) && changeVariantController.ChangeVariantAction.SelectedItem != null)
            {
                parameter.Caption = changeVariantController.ChangeVariantAction.SelectedItem.Caption;
                viewCaption       = CaptionHelper.GetLocalizedText("Texts", "EditViewVariantParameterCaption");
            }
            DialogController dialogController = Application.CreateController <DialogController>();

            dialogController.Accepting += dialogController_Accepting;
            dialogController.Tag        = mode;
            DetailView dv = Application.CreateDetailView(ObjectSpaceInMemory.CreateNew(), parameter, false);

            dv.ViewEditMode = ViewEditMode.Edit;
            dv.Caption      = viewCaption;
            e.ShowViewParameters.CreatedView = dv;
            e.ShowViewParameters.Controllers.Add(dialogController);
            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        }
Beispiel #2
0
 private static void CreateDetailView(ShowViewParameters svp, XafApplication app, string message)
 {
     svp.CreatedView          = app.CreateDetailView(ObjectSpaceInMemory.CreateNew(), new MessageBoxTextMessage(message));
     svp.TargetWindow         = TargetWindow.NewModalWindow;
     svp.Context              = TemplateContext.PopupWindow;
     svp.CreateAllControllers = true;
 }
Beispiel #3
0
        public void Customize(IFixture fixture)
        {
            fixture.Inject(new DataSet());
            var objectSpace = ObjectSpaceInMemory.CreateNew(fixture.Create <DataSet>());

            fixture.Inject(objectSpace);
            fixture.Inject(objectSpace.Session());
        }
Beispiel #4
0
        static XPObjectSpace CreateRecords()
        {
            XafTypesInfo.Instance.RegisterEntity(typeof(PEnumClass));
            var dataSet       = new DataSet();
            var XPObjectSpace = ((XPObjectSpace)ObjectSpaceInMemory.CreateNew(dataSet));

            _pEnumClass = XPObjectSpace.CreateObject <PEnumClass>();
            XPObjectSpace.CommitChanges();
            return(XPObjectSpace);
        }
Beispiel #5
0
        static XPObjectSpace CreateRecords()
        {
            var dataSet       = new DataSet();
            var XPObjectSpace = ((XPObjectSpace)ObjectSpaceInMemory.CreateNew(dataSet));

            _pEnumClass        = XPObjectSpace.CreateObject <PEnumClass>();
            _pEnumClass.MyEnum = MyEnum.Val2;
            XPObjectSpace.CommitChanges();
            return(XPObjectSpace);
        }
        public void ShowNonPersistentView(IObjectSpace objSpace, Type objType)
        {
            if (objType == null)
            {
                throw new NullReferenceException("Object Type must not be null if you want to call ShowNonPersistentView");
            }
            objSpace = objSpace ?? ObjectSpaceInMemory.CreateNew();
            object obj = Activator.CreateInstance(objType);

            ShowView(objSpace, obj);
        }
Beispiel #7
0
        protected virtual void SwitchLanguageDelegate(object sender, SimpleActionExecuteEventArgs e)
        {
            Application.SetLanguage(((IModelApplicationServices)(Application.Model)).CurrentAspect == "vi"?"en":"vi");
            saSwitchLanguageLogon.ImageName = ((IModelApplicationServices)(Application.Model)).CurrentAspect == "vi" ? "Flag_eng" : "Flag_vn";
            // TODO: Nếu thay đổi LogonParameter phải chú ý ở đây!
            IObjectSpace ObjectSpace = ObjectSpaceInMemory.CreateNew();

            DevExpress.ExpressApp.Security.AuthenticationStandardLogonParameters logonActionParameters = Activator.CreateInstance <DevExpress.ExpressApp.Security.AuthenticationStandardLogonParameters>();
            DetailView dv = Application.CreateDetailView(ObjectSpace, logonActionParameters, true);

            dv.ViewEditMode = ViewEditMode.Edit;
            Frame.SetView(dv);
        }
Beispiel #8
0
        protected virtual void CreateParametersViewCore(SimpleActionExecuteEventArgs e)
        {
            Type parametersType = e.Action.Tag as Type;

            Guard.ArgumentNotNull(parametersType, "parametersType");
            object     logonActionParameters = Activator.CreateInstance(parametersType);
            DetailView dv = Application.CreateDetailView(ObjectSpaceInMemory.CreateNew(), logonActionParameters);

            dv.ViewEditMode = ViewEditMode.Edit;
            e.ShowViewParameters.CreatedView = dv;
            e.ShowViewParameters.Context     = TemplateContext.PopupWindow;
            //WinForms:
            //e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
            //ASP.NET:
            e.ShowViewParameters.TargetWindow = TargetWindow.Current;
        }
Beispiel #9
0
        public static void XafApplicationInstance(this IFaker faker, Action <XafApplication> action, Func <IList <Type> > func, Action <DetailView> viewAction, Action <Window> windowAction, params Controller[] controllers)
        {
            var            dataSet       = new DataSet();
            IObjectSpace   XPObjectSpace = ObjectSpaceInMemory.CreateNew(dataSet);
            XafApplication application   = Isolate.Fake.XafApplicationInstance(func, dataSet, controllers);

            action.Invoke(application);
            application.ShowViewStrategy = new MdiShowViewStrategy(application);
            object o          = XPObjectSpace.CreateObject(func.Invoke().ToList().First());
            var    detailView = application.CreateDetailView(XPObjectSpace, o);

            viewAction.Invoke(detailView);
            var window = application.CreateWindow(TemplateContext.View, controllers, true);

            windowAction.Invoke(window);
            window.SetView(detailView);
        }
Beispiel #10
0
        void PivotSettingsChoiceActionOnExecute(object sender, SingleChoiceActionExecuteEventArgs singleChoiceActionExecuteEventArgs)
        {
            var         objectSpace    = ObjectSpaceInMemory.CreateNew();
            var         type           = (Type)singleChoiceActionExecuteEventArgs.SelectedChoiceActionItem.Data;
            var         persistentType = GetPersistentType(type);
            var         pivotOption    = objectSpace.CreateObject(persistentType);
            XPClassInfo classInfo      = ((XPObjectSpace)ObjectSpace).Session.GetClassInfo(persistentType);

            Synchonize(pivotOption, type, classInfo);
            var showViewParameters = singleChoiceActionExecuteEventArgs.ShowViewParameters;

            showViewParameters.CreatedView = Application.CreateDetailView(objectSpace, pivotOption, true);

            showViewParameters.TargetWindow = TargetWindow.NewModalWindow;
            var dialogController = new DialogController();

            dialogController.AcceptAction.Execute += (o, args) => Synchonize(classInfo, type, args.CurrentObject);
            showViewParameters.Controllers.Add(dialogController);
            ((DetailView)showViewParameters.CreatedView).ViewEditMode = ViewEditMode.Edit;
        }
Beispiel #11
0
        public static XafApplication XafApplicationInstance(this IFaker faker, Func <IList <Type> > func, DataSet dataSet, params Controller[] controllers)
        {
            var defaultSkinListGenerator = Isolate.Fake.Instance <DefaultSkinListGenerator>();
            var editorsFactory           = new EditorsFactory();

#pragma warning disable 612,618
            Isolate.WhenCalled(() => editorsFactory.CreateListEditor(null, null, null)).WillReturn(new GridListEditor(null));
#pragma warning restore 612,618
            Isolate.Swap.AllInstances <EditorsFactory>().With(editorsFactory);

            Isolate.Swap.NextInstance <DefaultSkinListGenerator>().With(defaultSkinListGenerator);
            var application = Isolate.Fake.Instance <XpandWinApplication>();
            RegisterControllers(application, controllers);
            //            var xpandModuleBase = Isolate.Fake.Instance<XpandModuleBase>(Members.CallOriginal, ConstructorWillBe.Called);
            //            xpandModuleBase.Setup(application);
            var XPObjectSpaceProvider = Isolate.Fake.Instance <IObjectSpaceProvider>();
            Isolate.WhenCalled(() => XPObjectSpaceProvider.TypesInfo).WillReturn(XafTypesInfo.Instance);
            application.CreateCustomObjectSpaceProvider += (sender, args) => args.ObjectSpaceProvider = XPObjectSpaceProvider;
            RegisterDomainComponents(application, func);
            application.Setup();
            Isolate.WhenCalled(() => application.CreateObjectSpace()).WillReturn(ObjectSpaceInMemory.CreateNew(dataSet));

            return(application);
        }
        private void CloneDoctorEventAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            CloneDoctorEventParameters parameters = new CloneDoctorEventParameters();

            e.View = Application.CreateDetailView(ObjectSpaceInMemory.CreateNew(), parameters, true);
        }
Beispiel #13
0
 PersistentAssemblyBuilder GetPersistentAssemblyBuilder()
 {
     _XPObjectSpace = (XPObjectSpace)ObjectSpaceInMemory.CreateNew();
     return(PersistentAssemblyBuilder.BuildAssembly(_XPObjectSpace, "a" + Guid.NewGuid().ToString().Replace("-", "")));
 }
 /// <summary>
 /// Show Non-Persistent Object
 /// </summary>
 public void ShowNonPersistentView(object obj)
 {
     ShowView(ObjectSpaceInMemory.CreateNew(), obj);
 }