private void StartMenuItemExecutedEventHandler(object sender, StartMenuItemExecutedEventArgs e)
        {
            ShellDrillDownMenuItem item = e.MenuItem;

            if ((item != null) && (!item.IsFolder))
            {
                IInputElement element = FocusManager.GetFocusedElement(Application.Current.MainWindow);
                Application.Current.MainWindow.Focus();

                if (element != null)
                {
                    element.Focus();
                }

                Presenter.ExecuteMenuItem(e);

                SetNavigationBarMinimized(_minimizeAfterSelect);
            }
        }
Esempio n. 2
0
        public void SaveInDashboard(string searchStr)
        {
            char[]   delimiter   = { ';' };
            string[] strArray    = searchStr.Split(delimiter);
            string   programName = strArray[0];
            string   parameters  = strArray[1];

            ShellDrillDownMenuItem dItem = new ShellDrillDownMenuItem();

            dItem.IsEnabled    = true;
            dItem.IsAuthorized = true;
            dItem.Operation    = programName;
            dItem.Id           = programName;
            dItem.EventTopic   = Imi.SupplyChain.UX.Modules.OrderManagement.Views.Constants.EventTopicNames.StartOMSProgramWithData;
            dItem.Parameters   = parameters;
            dItem.AssemblyFile = ASSEMBLY_FILE;

            StartMenuItemExecutedEventArgs eventArgs = new StartMenuItemExecutedEventArgs(dItem, null, StartOption.Dashboard);

            eventArgs.Module = ShellModuleService.ActiveModule;

            EventHandler <StartMenuItemExecutedEventArgs> temp = MenuItemExecuted;

            // When adding dialogs to the Dashboard we need to be sure that the Dashboard module activation is finished.
            // To be abel to know this we temporarly listen to the ModuleActivated event and then activate the module.
            // When the activation thread is done we get the event and can then fire the MenuItemExecuted event.
            // This procedure is a must when we add a dialog without first activating the Dashboard in the GUI.

            EventHandler <DataEventArgs <IShellModule> > moduleActivatedHandler = null;

            moduleActivatedHandler = (s, e1) =>
            {
                if (e1.Data.Id == DashboardModule.ModuleId && temp != null)
                {
                    temp(this, eventArgs);
                    temp = null;
                    ShellModuleService.ModuleActivated -= moduleActivatedHandler;
                }
            };

            ShellModuleService.ModuleActivated += moduleActivatedHandler;
            ShellModuleService.ActiveModule     = ShellModuleService.Modules.Where((m) => { return(m.Id == DashboardModule.ModuleId); }).FirstOrDefault();
        }
Esempio n. 3
0
        public void ExecuteMenuItem(StartMenuItemExecutedEventArgs e)
        {
            EventHandler <StartMenuItemExecutedEventArgs> temp = MenuItemExecuted;

            e.Module = _shellModuleService.ActiveModule;

            if (e.StartOption == StartOption.Dashboard)
            {
                //When adding dialogs to the Dashboard we need to be sure that the Dashboard module activation as finished.
                //To be abel to know this we temporarly listen to the ModuleActivated event and then activate the module.
                //When the activation thread is done we get the event and can then fire the MenuItemExecuted event.
                //This procedure is a must when we add a dialog without first activating the Dashboard in the GUI.
                EventHandler <DataEventArgs <IShellModule> > moduleActivatedHandler = null;

                moduleActivatedHandler = (s, e1) =>
                {
                    if (e1.Data.Id == DashboardModule.ModuleId && temp != null)
                    {
                        temp(this, e);
                        temp = null;
                        _shellModuleService.ModuleActivated -= moduleActivatedHandler;
                    }
                };

                _shellModuleService.ModuleActivated += moduleActivatedHandler;

                _shellModuleService.ActiveModule = _shellModuleService.Modules.Where((m) => { return(m.Id == DashboardModule.ModuleId); }).FirstOrDefault();
            }
            else
            {
                if (temp != null)
                {
                    temp(this, e);
                }
            }
        }