public void RegisterDrillDownAction(object owner, string name, string caption, string operation)
        {
            Guard.ArgumentNotNullOrEmptyString(name, "name");
            Guard.ArgumentNotNullOrEmptyString(caption, "caption");
            Guard.ArgumentNotNull(owner, "owner");

            ShellAction action = new ShellAction(WorkItem)
            {
                Id = name, Caption = caption, Operation = operation, IsAuthorized = true, IsEnabled = true
            };

            if (string.IsNullOrEmpty(operation))
            {
                authorizedDrillDownActions.Add(action);
            }
            else
            {
                action.IsEnabled    = false;
                action.IsAuthorized = false;
                unauthorizedDrillDownActions.Add(action);
            }

            if (!drillDownActionsDictionary.ContainsKey(owner))
            {
                drillDownActionsDictionary[owner] = new List <ShellAction>();
            }

            drillDownActionsDictionary[owner].Add(action);
        }
 public void NavigateToAttendanceMenu()
 {
     ShellAction.OpenTaskMenu();
     TaskMenuActions.OpenMenuSection("section_menu_Attendance");
     Wait.WaitForDocumentReady();
     Wait.WaitLoading();
 }
Beispiel #3
0
        /// <summary>
        /// OnShellEvent is called when a Module wants a
        /// Shell event fired.  It dispatches the message
        /// to the appropriate method.
        /// </summary>
        /// <param name="action"></param>
        private void OnShellEvent(ShellAction action)
        {
            //Dispatch the message
            switch (action)
            {
            case ShellAction.About:
                this.OnAbout();
                break;

            case ShellAction.ConfigureHardware:
                this.OnConfigureHardware();
                break;

            case ShellAction.New:
                this.OnNew();
                break;

            case ShellAction.Open:
                this.OnOpen();
                break;

            case ShellAction.SaveAs:
                this.OnSaveAs();
                break;
            }
        }
Beispiel #4
0
        IResult WebLookupAction(string title, string urlTemplate, string query, int priorityBoost = 0)
        {
            var lastUsed = DateTime.MinValue;

            // try to parse query
            var p = Regex.Split(query, @"\s+");

            var priority = Priority.Low;

            if (p.Length >= 2 && title.StartsWith(p[0], StringComparison.InvariantCultureIgnoreCase))
            {
                priority = Priority.High;
                query    = String.Join(" ", p.Skip(1));
            }

            var a = new ShellAction(
                iconProvider,
                String.Format(urlTemplate, System.Web.HttpUtility.UrlEncode(query)),
                String.Format("{0} \"{1}\"", title, query))
            {
                LastExecuted = lastUsed
            };

            priority = Boost(priority, priorityBoost);

            return(a.ToResult(priority));
        }
        public override void Load()
        {
            base.Load();

            ShellAction refreshAction = new ShellAction(this._rootWorkItem);

            refreshAction.Caption      = StringResources.Dashboard_Refresh;
            refreshAction.IsEnabled    = true;
            refreshAction.IsAuthorized = true;
            refreshAction.Id           = "action://Imi.SupplyChain.UX.Shell/DashboardRefresh";

            ActionCatalogService.RegisterActionImplementation(refreshAction.Id, OnDashboardRefresh);

            ShellInteractionService.Actions.Add(refreshAction);

            ShellAction arrangeAction = new ShellAction(this._rootWorkItem);

            arrangeAction.Caption      = StringResources.Dashboard_Arrange;
            arrangeAction.IsEnabled    = true;
            arrangeAction.IsAuthorized = true;
            arrangeAction.Id           = "action://Imi.SupplyChain.UX.Shell/DashboardArrange";

            ActionCatalogService.RegisterActionImplementation(arrangeAction.Id, OnDashboardArrange);

            ShellInteractionService.Actions.Add(arrangeAction);

            ControlledWorkItem <ShellController> shellWorkItem = _rootWorkItem.WorkItems.FindByType <ControlledWorkItem <ShellController> >().Last();

            _dashboardView = shellWorkItem.SmartParts.FindByType <IDashboardView>().Last();
        }
 public static void NavigateToAttendancePattern()
 {
     Wait.WaitForDocumentReady();
     ShellAction.OpenTaskMenu();
     TaskMenuActions.OpenMenuSection("section_menu_Attendance");
     SubMenuActions.ClickMenuItem("task_menu_section_attendance_AttendancePattern-");
     Wait.WaitLoading();
 }
 public static void NavigateToApplyMarkOverDateRange()
 {
     Wait.WaitForDocumentReady();
     ShellAction.OpenTaskMenu();
     TaskMenuActions.OpenMenuSection("section_menu_Attendance");
     SubMenuActions.ClickMenuItem("task_menu_section_attendance_EnterMarkOverDateRange-");
     Wait.WaitLoading();
 }
 public static AttendancePatternPage NavigateToAttendancePatternFromQuickSearch()
 {
     SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
     ShellAction.OpenTaskMenu();
     SeleniumHelper.Get(AttendanceElements.TaskMenuSearch).SendKeys("Attendance Pattern");
     SeleniumHelper.ClickByJS(SeleniumHelper.Get(AttendanceElements.TaskMenuSearchOption));
     Wait.WaitLoading();
     return(new AttendancePatternPage());
 }
 private static void CopyValues(ShellAction source, ShellDrillDownMenuItem target)
 {
     target.Caption      = source.Caption;
     target.Id           = source.Id;
     target.IsAuthorized = source.IsAuthorized;
     target.IsEnabled    = source.IsEnabled;
     target.WorkItem     = source.WorkItem;
     target.Operation    = source.Operation;
     target.Parameters   = source.Parameters;
 }
 public static AttendancePatternPage NavigateToAttendancePatternFromTaskMenu()
 {
     SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
     Wait.WaitForDocumentReady();
     ShellAction.OpenTaskMenu();
     TaskMenuActions.OpenMenuSection("section_menu_Attendance");
     SubMenuActions.ClickMenuItem("task_menu_section_attendance_AttendancePattern-");
     Wait.WaitLoading();
     return(new AttendancePatternPage());
 }
        private void ActionPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            ShellAction action = sender as ShellAction;

            if (_actionDictionary.ContainsKey(action))
            {
                ShellDrillDownMenuItem actionMenuItem = _actionDictionary[action];
                CopyValues(action, actionMenuItem);
            }
        }
