コード例 #1
0
 void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
 {
     if (e.Shortcut != null && !string.IsNullOrEmpty(e.Shortcut.ViewId))
     {
         ProcessAutoCreatableShortcut(e);
     }
 }
コード例 #2
0
 private void Application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs args)
 {
     //if (!isPers) {
     //    args.View = dv;
     //    args.Handled = true;
     //}
 }
コード例 #3
0
        private void Application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
        {
            if (e.Shortcut.ViewId == "DemoWelcome_ListView")
            {
                var          welcome     = new DemoWelcome();
                IObjectSpace objectSpace = Application.CreateObjectSpace();
                e.View = Application.CreateDetailView(objectSpace, welcome, true);

                e.Handled = true;
            }
        }
コード例 #4
0
 private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
 {
     if (e.Shortcut.ViewId == "ConsultarPedido_DetailView")
     {
         IObjectSpace    objectSpace = Application.CreateObjectSpace();
         ConsultarPedido log         = objectSpace.CreateObject <ConsultarPedido>();
         DetailView      createdView = Application.CreateDetailView(objectSpace, log, true);
         createdView.ViewEditMode = ViewEditMode.Edit;
         e.View    = createdView;
         e.Handled = true;
     }
 }
コード例 #5
0
 public void Proccess(CustomProcessShortcutEventArgs shortcutEventArgs) {
     if (shortcutEventArgs.Handled) return;
     var shortcut = shortcutEventArgs.Shortcut;
     IModelDetailView modelDetailView = GetModelDetailView(shortcut);
     if ((modelDetailView != null && IsEnable(modelDetailView))) {
         if (CanCreate(modelDetailView.ModelClass.TypeInfo)) {
             shortcutEventArgs.Handled = true;
             var objectSpace = _application.CreateObjectSpace();
             object obj = GetObject(shortcut, modelDetailView, objectSpace);
             _detailView = _application.CreateDetailView(objectSpace, modelDetailView, true, obj);
             shortcutEventArgs.View = _detailView;
         }
     }
 }
コード例 #6
0
        public void Application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) {
            int i = 0;

            while ((i < cachedShortcuts.Count) && (cachedShortcuts[i].Shortcut != e.Shortcut))
                i++;

            if (i < cachedShortcuts.Count) {
                e.Shortcut.ObjectKey = cachedShortcuts[i].Parameter.CurrentValue.ToString();
            }
            else if (e.Shortcut.ObjectKey.StartsWith("@")) {
                var cachedShortcut = new CachedViewShortcut(e.Shortcut,ParametersFactory.CreateParameter(e.Shortcut.ObjectKey.Substring(1)));
                cachedShortcuts.Add(cachedShortcut);
                e.Shortcut.ObjectKey = cachedShortcut.Parameter.CurrentValue.ToString();
            }
        }
コード例 #7
0
        public void Proccess(CustomProcessShortcutEventArgs shortcutEventArgs) {
            var shortcut = shortcutEventArgs.Shortcut;
            if (shortcut.ObjectKey.StartsWith("@"))
                shortcut.ObjectKey =
                    ParametersFactory.CreateParameter(shortcut.ObjectKey.Substring(1)).CurrentValue.ToString();

            var baseViewInfoNodeWrapper = new ApplicationNodeWrapper(_application.Model).Views.FindViewById(shortcut.ViewId);
            if (string.IsNullOrEmpty(shortcut.ObjectKey) && (baseViewInfoNodeWrapper is DetailViewInfoNodeWrapper)) {
                var objectSpace = _application.CreateObjectSpace();
                shortcutEventArgs.Handled = true;
                shortcutEventArgs.View = _application.CreateDetailView(objectSpace,
                                                                       objectSpace.CreateObject(
                                                                           baseViewInfoNodeWrapper.BusinessObjectType));
            }
        }
