public override void CacheAttached(PXCache sender)
        {
            base.CacheAttached(sender);
            if (sender.Graph.PrimaryItemType == null)
            {
                return;
            }

            PXButtonDelegate delgate = delegate(PXAdapter adapter)
            {
                PXCache cache = adapter.View.Graph.Caches[typeof(SOOrderShipment)];
                if (cache.Current != null)
                {
                    var    helper = new EntityHelper(cache.Graph);
                    object val    = cache.GetValueExt(cache.Current, _FieldName);
                    var    state  = val as PXRefNoteBaseAttribute.PXLinkState;
                    if (state != null)
                    {
                        helper.NavigateToRow(state.target.FullName, state.keys, PXRedirectHelper.WindowMode.NewWindow);
                    }
                    else
                    {
                        helper.NavigateToRow((Guid?)cache.GetValue(cache.Current, _FieldName), PXRedirectHelper.WindowMode.NewWindow);
                    }
                }

                return(adapter.Get());
            };

            string actionName = $"{ sender.GetItemType().Name }~{ _FieldName }~Link";

            PXNamedAction.AddHiddenAction(sender.Graph, sender.Graph.PrimaryItemType, actionName, delgate);
        }
Ejemplo n.º 2
0
        private PXAction AddAction(string actionName, string displayName, PXButtonDelegate handler)
        {
            var action = PXNamedAction <EDoc> .AddAction(Base, actionName, displayName, handler);

            SurveyFolder.AddMenuAction(action);
            return(action);
        }
        public override void Initialize()
        {
            base.Initialize();

            if (Base.GetType() != typeof(PXGraph) && Base.PrimaryItemType != null)
            {
                PXAction runAction         = PXNamedAction.AddAction(Base, Base.PrimaryItemType, nameof(ConsoleRunAction), "Run", new PXButtonDelegate(ConsoleRunAction));
                PXAction clearOutputAction = PXNamedAction.AddAction(Base, Base.PrimaryItemType, nameof(ConsoleClearOutputAction), "ConsoleClearOutput", new PXButtonDelegate(ConsoleClearOutputAction));
                ConsoleView.Cache.SetValueExt <ConsoleFields.graphType>(ConsoleView.Current, PX.Api.CustomizedTypeManager.GetTypeNotCustomized(Base).FullName); //For code completion on Graph.
            }
        }
        public override void Initialize()
        {
            base.Initialize();

            if (!string.IsNullOrEmpty(Base.PrimaryView))
            {
                Type     primaryViewType = Base.Views[Base.PrimaryView].Cache.GetItemType();
                PXAction updateInsight   = PXNamedAction.AddAction(Base, primaryViewType,
                                                                   "Update Insight", "Update Insight", UpdateInsight);
                updateInsight.SetEnabled(false);
                updateInsight.SetVisible(false);
            }
        }
Ejemplo n.º 5
0
        public override void Initialize()
        {
            if (!String.IsNullOrEmpty(Base.PrimaryView))
            {
                //Add a "Test" button in the toolbar
                Type     primaryViewItemType = Base.Views[Base.PrimaryView].Cache.GetItemType();
                PXAction action = PXNamedAction.AddAction(Base, primaryViewItemType, "GlobalTest", "Global Button", TestClick);

                //Liste to FieldUpdating event for NoteText on primary view; we could also do it on every view that has a Note field.
                PXCache primaryViewCache = Base.Caches[primaryViewItemType];
                if (primaryViewCache.Fields.Contains("NoteText"))
                {
                    Base.FieldUpdating.AddHandler(Base.PrimaryView, "NoteText", NoteFieldUpdating);
                }
            }
        }
        protected PXAction AddAction(PXGraph graph, string name, string displayName, PXButtonDelegate handler)
        {
            PXUIFieldAttribute uiAtt = new PXUIFieldAttribute
            {
                DisplayName     = PXMessages.LocalizeNoPrefix(displayName),
                MapEnableRights = PXCacheRights.Select
            };

            List <PXEventSubscriberAttribute> addAttrs = new List <PXEventSubscriberAttribute> {
                uiAtt
            };
            PXNamedAction <Primary> res = new PXNamedAction <Primary>(graph, name, handler, addAttrs.ToArray());

            graph.Actions[name] = res;
            return(res);
        }