Beispiel #12
0
 public void OnShellResultReceived(Client client, ShellAction action, string data)
 {
     if (action == ShellAction.Push)
     {
         UiMediator.ShowShellOutput(client, data);
     }
     else if (action == ShellAction.Stop)
     {
         UiMediator.StopShell(client);
     }
 }
Beispiel #13
0
        /// <summary>
        /// OnExitEvent is called when the ExitEvent fires.
        /// </summary>
        /// <param name="action">The Action to be taken on this event</param>
        private void OnExitEvent(ShellAction action)
        {
            //If the Action isn't to Exit, just return
            if (action != ShellAction.Exit)
            {
                return;
            }

            //Fire the event
            if (this.ExitExecuted != null)
            {
                this.ExitExecuted(null, null);
            }
        }
Beispiel #14
0
        // Called when action list is to be updated on screen
        public void ShowActions(string actionString)
        {
            //System.Diagnostics.Debug.WriteLine("Entering ShowActions on Dialog " + View.Id + ",    " + actionString);

            ICollection <ShellAction> serviceActions = ShellInteractionService.Actions;

            // remove old Action data
            ICollection <ShellAction> tempActions = new List <ShellAction>();;

            foreach (ShellAction shellAction in serviceActions)
            {
                tempActions.Add(shellAction);
            }

            foreach (ShellAction shellAction in tempActions)
            {
                ActionCatalog.RemoveActionImplementation(shellAction.Id);
                serviceActions.Remove(shellAction);
            }
            actions.Clear();
            if (actionString.Length == 0)
            {
                return;
            }

            // decode actionString and add new Actions
            char[]      delimiter    = { ';' };
            string[]    actionsArray = actionString.Split(delimiter);
            ShellAction action;

            for (int i = 0; i < actionsArray.Length - 1; i = i + 2)
            {
                action              = new ShellAction(workItem);
                action.Id           = (string)actionsArray.GetValue(i) + Separator + View.Id; // make sure Id is unique!
                action.Caption      = (string)actionsArray.GetValue(i + 1);
                action.IsAuthorized = true;
                action.IsEnabled    = true;
                action.Parameters   = action.Id;
                actions.Add(action);

                ActionCatalog.RegisterActionImplementation(action.Id, OnAction);
                serviceActions.Add(action);
                //System.Diagnostics.Debug.WriteLine("action " + action.Caption + " was added");
            }
        }
Beispiel #15
0
        public void OnShellRequested(ShellAction shellAction, string command)
        {
            try
            {
                ShellActiveLock.AcquireReaderLock(15 * 1000);

                if (shellAction == ShellAction.Start && !ShellActive)
                {
                    try
                    {
                        ShellActiveLock.UpgradeToWriterLock(15 * 1000);
                        ShellActive = true;
                    }
                    catch (ApplicationException)
                    {
                    }
                    finally
                    {
                        ShellActiveLock.ReleaseWriterLock();
                    }

                    StartShell();
                }
                else if (shellAction == ShellAction.Push && ShellActive)
                {
                    PipeToProcess(command);
                }
                else if (shellAction == ShellAction.Stop && ShellActive)
                {
                    ShellActiveLock.ReleaseReaderLock();
                    StopShell();
                }
            }
            catch (ApplicationException)
            {
            }
            finally
            {
                // if shellAction == Stop, then we released the lock already
                if (ShellActiveLock.IsReaderLockHeld)
                {
                    ShellActiveLock.ReleaseReaderLock();
                }
            }
        }
