public void DoLaunchMainPage() { var page = new HostPage { Language = ApplicationLanguages.Languages[0] }; page.ContentFrame.NavigationFailed += OnNavigationFailed; if (ApplicationExecutionState.Terminated == PreviousExecutionState) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = page; if (null == page.ContentFrame.Content) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!page.ContentFrame.Navigate(typeof(MainPage), LaunchArguments)) { throw new Exception(); } } }
/// <summary> /// Register handlers /// </summary> public static void Register() { RegisterPartials(); Handle.GET("/playgroundkeeper/playgroundhost/{?}", (string id) => { // TODO: Security MasterPage master = Program.GetMainPage(); Db.Scope(() => { PlaygroundHost playgroundHost = Db.SQL<PlaygroundHost>("SELECT p FROM PlaygroundKeeper.PlaygroundHost p WHERE p.ObjectID = ?", id).First; HostPage page = new HostPage() { Data = playgroundHost }; master.Partial = page; }); return master; }); Handle.GET("/playgroundkeeper/playgroundhost/{?}/defaultapps", (string id) => { // TODO: Security MasterPage master = Program.GetMainPage(); Db.Scope(() => { PlaygroundHost playgroundHost = Db.SQL<PlaygroundHost>("SELECT p FROM PlaygroundKeeper.PlaygroundHost p WHERE p.ObjectID = ?", id).First; DefaultAppsPage page = new DefaultAppsPage() { Data = playgroundHost }; master.Partial = page; }); return master; }); }
/// <summary> /// Enables Print Manager for Mozilla browsers /// </summary> /// <param name="CurrentPage">Current page reference</param> public static void EnablePrintManager(object CurrentPage) { System.Web.UI.Page HostPage; HostPage = (System.Web.UI.Page)CurrentPage; string strHTML = "<script type=\"text/javascript\"><!--\n if(FusionCharts && FusionCharts.printManager) FusionCharts.printManager.enabled(true);\n// --></script>"; HostPage.ClientScript.RegisterClientScriptBlock(HostPage.GetType(), "", strHTML); }
public void NumberOfLinksOnHostPageCEPackage() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Number of Links on Host Page'"); HostBasePage hostPage = new HostPage(_driver); hostPage.OpenUsingUrl(_baseUrl); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of links on Host page: " + HostPage.NumberOfLinks); Assert.That(hostPage.FindElements(By.XPath(HostBasePage.FeaturesList)).Count, Is.EqualTo(HostPage.NumberOfLinks), "The number of links on Host page is not correct"); VerifyStandardPageLayout(hostPage); }
public void Update(HostPage page) { if (page == null) { return; } try { HostPage findePage = _dbContext.HostPages.Find(page.Id); if (findePage != null) { _dbContext.Entry(page).State = EntityState.Modified; } } catch (Exception ex) { throw ex; } }
private void DoNavigateToOutsidePage(string pageClassName, string openMethod) { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Navigation To " + pageClassName + "'"); Type pageClassType = Type.GetType("DotNetNuke.Tests.DNNSelenium." + pageClassName); if (pageClassType != null) { var navToPage = Activator.CreateInstance(pageClassType, new object[] { _driver }); HostPage hostPage = new HostPage(_driver); Type myType = hostPage.GetType(); var miOpen = myType.GetMethod(openMethod); if (miOpen != null) { miOpen.Invoke(hostPage, new object[] { _baseUrl }); } else { Trace.WriteLine(BasePage.RunningTestKeyWord + "ERROR: cannot call " + openMethod + "for class " + pageClassName); } var fiWindowTitle = pageClassType.GetField("WindowTitle"); var windowTitle = (string)fiWindowTitle.GetValue(null); var fiOutsideUrl = pageClassType.GetField("OutsideUrl"); var outsideUrl = (string)fiOutsideUrl.GetValue(null); var basePage = (BaseOutsidePage)navToPage; Utilities.SoftAssert( () => Assert.That(basePage.CurrentWindowTitle(), Is.EqualTo(windowTitle), "Current window Title is not correct.")); Assert.That(basePage.CurrentWindowUrl(), Is.EqualTo(outsideUrl), "Current window URL is not correct."); } else { Trace.WriteLine(BasePage.RunningTestKeyWord + "ERROR: cannot create class " + pageClassName); } }
private async Task <IEnumerable <PageInfoModel> > AddHostGetPagesInfo (IEnumerable <SiteInfoModel> siteInfos) { var resultInfoPage = new List <PageInfoModel>(siteInfos.Count()); var host = new Host { NameOfHost = Helper.GetHost(siteInfos.First().Url) }; foreach (SiteInfoModel page in siteInfos) { var pageInHost = new HostPage { Url = page.Url, MinResponse = page.ResponseTime, MaxResponse = page.ResponseTime }; resultInfoPage.Add(new PageInfoModel { Url = page.Url, MinResponse = page.ResponseTime, MaxResponse = page.ResponseTime, ResponseTime = page.ResponseTime }); pageInHost.HostHistories.Add(new HostHistory { Date = page.Date, ResponseTime = page.ResponseTime }); host.HostPages.Add(pageInHost); } _repository.Add(host); await _repository.SaveChanges(); return(resultInfoPage); }
/// <summary> /// Вызывается при обычном запуске приложения пользователем. Будут использоваться другие точки входа, /// например, если приложение запускается для открытия конкретного файла. /// </summary> /// <param name="e">Сведения о запросе и обработке запуска.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { var hostPage = Window.Current.Content as HostPage; // Не повторяйте инициализацию приложения, если в окне уже имеется содержимое, // только обеспечьте активность окна if (null == hostPage) { // Создание фрейма, который станет контекстом навигации, и переход к первой странице hostPage = new HostPage(); //hostPage.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Загрузить состояние из ранее приостановленного приложения } // Размещение фрейма в текущем окне Window.Current.Content = hostPage; } if (e.PrelaunchActivated == false) { var navigator = hostPage.GetNavigator(); if (null != navigator) { // Если стек навигации не восстанавливается для перехода к первой странице, // настройка новой страницы путем передачи необходимой информации в качестве параметра // параметр navigator.Navigate(typeof(MainPage), e.Arguments); } // Обеспечение активности текущего окна Window.Current.Activate(); } }
private async Task <IEnumerable <PageInfoModel> > UpdateHistoryGetPagesInfo (IEnumerable <SiteInfoModel> siteInfos) { var resultInfoPage = new List <PageInfoModel>(siteInfos.Count()); string hostUrl = Helper.GetHost(siteInfos.First().Url); Host host = await _repository.GetHostIncludePages(hostUrl); foreach (SiteInfoModel page in siteInfos) { HostPage pageUpdate = host.HostPages.FirstOrDefault(x => x.Url == page.Url); if (pageUpdate != null) { if (pageUpdate.MinResponse > page.ResponseTime) { pageUpdate.MinResponse = page.ResponseTime; } if (pageUpdate.MaxResponse < page.ResponseTime) { pageUpdate.MaxResponse = page.ResponseTime; } pageUpdate.HostHistories.Add(new HostHistory { Date = page.Date, ResponseTime = page.ResponseTime }); resultInfoPage.Add(new PageInfoModel { Url = page.Url, MinResponse = pageUpdate.MinResponse, MaxResponse = pageUpdate.MaxResponse, ResponseTime = page.ResponseTime }); _repository.Update(pageUpdate); } else { var pageNew = new HostPage { Url = page.Url, MinResponse = page.ResponseTime, MaxResponse = page.ResponseTime }; pageNew.HostHistories.Add(new HostHistory { Date = page.Date, ResponseTime = page.ResponseTime }); resultInfoPage.Add(new PageInfoModel { Url = page.Url, MinResponse = page.ResponseTime, MaxResponse = page.ResponseTime, ResponseTime = page.ResponseTime }); host.HostPages.Add(pageNew); _repository.Update(host); } } await _repository.SaveChanges(); return(resultInfoPage); }