コード例 #8
0
 private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
 {
     if (e.Shortcut != null && !string.IsNullOrEmpty(e.Shortcut.ViewId))
     {
         IModelView modelView = Application.FindModelView(e.Shortcut.ViewId);
         if (modelView is IModelObjectView)
         {
             ITypeInfo typeInfo = ((IModelObjectView)modelView).ModelClass.TypeInfo;
             AutoCreatableObjectAttribute attribute = typeInfo.FindAttribute <AutoCreatableObjectAttribute>(true);
             if (attribute != null && attribute.AutoCreatable)
             {
                 IObjectSpace objSpace = Application.CreateObjectSpace(typeInfo.Type);
                 object       obj;
                 if (typeof(XPBaseObject).IsAssignableFrom(typeInfo.Type) ||
                     (typeInfo.IsInterface && typeInfo.IsDomainComponent))
                 {
                     obj = objSpace.FindObject(typeInfo.Type, null);
                     if (obj == null)
                     {
                         obj = objSpace.CreateObject(typeInfo.Type);
                     }
                 }
                 else
                 {
                     if (typeInfo.Type == typeof(WelcomeObject))
                     {
                         obj = WelcomeObject.Instance;
                     }
                     else
                     {
                         obj = Activator.CreateInstance(typeInfo.Type);
                     }
                 }
                 //obj = typeof(BaseObject).IsAssignableFrom(typeInfo.Type) ? objSpace.CreateObject(typeInfo.Type) : Activator.CreateInstance(typeInfo.Type);
                 DetailView detailView = Application.CreateDetailView(objSpace, obj, true);
                 if (attribute.ViewEditMode == ViewEditMode.Edit)
                 {
                     detailView.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
                 }
                 e.View    = detailView;
                 e.Handled = true;
             }
         }
     }
 }
コード例 #9
0
ファイル: Module.cs プロジェクト: lulzzz/MyWorkbench
        private void Application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
        {
            if (Application.Model.Views[e.Shortcut.ViewId] is IModelListView view)
            {
                Type t = XafTypesInfo.Instance.FindTypeInfo(view.AsObjectView.ModelClass.Name).Type;
                if (t.GetInterface(typeof(ISingletonBO).FullName) != null)
                {
                    IObjectSpace space = Application.CreateObjectSpace(t);
                    object       obj   = space.FindObject(t, null, true);
                    if (obj == null)
                    {
                        obj = space.CreateObject(t);
                    }

                    e.View    = Application.CreateDetailView(space, obj);
                    e.Handled = true;
                }
            }
        }
 void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
 {
     if (e.Shortcut.ViewId == "IssueStatistics_ListView")
     {
         IObjectSpace    nonPersistentObjectSpace = Application.CreateObjectSpace(typeof(IssueStatistics));
         IssueStatistics issueStatistics          = new IssueStatistics();
         using (IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Issue))) {
             issueStatistics.ActiveIssuesCount =
                 objectSpace.GetObjectsCount(typeof(Issue),
                                             CriteriaOperator.Parse("[Status] == 'Active'"));
             issueStatistics.ClosedIssuesCount =
                 objectSpace.GetObjectsCount(typeof(Issue),
                                             CriteriaOperator.Parse("[Status] == 'Closed'"));
             issueStatistics.TotalIssuesCount = issueStatistics.ActiveIssuesCount + issueStatistics.ClosedIssuesCount;
         }
         e.View = Application.CreateDetailView(nonPersistentObjectSpace, issueStatistics, true);
         e.View.AllowEdit["CanEditIssueStatistics"] = false;
         e.Handled = true;
     }
 }
コード例 #11
0
        public void Proccess(CustomProcessShortcutEventArgs shortcutEventArgs)
        {
            if (shortcutEventArgs.Handled)
            {
                return;
            }
            var shortcut        = shortcutEventArgs.Shortcut;
            var modelDetailView = GetModelDetailView(shortcut);

            if ((modelDetailView != null && IsEnable(modelDetailView)))
            {
                if (CanCreate(modelDetailView.ModelClass.TypeInfo))
                {
                    shortcutEventArgs.Handled = true;
                    var    objectSpace = _application.CreateObjectSpace(modelDetailView.ModelClass.TypeInfo.Type);
                    object obj         = GetObject(shortcut, modelDetailView, objectSpace);
                    _detailView            = _application.CreateDetailView(objectSpace, modelDetailView, true, obj);
                    shortcutEventArgs.View = _detailView;
                }
            }
        }
コード例 #12
0
        private void ProcessAutoCreatableShortcut(CustomProcessShortcutEventArgs e)
        {
            IModelView modelView = Application.FindModelView(e.Shortcut.ViewId);

            if (modelView is IModelObjectView)
            {
                ITypeInfo typeInfo = ((IModelObjectView)modelView).ModelClass.TypeInfo;
                Xafology.ExpressApp.Attributes.AutoCreatableObjectAttribute attribute = typeInfo.FindAttribute <Xafology.ExpressApp.Attributes.AutoCreatableObjectAttribute>(true);
                if (attribute != null && attribute.AutoCreatable)
                {
                    // create new instance of object of it is marked as AutoCreatable
                    IObjectSpace objSpace = Application.CreateObjectSpace();
                    object       obj;
                    if (typeof(XPBaseObject).IsAssignableFrom(typeInfo.Type) ||
                        (typeInfo.IsInterface && typeInfo.IsDomainComponent))
                    {
                        obj = objSpace.FindObject(typeInfo.Type, null);
                        if (obj == null)
                        {
                            obj = objSpace.CreateObject(typeInfo.Type);
                        }
                    }
                    else
                    {
                        obj = typeof(BaseObject).IsAssignableFrom(typeInfo.Type) ?
                              objSpace.CreateObject(typeInfo.Type) : Activator.CreateInstance(typeInfo.Type);
                    }
                    DetailView detailView = Application.CreateDetailView(objSpace, obj, true);
                    if (attribute.ViewEditMode == ViewEditMode.Edit)
                    {
                        detailView.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
                    }
                    e.View    = detailView;
                    e.Handled = true;
                }
            }
        }