Beispiel #16
0
        public static TemplateSearchScreen NavigateToTemplateMenuPage(bool loginFlag = true)
        {
            if (loginFlag)
            {
                SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.TestUser);  // Will be changed to SchoolAdmin when permissions gets implemented
                ShellAction.OpenTaskMenu();
                TaskMenuActions.OpenMenuSection("section_menu_Communications");
                TaskMenuActions.ClickMenuItem("task_menu_section_communications_ManageMessageTemplates");
            }
            else
            {
                ShellAction.OpenTaskMenu();
                TaskMenuActions.ClickMenuItem("task_menu_section_communications_ManageMessageTemplates");
            }

            WaitUntilDisplayed(TemplateElements.SearchPanel.SearchButton);
            return(new TemplateSearchScreen());
        }
 public static MessageSettingScreen navigateToMessageSettingPage(SeleniumHelper.iSIMSUserType user = SeleniumHelper.iSIMSUserType.SystemManger)
 {
     SeleniumHelper.Login(user);
     POM.Helper.Wait.WaitLoading();
     ShellAction.OpenTaskMenu();
     POM.Helper.SeleniumHelper.Sleep(1);
     TaskMenuActions.OpenMenuSection("section_menu_Communications");
     POM.Helper.SeleniumHelper.Sleep(1);
     TaskMenuActions.ClickMenuItem("task_menu_section_communication_Manage_Message_Settings");
     POM.Helper.Wait.WaitLoading();
     if (new MessageSettingScreen().isPageDisplayed())
     {
         return(new MessageSettingScreen());
     }
     else
     {
         throw new NoSuchElementException("Message Setting screen not displayed.");
     }
 }
 public static AgentSearchScreen NavigateToAgentMenuPage(bool loginFlag = true)
 {
     if (loginFlag)
     {
         SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
         POM.Helper.Wait.WaitLoading();
         ShellAction.OpenTaskMenu();
         TaskMenuActions.OpenMenuSection("section_menu_Communications");
         TaskMenuActions.ClickMenuItem("task_menu_section_communication_Agents");
         WaitUntilDisplayed(AgentElements.SearchPanel.SearchButton);
     }
     else
     {
         ShellAction.OpenTaskMenu();
         POM.Helper.Wait.WaitLoading();
         TaskMenuActions.ClickMenuItem("task_menu_section_communication_Agents");
         WaitUntilDisplayed(AgentElements.SearchPanel.SearchButton);
     }
     return(new AgentSearchScreen());
 }
        private void CheckAuthorization(object state)
        {
            //IList<ShellAction> actions = state as IList<ShellAction>;

            //var ops = (from a in actions
            //select new AuthOperation() { Operation = a.Operation, Action = a } as IAuthOperation).ToArray();

            IAuthOperation[] ops = ((List <AuthOperation>)state).ToArray();

            try
            {
                AuthorizationService.CheckAuthorization(applicationName, ops);

                currentContext.Send(delegate(object data)
                {
                    foreach (AuthOperation operation in ops)
                    {
                        ShellAction action = operation.Action;

                        if (operation.isDrillDown)
                        {
                            authorizedDrillDownActions.Add(action);
                        }
                        else
                        {
                            authorizedActions.Add(action);
                        }

                        action.IsAuthorized = operation.IsAuthorized;
                        action.IsEnabled    = ActionCatalogService.CanExecute(action.Id, action.WorkItem, this, action);
                    }
                }, null);
            }
            catch (Exception ex)
            {
                currentContext.Send(delegate(object data)
                {
                    throw ex;
                }, null);
            }
        }
