public void ShowPage(HelpPage page) { SelectPage(page); Show(); BringToFront(); SetFocusToTab(); }
private static void WriteHelpPage(this StringBuilder sb, HelpPage page, int maxWidth) { sb.WriteUsage(page.ApplicationName, page.SyntaxElements, maxWidth); if (!page.Rows.Any()) return; sb.AppendLine(); sb.WriteRows(page.Rows, maxWidth); sb.AppendLine(); }
private static void AddProfilerControls(HelpPage developerPage) { developerPage.RightColumn.Add(new ControlWithDescription("Alt + Num0", "Enable/Disable render profiler or leave current child node.")); developerPage.RightColumn.Add(new ControlWithDescription("Alt + Num1-Num9", "Enter child node in render profiler")); developerPage.RightColumn.Add(new ControlWithDescription("Alt + Enter", "Pause/Unpause profiler")); }
private HelpPage CreatePage(string title) { HelpPage page = new HelpPage { pageTitle = new GameText(title) }; page.pageTitle.TextColor = Color.Yellow; page.pageTitle.Shadow = false; page.pageTitle.Y = 16f; page.pageTitle.CenterText(0, 320); page.pageComponents = new List<HelpPageComponent>(); return page; }
/// <summary> /// Select a page to view /// </summary> /// <param name="page"></param> public void SelectPage(HelpPage page) { // Select the tab for the user tabView.SelectedIndex = (int) page; }
public MyGuiScreenHelpSpace() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(1f, 0.98f)) { EnabledBackgroundFade = true; m_pages = new HelpPage[typeof(HelpPageEnum).GetEnumValues().Length]; m_pageTitles = new String[m_pages.Length]; m_pages[(int)HelpPageEnum.Basic] = new HelpPage(); m_pages[(int)HelpPageEnum.Advanced] = new HelpPage(); m_pages[(int)HelpPageEnum.Advanced2] = new HelpPage(); m_pages[(int)HelpPageEnum.Spectator] = new HelpPage(); m_pages[(int)HelpPageEnum.Developer] = new HelpPage(); m_pages[(int)HelpPageEnum.Developer2] = new HelpPage(); m_pageTitles[(int)HelpPageEnum.Basic] = MyTexts.GetString(MySpaceTexts.BasicControls); m_pageTitles[(int)HelpPageEnum.Advanced] = MyTexts.GetString(MySpaceTexts.AdvancedControls); m_pageTitles[(int)HelpPageEnum.Advanced2] = MyTexts.GetString(MySpaceTexts.AdvancedControls); m_pageTitles[(int)HelpPageEnum.Spectator] = MyTexts.GetString(MySpaceTexts.SpectatorControls); m_pageTitles[(int)HelpPageEnum.Developer] = "Developer Controls"; m_pageTitles[(int)HelpPageEnum.Developer2] = "Developer Controls"; HelpPage basicPage = m_pages[(int)HelpPageEnum.Basic]; HelpPage advancedPage = m_pages[(int)HelpPageEnum.Advanced]; HelpPage advancedPage2 = m_pages[(int)HelpPageEnum.Advanced2]; HelpPage spectatorPage = m_pages[(int)HelpPageEnum.Spectator]; HelpPage developerPage = m_pages[(int)HelpPageEnum.Developer]; HelpPage developer2Page = m_pages[(int)HelpPageEnum.Developer2]; basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.BUILD_SCREEN)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.FORWARD)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.BACKWARD)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.STRAFE_LEFT)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.STRAFE_RIGHT)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.ROLL_LEFT)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.ROLL_RIGHT)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.JUMP)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CROUCH)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SWITCH_WALK)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CAMERA_MODE)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.DAMPING)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.THRUSTS)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.BROADCASTING)); basicPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.HELMET)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.PRIMARY_TOOL_ACTION)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT1)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT2)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT3)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT4)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT5)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT6)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT7)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT8)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT9)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SLOT0)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.TOOLBAR_UP)); basicPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.TOOLBAR_DOWN)); basicPage.RightColumn.Add(new ControlWithDescription("Shift + " + MyInput.Static.GetGameControl(MyControlsSpace.SLOT1).ToString(), "Select toolbar page 1")); basicPage.RightColumn.Add(new ControlWithDescription("Shift + " + MyInput.Static.GetGameControl(MyControlsSpace.SLOT2).ToString(), "Select toolbar page 2")); basicPage.RightColumn.Add(new ControlWithDescription("Shift + " + MyInput.Static.GetGameControl(MyControlsSpace.SLOT3).ToString(), "Select toolbar page 3")); basicPage.RightColumn.Add(new ControlWithDescription("Shift + " + MyInput.Static.GetGameControl(MyControlsSpace.SLOT4).ToString(), "Select toolbar page 4")); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SPRINT)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.LOOKAROUND)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.LANDING_GEAR)); advancedPage.LeftColumn.Add(new ControlWithDescription("Shift + " + MyInput.Static.GetGameControl(MyControlsSpace.LANDING_GEAR).ToString(), "Pick color from cube into slot")); advancedPage.LeftColumn.Add(new ControlWithDescription(MyTexts.Get(MySpaceTexts.MouseWheel), MyTexts.Get(MySpaceTexts.ControlDescZoom))); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SECONDARY_TOOL_ACTION)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.USE)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.INVENTORY)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.TOGGLE_REACTORS)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.TERMINAL)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.HEADLIGHTS)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SUICIDE)); advancedPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.TOGGLE_HUD)); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + C", "Copy object")); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + Shift + C", "Copy object detached")); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + V", "Paste object")); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + X", "Delete object")); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + B", "Create/manage blueprints")); advancedPage.LeftColumn.Add(new ControlWithDescription("F10", "Open blueprint screen")); advancedPage.LeftColumn.Add(new ControlWithDescription("Shift + F10", "Open spawn screen")); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + " + MyTexts.GetString(MySpaceTexts.MouseWheel), MyTexts.GetString(MySpaceTexts.ControlDescCopyPasteMove))); advancedPage.LeftColumn.Add(new ControlWithDescription("Ctrl + Alt+ E", MyTexts.GetString(MySpaceTexts.ControlDescExportModel))); StringBuilder repaintControlText = null; MyInput.Static.GetGameControl(MyControlsSpace.CUBE_COLOR_CHANGE).AppendBoundButtonNames(ref repaintControlText, unassignedText: MyInput.Static.GetUnassignedName()); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.HELP_SCREEN)); //advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.CHAT_SCREEN)); advancedPage.RightColumn.Add(new ControlWithDescription("F3", MyTexts.GetString(MySpaceTexts.ControlDescPlayersList))); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.CHAT_SCREEN)); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.CONSOLE)); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SCREENSHOT)); //advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SHOW_DAMAGED)); advancedPage.RightColumn.Add(new ControlWithDescription("F5", MyTexts.GetString(MySpaceTexts.ControlDescQuickLoad))); advancedPage.RightColumn.Add(new ControlWithDescription("Shift + F5", MyTexts.GetString(MySpaceTexts.ControlDescQuickSave))); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.PAUSE_GAME)); advancedPage.RightColumn.Add(new ControlWithDescription(MyInput.Static.GetGameControl(MyControlsSpace.LANDING_GEAR).ToStringBuilder(MyInput.Static.GetUnassignedName()), MyTexts.Get(MySpaceTexts.TerminalControlPanel_Cockpit_Handbrake))); advancedPage.RightColumn.Add(new ControlWithDescription(MyInput.Static.GetGameControl(MyControlsSpace.JUMP).ToStringBuilder(MyInput.Static.GetUnassignedName()), MyTexts.Get(MySpaceTexts.ControlDescBrake))); advancedPage.RightColumn.Add(new ControlWithDescription(MyInput.Static.GetGameControl(MyControlsSpace.INVENTORY).ToStringBuilder(MyInput.Static.GetUnassignedName()).Append("/").Append(MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL).ToString()), MyTexts.Get(MySpaceTexts.ControlDescLoot))); advancedPage.RightColumn.Add(new ControlWithDescription("", "")); advancedPage.RightColumn.Add(new ControlWithDescription(new StringBuilder(), MyTexts.Get(MySpaceTexts.Factions), rightFont: MyFontEnum.Red)); advancedPage.RightColumn.Add(new ControlWithDescription(MyTexts.Get(MySpaceTexts.HelpScreen_FactionColor_Blue), MyTexts.Get(MySpaceTexts.Factions_YourBlock), MyFontEnum.Blue)); advancedPage.RightColumn.Add(new ControlWithDescription(MyTexts.Get(MySpaceTexts.HelpScreen_FactionColor_Green), MyTexts.Get(MySpaceTexts.Factions_YourFaction), MyFontEnum.Green)); advancedPage.RightColumn.Add(new ControlWithDescription(MyTexts.Get(MySpaceTexts.HelpScreen_FactionColor_White), MyTexts.Get(MySpaceTexts.Factions_NeutralFaction), MyFontEnum.White)); advancedPage.RightColumn.Add(new ControlWithDescription(MyTexts.Get(MySpaceTexts.HelpScreen_FactionColor_Red), MyTexts.Get(MySpaceTexts.Factions_EnemyFaction))); advancedPage.RightColumn.Add(new ControlWithDescription("", "")); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.ROTATION_LEFT)); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.ROTATION_RIGHT)); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.ROTATION_UP)); advancedPage.RightColumn.Add(new ControlWithDescription(MyControlsSpace.ROTATION_DOWN)); advancedPage2.RightColumn.Add(new ControlWithDescription(repaintControlText, MyTexts.Get(MySpaceTexts.ControlDescSingleAllMode))); advancedPage2.RightColumn.Add(new ControlWithDescription(repaintControlText, MyTexts.Get(MySpaceTexts.ControlDescHoldToColor))); advancedPage2.RightColumn.Add(new ControlWithDescription("Ctrl + " + repaintControlText, MyTexts.GetString(MySpaceTexts.ControlDescMediumBrush))); advancedPage2.RightColumn.Add(new ControlWithDescription("Shift + " + repaintControlText, MyTexts.GetString(MySpaceTexts.ControlDescLargeBrush))); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE)); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE)); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE)); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE)); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE)); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE)); advancedPage2.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.STATION_ROTATION)); advancedPage2.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SWITCH_LEFT)); advancedPage2.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SWITCH_RIGHT)); advancedPage2.RightColumn.Add(new ControlWithDescription(MyTexts.Get(MySpaceTexts.MouseWheel), MyTexts.Get(MySpaceTexts.ControlDescCameraZoom))); advancedPage2.RightColumn.Add(new ControlWithDescription(MyControlsSpace.SYMMETRY_SWITCH)); advancedPage2.RightColumn.Add(new ControlWithDescription(MyControlsSpace.USE_SYMMETRY)); advancedPage2.RightColumn.Add(new ControlWithDescription("", "")); advancedPage2.RightColumn.Add(new ControlWithDescription("Ctrl + H", MyTexts.GetString(MySpaceTexts.ControlDescNetgraph))); advancedPage2.RightColumn.Add(new ControlWithDescription("[", MyTexts.GetString(MySpaceTexts.ControlDescNextVoxelMaterial))); advancedPage2.RightColumn.Add(new ControlWithDescription("]", MyTexts.GetString(MySpaceTexts.ControlDescPreviousVoxelMaterial))); advancedPage2.RightColumn.Add(new ControlWithDescription("H", MyTexts.GetString(MySpaceTexts.ControlDescOpenVoxelHandSettings))); spectatorPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SPECTATOR_NONE)); spectatorPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SPECTATOR_DELTA)); spectatorPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SPECTATOR_FREE)); spectatorPage.LeftColumn.Add(new ControlWithDescription(MyControlsSpace.SPECTATOR_STATIC)); //These keys are to be used just for developers or testing if (MyInput.Static.ENABLE_DEVELOPER_KEYS) { // Developers developerPage.LeftColumn.Add(new ControlWithDescription("Ctrl + NumPad0", "Enable/Disable debug input - global")); developerPage.LeftColumn.Add(new ControlWithDescription("Ctrl + NumPad1", "Enable/Disable debug input - character")); developerPage.LeftColumn.Add(new ControlWithDescription("Ctrl + NumPad2", "Enable/Disable debug input - Ondra")); developerPage.LeftColumn.Add(new ControlWithDescription("Ctrl + NumPad3", "Enable/Disable debug input - Peta")); developerPage.LeftColumn.Add(new ControlWithDescription("Ctrl + NumPad4", "Enable/Disable debug input - Martin")); developerPage.LeftColumn.Add(new ControlWithDescription("F11", "Game statistics")); developerPage.LeftColumn.Add(new ControlWithDescription("Shift + F11", "Frame info (FPS and stuff)")); developerPage.LeftColumn.Add(new ControlWithDescription("F12", "Debug screen")); developerPage.LeftColumn.Add(new ControlWithDescription("", "")); developerPage.LeftColumn.Add(new ControlWithDescription("", "Character Debug Input")); developerPage.LeftColumn.Add(new ControlWithDescription("U", "Add astronaut (current color)")); developerPage.LeftColumn.Add(new ControlWithDescription("NumPad7", "Switch to next ship")); developerPage.LeftColumn.Add(new ControlWithDescription("NumPad8", "Switch to next character")); developerPage.RightColumn.Add(new ControlWithDescription("", "Global Debug Input")); developerPage.RightColumn.Add(new ControlWithDescription("F6", "Switch between astronauts")); developerPage.RightColumn.Add(new ControlWithDescription("F7", "Switch to fixed dir. 3rd person camera")); developerPage.RightColumn.Add(new ControlWithDescription("F8", "Switch to spectator camera")); developerPage.RightColumn.Add(new ControlWithDescription("Ctrl + F8", "Reset spectator camera")); developerPage.RightColumn.Add(new ControlWithDescription("F9", "Switch to static 3rd person")); developerPage.RightColumn.Add(new ControlWithDescription("Ctrl + Space", "Move character to spectator position")); developerPage.RightColumn.Add(new ControlWithDescription("NumPad3", "Apply large force to controlled object.")); developerPage.RightColumn.Add(new ControlWithDescription("NumPad6", "Apply small force to controlled object.")); developerPage.RightColumn.Add(new ControlWithDescription("Ctrl + Shift + Z", "Save prefab")); developer2Page.LeftColumn.Add(new ControlWithDescription("", "Debug Input - Ondra")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + Insert", "Merge all grids.")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + Delete", "Remove all characters.")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + NumDecimal", "Remove all except controlled object.")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + J", "Duplicate current grid.")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + C", "Copy target (of cube builder gizmo)")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + X", "Cut target (of cube builder gizmo)")); developer2Page.LeftColumn.Add(new ControlWithDescription("Ctrl + V", "Paste")); developer2Page.LeftColumn.Add(new ControlWithDescription("", "")); developer2Page.LeftColumn.Add(new ControlWithDescription("", "Debug Input - Peta")); developer2Page.LeftColumn.Add(new ControlWithDescription("Numpad0", "Add weapons, ammo and components to inventory.")); developer2Page.RightColumn.Add(new ControlWithDescription("", "Debug Input - Martin")); developer2Page.RightColumn.Add(new ControlWithDescription("M + Numpad2", "Toggle thrusts on/off.")); developer2Page.RightColumn.Add(new ControlWithDescription("M + Numpad3", "Toggle shooting turrets.")); developer2Page.RightColumn.Add(new ControlWithDescription("M + Numpad4", "Reload definitions.")); developer2Page.RightColumn.Add(new ControlWithDescription("M + Numpad5", "Show screen with all definition icons.")); developer2Page.RightColumn.Add(new ControlWithDescription("M + Numpad6", "Remove all floating objects.")); } AddProfilerControls(developerPage); m_currentPage = HelpPageEnum.Basic; CloseButtonEnabled = true; RecreateControls(true); }
public void ThenUserChecksVisibilityOfInputField() { helpPage = basePage.GetHelpPage(); helpPage.WaitForPageLoadComplete(DEFAULT_TIME); Assert.IsTrue(helpPage.InputHelpFieldVisibility()); }
void Menu_ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { //var itemclicked = new MasterMenuItem(); var item = e.SelectedItem as MasterMenuItem; //item = itemclicked; ContentPage page = null; if (item != null) { switch (item.MenuItemName) { case "Home": page = new HomePage(); break; case "Account": page = new AccountPage(); break; case "Cards": page = new AddCardPage(); break; case "Prepaid": page = new AddCardPage(); break; case "History": page = new HistoryPage(); break; case "Rewards": page = new RewardsPage(); break; case "Scan": scanPage = new ZXingScannerPage(); page = scanPage; scanPage.OnScanResult += async(result) => { scanPage.IsScanning = false; Device.BeginInvokeOnMainThread(() => { Navigation.PopAsync(); DisplayAlert("Scanned Barcode", result.Text, "OK"); }); await Navigation.PushAsync(scanPage); }; //page = new ScanPage(); break; case "Share": page = new SharePage(); break; case "Help": page = new HelpPage(); break; case "About": page = new AboutPage(); break; case "Sign Out": page = new LoginPage(); break; default: page = new LoginPage(); break; } Detail = new NavigationPage(page); masterPage.menu_ListView.SelectedItem = null; IsPresented = false; } }
public void Help() { CommonSection.ClickHelpIcon(); _test.Log(Status.Pass, "help icon opens successfully"); Assert.IsTrue(HelpPage.CheckTitle());//checks the Help page with one click in it }
public void HelpPageVerification() { /// 1.Navigate to the login page login as a AMA staff UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser(role.Username, role.Password); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } /// 2.click to GCEP link navigate to Gcep page and waiting load icon disappear GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 3.Navigate Institutions page choose Institutions get the contact email for it InstitutionsPage IP = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk); IP.Search("Medical College of Wisconsin"); IP.ActionGearBtn.Click(); Thread.Sleep(0500); EditInstitutionPage EIP = IP.ClickToAdvance(IP.EditInstitutionLnk); string InstitutionContactEmailAdress = EIP.InstitutionPrimaryContactEmailTxt.GetAttribute("value"); /// 4.Go to Help Page HelpPage HP = EIP.ClickToAdvance(EIP.HelpfromYourInstitutionLnk); //(EIP.HelpLnk); /// 5.Verifying all Links are there for all roles Assert.IsTrue(HP.ResidentComingSoonLnk.Displayed); Assert.IsTrue(HP.ResidentLaunchResourceLnk.Displayed); Assert.IsTrue(HP.ManagerLaunchResourceLnk.Displayed); Assert.IsTrue(HP.AdminLaunchResourceLnk.Displayed); Assert.IsTrue(HP.AdminWatchVideoLnk.Displayed); Assert.IsTrue(HP.AMAMemberLaunchResourceLnk.Displayed); Assert.IsTrue(HP.AMAResidentLaunchResourceLnk.Displayed); Assert.IsTrue(HP.ContactUsLbl.Displayed); /// 6.Sign out HP.HeaderMenuDropDown.Click(); HP.SignOutLnk.Click(); Thread.Sleep(2000); /// 7.Log in as Manager for Institution we choose above LP = Navigation.GoToLoginPage(Browser); ED = LP.LoginAsUser("10031047", "password"); Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 8.Navigating to a Help Page HP = Gcep.ClickToAdvance(EIP.HelpfromYourInstitutionLnk); //ClickToAdvance(Gcep.HelpLnk); /// 9.Verifying help links for Manager displayed and contact email are there and sign out Assert.IsTrue(HP.ManagerLaunchResourceLnk.Displayed); string InstitutionContactEmailAdressManager = HP.ContactInvolvedInstitutionEmailLnk.Text; Assert.AreEqual(InstitutionContactEmailAdressManager, InstitutionContactEmailAdress); HP.HeaderMenuDropDown.Click(); HP.SignOutLnk.Click(); Thread.Sleep(2000); /// 10.Log in as a Admin navigating to GCEP LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser("10031312", "password"); Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 11.Navigating to Help pag again HP = Gcep.ClickToAdvance(EIP.HelpfromYourInstitutionLnk); //ClickToAdvance(Gcep.HelpLnk); /// 12.Verifying help links for Admin displayed and contact email are there and sign out Assert.IsTrue(HP.AdminLaunchResourceLnk.Displayed); Assert.IsTrue(HP.AdminWatchVideoLnk.Displayed); string InstitutionContactEmailAdressAdmin = HP.ContactInvolvedInstitutionEmailLnk.Text; Assert.AreEqual(InstitutionContactEmailAdressAdmin, InstitutionContactEmailAdress); HP.HeaderMenuDropDown.Click(); HP.SignOutLnk.Click(); Thread.Sleep(2000); /// 13.Log in as a Resident navigating to GCEP LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser("10031201", "password"); Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 14.Navigating to Help page again HP = Gcep.ClickToAdvance(EIP.HelpfromYourInstitutionLnk); //ClickToAdvance(Gcep.HelpLnk); /// 15.Verifying help links for Resident displayed and contact email are there. Assert.IsTrue(HP.ResidentComingSoonLnk.Displayed); Assert.IsTrue(HP.ResidentLaunchResourceLnk.Displayed); string InstitutionContactEmailAdressResident = HP.ContactInvolvedInstitutionEmailLnk.Text; Assert.AreEqual(InstitutionContactEmailAdressResident, InstitutionContactEmailAdress); }
/// <summary> /// Updates help page content. /// </summary> /// <param name="pageId"></param> /// <param name="newTitle"></param> /// <param name="newContent"></param> /// <param name="context"></param> /// <returns></returns> public static async Task <int> UpdateHelpPage(int pageId, EditHelpPageViewModel viewModel, AppDbContext context) { // Perform validation if (viewModel == null) { return(-1); } else if (string.IsNullOrEmpty(viewModel.Title) || viewModel.Title.Count() > IoCContainer.DbSettings.Value.MaxHelpPageTitleSize) { return(-2); } else if (string.IsNullOrEmpty(viewModel.Content) || viewModel.Content.Count() > IoCContainer.DbSettings.Value.MaxHelpPageSize) { return(-3); } HelpPage helpPage = await context.HelpPages.FindAsync(pageId); helpPage.Title = viewModel.Title; helpPage.Content = viewModel.Content; helpPage.IsLocked = viewModel.IsLocked; // Prepare tags string. List <string> newTagsList = StringExtensions.RemoveDuplicateWords(StringExtensions.RemoveSpecials(viewModel.Tags.ToUpper().Trim())).Split(' ').ToList(); // Find additions and deletions. var deleteRange = (from hpht in context.HelpPageHelpTags where hpht.HelpPageID == pageId select hpht); context.HelpPageHelpTags.RemoveRange(deleteRange); List <HelpPageHelpTag> relationsToAdd = new List <HelpPageHelpTag>(); foreach (string tag in newTagsList) { if (tag.Count() > IoCContainer.DbSettings.Value.MaxTagLength) { return(-4); } HelpTag existingTag = (from ht in context.HelpTags where ht.Value.ToUpper() == tag select ht).SingleOrDefault(); if (existingTag != null) { relationsToAdd.Add(new HelpPageHelpTag { HelpPage = helpPage, HelpTag = existingTag, }); } else { HelpTag newTag = new HelpTag { Value = tag }; await context.HelpTags.AddAsync(newTag); relationsToAdd.Add(new HelpPageHelpTag { HelpPage = helpPage, HelpTag = newTag, }); } } // Add new many-to-many await context.HelpPageHelpTags.AddRangeAsync(relationsToAdd); // Commit changes. int updateResult = await context.SaveChangesAsync(); // Simple false return instead throwing database exception // because then it would be necessary to check if title or // context has been changed. Note that content may be very large // and comparing could have huge performance impact. return(updateResult); }