コード例 #13
0
        private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
        {
            Type tipoObjParametros;

            var vm = Application.Model.Views[e.Shortcut.ViewId];

            var consultaStoredProcedureAttribute =
                vm.AsObjectView.ModelClass.TypeInfo.FindAttribute <ConsultaStoredProcedureAttribute>();

            if (consultaStoredProcedureAttribute == null)
            {
                var type = vm.AsObjectView.ModelClass.TypeInfo.Type;
                if (typeof(IConsultaStoredProcedure).IsAssignableFrom(type))
                {
                    tipoObjParametros = type;
                }
                else
                {
                    return;
                }
            }
            else
            {
                tipoObjParametros = consultaStoredProcedureAttribute.ConsultaStoredProcedure;
            }

            var objectSpace = Application.CreateObjectSpace();

            var objetoParametros = Activator.CreateInstance(tipoObjParametros);

            e.View         = Application.CreateDetailView(objectSpace, objetoParametros);
            e.View.Caption = $"Parámetros para vista {vm.Caption}";

            ((DetailView)e.View).ViewEditMode = ViewEditMode.Edit;

            e.Handled = true;
        }
コード例 #14
0
ファイル: XpandWinApplication.cs プロジェクト: martys/eXpand
        protected override void OnCustomProcessShortcut(CustomProcessShortcutEventArgs args) {
            base.OnCustomProcessShortcut(args);
            new ViewShortCutProccesor(this).Proccess(args);

        }
コード例 #15
0
 void ApplicationOnCustomProcessShortcut(object sender, CustomProcessShortcutEventArgs args)
 {
     new ViewShortCutProccesor(Application).Proccess(args);
 }
コード例 #16
0
 protected override void OnCustomProcessShortcut(CustomProcessShortcutEventArgs args)
 {
     base.OnCustomProcessShortcut(args);
     new ViewShortCutProccesor(this).Proccess(args);
 }
コード例 #17
0
ファイル: Module.cs プロジェクト: JosueOliveira/AspNet_CIC
        //Cria Views Do Projeto
        private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
        {
            if (e.Shortcut.ViewId == "ConsultaProjeto_DetailView")
            {
                IObjectSpace    objectspace = Application.CreateObjectSpace();
                ConsultaProjeto x           = objectspace.CreateObject <ConsultaProjeto>();
                DetailView      createView  = Application.CreateDetailView(objectspace, x, true);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "CriarProjeto_DetailView")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                Projeto      x           = objectspace.CreateObject <Projeto>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "CriarProjeto_DetailView", true, x);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "ConsultarTarefa_ListView")
            {
                IObjectSpace    objectspace = Application.CreateObjectSpace();
                ConsultarTarefa x           = objectspace.CreateObject <ConsultarTarefa>();
                DetailView      createView  = Application.CreateDetailView(objectspace, x, true);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "CriarTarefa_DetailView")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                Tarefa       x           = objectspace.CreateObject <Tarefa>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "CriarTarefa_DetailView", true, x);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "SubTarefa_DetailView")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                Tarefa       x           = objectspace.CreateObject <Tarefa>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "SubTarefaVinculada_DetailView", true, x);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }
            if (e.Shortcut.ViewId == "VersionarProjeto_DetailView")
            {
                IObjectSpace     objectspace = Application.CreateObjectSpace();
                VersionarProjeto x           = objectspace.CreateObject <VersionarProjeto>();
                DetailView       createView  = Application.CreateDetailView(objectspace, x, true);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }
            if (e.Shortcut.ViewId == "SubTarefa_DetailView_Criar")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                SubTarefa    tela        = objectspace.CreateObject <SubTarefa>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "SubTarefa_DetailView_Criar", true, tela);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }
        }
コード例 #18
0
ファイル: XpandSystemModule.cs プロジェクト: aries544/eXpand
 void ApplicationOnCustomProcessShortcut(object sender, CustomProcessShortcutEventArgs args) {
     new ViewShortCutProccesor(Application).Proccess(args);
 }