Beispiel #20
0
        public void DefineModulesInCodeDesktopLoadModuleCOnDemand()
        {
            ShellAction <WpfAppLauncher> .LoadModuleCOnDemand();

            ShellAssertion <WpfAppLauncher> .AssertOnDemandDefineModulesInCodeCLoading();
        }
        public void DirectoryLookupModuleDesktopLoadModuleCOnDemand()
        {
            ShellAction <WpfAppLauncher> .LoadModuleCOnDemand();

            ShellAssertion <WpfAppLauncher> .AssertOnDemandDirectoryLookupModuleCLoading();
        }
        public void DefineModulesInCodeSilverlightLoadModuleCOnDemand()
        {
            ShellAction <SilverlightAppLauncher> .LoadModuleCOnDemand();

            ShellAssertion <SilverlightAppLauncher> .AssertOnDemandDefineModulesInCodeCLoading();
        }
        //Method to login with specific user and navigate to agent add screen
        public static bool NavigateToAgentMenuPage(SeleniumHelper.iSIMSUserType userType)
        {
            //Accept the userType.
            //Switch case based on userType. To return different asserts

            SeleniumHelper.Login(userType);
            POM.Helper.Wait.WaitLoading();
            ShellAction.OpenTaskMenu();
            TaskMenuActions.OpenMenuSection("section_menu_Communications");

            switch (userType)
            {
            case SeleniumHelper.iSIMSUserType.AdmissionsOfficer:
                try
                {
                    //Can not view or add new agents.  [View -- In communications task menu entry]
                    //Returns true if agent gets listed in communication menu. Else false.
                    IWebElement AgentEntry = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    return(true);
                }
                catch (NoSuchElementException e)
                {
                    return(false);
                }

            case SeleniumHelper.iSIMSUserType.ClassTeacher:
                try
                {
                    //Can view and add new agents. Find the add new agent option in taskbar
                    //Returns true if agent option gets listed in communication menu with Add new agent option on agent screen.
                    BaseSeleniumComponents.WaitUntilDisplayed(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    IWebElement AgentEntry = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    AgentEntry.Click();

                    //Check for add new agent button
                    BaseSeleniumComponents.WaitUntilDisplayed(AgentElements.MainScreen.AddNewAgentButton);
                    WebContext.WebDriver.FindElement(AgentElements.MainScreen.AddNewAgentButton);
                    return(true);
                }
                catch (NoSuchElementException e)
                {
                    return(false);
                }

            case SeleniumHelper.iSIMSUserType.CurricularManager:
                try
                {
                    //Can not view or add new agents.  [View -- In communications task menu entry]
                    //Returns true if agent gets listed in communication menu. Else false.
                    IWebElement AgentEntry = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    return(true);
                }
                catch (NoSuchElementException e)
                {
                    return(false);
                }


            case SeleniumHelper.iSIMSUserType.SchoolAdministrator:
                try
                {
                    //Can view and add new agents. Find the add new agent option in taskbar
                    //Returns true if agent option gets listed in communication menu with Add new agent option on agent screen. Else false
                    BaseSeleniumComponents.WaitUntilDisplayed(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    IWebElement AgentEntry = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));

                    AgentEntry.Click();

                    BaseSeleniumComponents.WaitUntilDisplayed(AgentElements.MainScreen.AddNewAgentButton);
                    //Check for add new agent button
                    WebContext.WebDriver.FindElement(AgentElements.MainScreen.AddNewAgentButton);
                    return(true);
                }
                catch (NoSuchElementException e)
                {
                    return(false);
                }

            case SeleniumHelper.iSIMSUserType.SENCoordinator:
                try
                {
                    //Can view and add new agents. Find the add new agent option in taskbar
                    //Returns true if agent option gets listed in communication menu with Add new agent option on agent screen.Else false
                    BaseSeleniumComponents.WaitUntilDisplayed(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    IWebElement AgentEntry = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                    AgentEntry.Click();

                    BaseSeleniumComponents.WaitUntilDisplayed(AgentElements.MainScreen.AddNewAgentButton);
                    //Check for add new agent button
                    WebContext.WebDriver.FindElement(AgentElements.MainScreen.AddNewAgentButton);
                    return(true);
                }
                catch (NoSuchElementException e)
                {
                    return(false);
                }

            case SeleniumHelper.iSIMSUserType.SeniorManagementTeam:
                //Can view and add new agents. Find the add new agent option in taskbar
                //Returns true if agent option gets listed in communication menu with Add new agent option on agent screen.Else false
                BaseSeleniumComponents.WaitUntilDisplayed(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents")));
                WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("task_menu_section_communication_Agents"))).Click();
                try
                {
                    //Check for add new agent button
                    WebContext.WebDriver.FindElement(AgentElements.MainScreen.AddNewAgentButton);
                    return(true);
                }
                catch (NoSuchElementException e)
                {
                    return(false);
                }

            default: return(false);
            }//switch case
        }
        public void RemoteModuleSilverlightLoadModuleXOnDemand()
        {
            ShellAction <SilverlightAppLauncher> .LoadModuleXOnDemand();

            ShellAssertion <SilverlightAppLauncher> .AssertOnDemandRemoteModuleXLoading();
        }
Beispiel #25
0
        public void ConfigurationModuleDesktopLoadModuleCOnDemand()
        {
            ShellAction <WpfAppLauncher> .LoadModuleCOnDemand();

            ShellAssertion <WpfAppLauncher> .AssertOnDemandConfigurationModuleCLoading();
        }