public ComponentPresentationInfo(Page page, ComponentPresentation componentPresentation, Region owner) { ComponentPresentation = componentPresentation; InnerRegion = GetInnerRegion(page, componentPresentation.ComponentTemplate); RegionIndex = Region.ExtractRegionIndex(componentPresentation.ComponentTemplate.Id); Owner = owner; }
public static void PrintWebControl(Control ctrl, string Script) { StringWriter stringWrite = new StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); if (ctrl is WebControl) { Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w; } Page pg = new Page(); pg.EnableEventValidation = false; if (Script != string.Empty) { pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script); } HtmlForm frm = new HtmlForm(); pg.Controls.Add(frm); frm.Attributes.Add("runat", "server"); frm.Controls.Add(ctrl); pg.DesignerInitialize(); pg.RenderControl(htmlWrite); string strHTML = stringWrite.ToString(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(strHTML); HttpContext.Current.Response.Write("<script>window.print();</script>"); HttpContext.Current.Response.End(); }
public Page makePage(AreaTree areaTree) { Page p = new Page(areaTree, this.height, this.width); if (this.body != null) { p.addBody(body.makeBodyAreaContainer()); } if (this.before != null) { p.addBefore(before.makeAreaContainer()); } if (this.after != null) { p.addAfter(after.makeAreaContainer()); } if (this.start != null) { p.addStart(start.makeAreaContainer()); } if (this.end != null) { p.addEnd(end.makeAreaContainer()); } return p; }
public Page<CaptainInfo> GetInfoList(string creator ,string subject, int pageNum) { ICriteria criteria = this.ICaptainInfoManage.NativeHibernateSession.CreateCriteria(typeof(CaptainInfo)); Page<CaptainInfo> InfoPage = new Page<CaptainInfo> { CurrentPageIndex = pageNum }; try { if ( creator.Trim() != "") { criteria.Add(Restrictions.Like("Creator", "%" + creator + "%")); } if (subject.Trim() != "") { criteria.Add(Restrictions.Like("Subject", "%" + subject + "%")); } criteria.AddOrder(new Order("CreateTime", false)); InfoPage.TotalCount = criteria.SetResultTransformer(CriteriaUtil.DistinctRootEntity).List<CaptainInfo>().Count; InfoPage.Data = criteria.SetResultTransformer(CriteriaUtil.DistinctRootEntity).SetFirstResult((InfoPage.CurrentPageIndex - 1) * InfoPage.PageSize).SetMaxResults(InfoPage.PageSize).List<CaptainInfo>(); } catch (Exception) { InfoPage = null; } return InfoPage; }
public override void Initialize() { base.Initialize(); new AssetCollector(this); GetService<AssetCollector>().LoadXML(@"Content/AsteroidsGame/assets.xml"); //Change bgcolor to black EntityGame.BackgroundColor = Color.Black; EntityGame.DebugInfo.Color = Color.White; _player = new PlayerShip(this, "PlayerShip"); //SpawnAsteroids(5); //TEST ASTEROIDS var a = new Asteroid(this, "Asteroid1"); a.Body.Position = new Vector2(300, 100); a.Physics.AddForce(-a.Physics.Force); var b = new Asteroid(this, "Asteroid2"); b.Body.Position = new Vector2(100, 100); b.Physics.AddForce(-b.Physics.Force); b.Physics.AddForce(30, 0); Page p = new Page(this, "Page"); p.Show(); _statusLabel = new Label(p, "StatusLabel", new Point(0, 0)); _statusLabel.Color = Color.White; _statusLabel.Visible = false; }
public NavigationHelper(Page page) { this.Page = page; this.Page.Loaded += (sender, e) => { #if WINDOWS_PHONE_APP HardwareButtons.BackPressed += HardwareButtons_BackPressed; #else if (this.Page.ActualHeight == Window.Current.Bounds.Height && this.Page.ActualWidth == Window.Current.Bounds.Width) { Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += Dispatcher_AcceleratorKeyActivated; Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed; } #endif }; this.Page.Unloaded += (sender, e) => { #if WINDOWS_PHONE_APP Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed; #else Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -= Dispatcher_AcceleratorKeyActivated; #endif }; }
public void OnHide(Page page) { var sb = FindResource("OnHide") as Storyboard; if (page != null) sb.Completed += (sender, args) => page.Visibility = Visibility.Collapsed; sb.Begin(); }
public Page<ActivityInvo> GetActivityList(ActivitySerachCondition searchCondition, int pageNum) { this.Session["ActivitySerachCondition"] = searchCondition; ActivityBLL ybll = new ActivityBLL(); Page<ActivityInvo> page = new Page<ActivityInvo>(); return ybll.GetActivityList(searchCondition, pageNum); }
public Difference(string value, Page parent) { SelectedValue = ""; _value = value; _parent = parent; _ignoreSelectedCommand = new RelayCommand(param => AddIgnoreSelected(), emnu => SelectedValue != "" ); }
public void ShouldCopyPages() { var children = new List<Page> { new Page() }; var parent = new Page { Pages = children }; var result = parent.Clone() as Page; Assert.IsNotEmpty( result.Pages ); }
public static void Close(Page page, object result) { page.Response.Clear(); page.Response.ContentType = "text/html"; page.Response.Buffer = true; StringBuilder sb = new StringBuilder(); sb.Append("<html>"); sb.Append("<head>"); sb.Append("<script type='text/javascript'>"); sb.Append("if (parent && parent.DayPilot && parent.DayPilot.ModalStatic) {"); sb.Append("parent.DayPilot.ModalStatic.result(" + DayPilot.Web.Ui.Json.SimpleJsonSerializer.Serialize(result) + ");"); sb.Append("if (parent.DayPilot.ModalStatic.hide) parent.DayPilot.ModalStatic.hide();"); sb.Append("}"); sb.Append("</script>"); sb.Append("</head>"); sb.Append("</html>"); string output = sb.ToString(); byte[] s = Encoding.UTF8.GetBytes(output); page.Response.AddHeader("Content-Length", s.Length.ToString()); page.Response.Write(output); page.Response.Flush(); page.Response.Close(); }
/// <summary> /// Constructor of the Grid Field Definition /// </summary> /// <param name="frm">The main form</param> /// <param name="page">The current page</param> public GridFieldDefinition(MainForm frm, Page page) : base(frm) { InitializeComponent(); this.mode = FormMode.Create; this.page = page; }
public static void AddPage(TabControl tabControl, string tapName, Page page, bool maxSize = true) { if (maxSize) { page.Width = double.NaN; page.Height = double.NaN; page.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; page.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; } Frame frame = new Frame(); if (maxSize) { frame.Width = double.NaN; frame.Height = double.NaN; frame.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; frame.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; } frame.Content = page; TabItem tabItem = new TabItem(); tabItem.Header = tapName; tabItem.Content = frame; tabControl.Items.Add(tabItem); }
/// <summary> /// Gets the metadata link tag. /// </summary> /// <param name="metadata">The metadata.</param> /// <param name="metadataListPage">Metadata filtered list page, can be null.</param> /// <returns></returns> public static string GetMetadataLinkTag(Metadata metadata, Page metadataListPage) { string tag = string.Empty; if (metadata == null) return string.Empty; if (metadataListPage == null) { metadataListPage = Litium.Plus.Utilities.PageUtilities.GetFirstPublishedPageTypeInstance("MetadataFilteredList", CurrentState.Current.WebSiteID, Litium.Foundation.GUI.FoundationContext.Current.Token); } string metadataTranslation = metadata.Translations.GetMetadataTranslation(CurrentState.Current.WebSite.Culture).Translation; if (string.IsNullOrEmpty(metadataTranslation)) return string.Empty; if (metadataListPage == null) { tag = "<span class=\"metadataSpanTag\">" + metadataTranslation + "</span>"; } else { string linkTag = string.Format("<a href=\"{0}?MetadataID={1}\">{2}</a>", metadataListPage.GetUrlToPage(), metadata.ID, metadata.Translations.GetMetadataTranslation(CurrentState.Current.WebSite.Culture).Translation); tag = "<span class=\"metadataSpanTag\">" + linkTag + "</span>"; } return tag; }
public Page GetPage(int PageId) { Page page = new Page(); DbCommand command = DbProviderHelper.CreateCommand("SELECTPage",CommandType.StoredProcedure); command.Parameters.Add(DbProviderHelper.CreateParameter("@PageId",DbType.Int32,PageId)); DbDataReader dataReader = DbProviderHelper.ExecuteReader(command); while (dataReader.Read()) { page.PageId = Convert.ToInt32(dataReader["PageId"]); page.PageGuid = (Guid) dataReader["PageGuid"]; if(dataReader["MetaKeywords"] != DBNull.Value) page.MetaKeywords = Convert.ToString(dataReader["MetaKeywords"]); if(dataReader["MetaDesc"] != DBNull.Value) page.MetaDesc = Convert.ToString(dataReader["MetaDesc"]); page.Title = Convert.ToString(dataReader["Title"]); if(dataReader["ContentHtml"] != DBNull.Value) page.ContentHtml = Convert.ToString(dataReader["ContentHtml"]); page.TemplatePath = Convert.ToString(dataReader["TemplatePath"]); page.ReleasePath = Convert.ToString(dataReader["ReleasePath"]); page.Hits = Convert.ToInt32(dataReader["Hits"]); if(dataReader["DateCreated"] != DBNull.Value) page.DateCreated = Convert.ToDateTime(dataReader["DateCreated"]); } dataReader.Close(); return page; }
public void Initialize(Page page) { _page = page; NavigationPage.SetHasNavigationBar(_page, true); NavigationPage.SetBackButtonTitle(_page, "Go Back Sucka"); NavigationPage.SetHasBackButton(_page, true); }
public void Handle(ThreadEntity CurrentThreadEntity, Page.Page CurrentPageClass) { _threadEntity = CurrentThreadEntity; _threadEntity.ControlIndex += 1; Xy.WebSetting.WebSettingItem _tempWebConfig = null; if (_webConfig != null) { _tempWebConfig = _threadEntity.WebSetting; _threadEntity.WebSetting = _webConfig; } InitSourceHtml(); //if (_enableScript) { // ControlCollection cc = new Control.ControlAnalyze(ref _innerHtml, _threadEntity).ControlCollection; // cc.Handle(ref _innerHtml, ref _threadEntity); //} if (_enableScript) { ControlCollection cc; if (_threadEntity.WebSetting.DebugMode) { cc = new Control.ControlAnalyze(_innerHtml, _threadEntity).ControlCollection; } else { cc = _cacheItem._controlCollection; } cc.Handle(_innerHtml, _threadEntity, CurrentPageClass); } if (_webConfig != null) { _threadEntity.WebSetting = _tempWebConfig; } _threadEntity.ControlIndex -= 1; }
/// <summary> /// 輸出為Excel /// </summary> /// <param name="webpage">傳入目前網頁Page變數</param> /// <param name="Dt">需要匯出的內容</param> /// <param name="FilePath">輸出的檔名</param> public void OutputExcel(Page webpage, DataTable Dt, string FilePath ) { GridView gvExport = new GridView(); gvExport.DataSource = Dt; gvExport.DataBind(); string UTF8FileName = HttpUtility.UrlEncode(FilePath, System.Text.Encoding.UTF8 ); webpage.Response.Clear(); webpage.Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", UTF8FileName) ); webpage.Response.Cache.SetCacheability(HttpCacheability.NoCache); webpage.Response.ContentType = "application/vnd.ms-excel"; webpage.Response.Charset = "big5"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); gvExport.RenderControl(htmlWrite); webpage.Response.Write(stringWrite.ToString().Replace("<div>", "").Replace("</div>", "")); webpage.Response.End(); }
public static string sConnStr = @"Server=localhost;Database=sol_tbcrm;User ID=sa;Password=aw3s0me;"; //(Local Anthonie) #endregion Fields #region Methods public static SqlCommand getDataCommand(string sSQL, SqlConnection conn, Page pPage) { try { if (conn == null) { try { conn = new SqlConnection(sConnStr); conn.Open(); } catch (SqlException ex) { pPage.Response.Write("<script> alert('Error connecting to the server: " + ex.Message + "');</script>"); } } else if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmdSQL = new SqlCommand(sSQL, conn); return cmdSQL; } catch { return null; } }
public SideBar(Game game) { sideButton = new Button(true, ">>", 0, 0, 32, Editor.Graphics.PreferredBackBufferHeight); hitBox = new Rectangle(0, 0, WIDTH, Editor.Graphics.PreferredBackBufferHeight); PageIndex = 0; pages = new Page[3]; // File page pages[0] = new Page(); pages[0].Add(new Button(true, "New", 21, 64)); pages[0].Add(new Button(true, "Save", 71, 64)); pages[0].Add(new Button(true, "Load", 132, 64)); pages[0].Add(new Button(true, "Draw static\n polygon", 37, 128)); pages[0].Add(new Button(true, "Done", 74, 185)); // Tiles page pages[1] = new Page(); string[] files = Directory.GetFiles("Content\\tiles"); foreach (string f in files) Console.WriteLine(f); List<string> tiles = new List<string>(); for (int i = 0; i < files.Length; i++) tiles.Add(files[i].Replace(".xnb", "").Split('\\')[files[i].Split('\\').Length - 1]); for (int i = 0; i < tiles.Count; i++) pages[1].Add(new Button(tiles[i], 24 + (i % 2) * 86, 48 + 90 * (int)(i / 2), 72, 72)); // Objects page pages[2] = new Page(); }
public Page<AdminInfo> GetAdminList(string adminName,string adminType,List<int> regionList,int pageNum ) { AdminBLL adminBLL = new AdminBLL(); Page<AdminInfo> adminPageInfo = new Page<AdminInfo>(); adminPageInfo = adminBLL.GetAdminInfoList(adminName, adminType, regionList, pageNum); return adminPageInfo; }
protected Page AddToCycleRetry(Request request, Site site) { Page page = new Page(request); object cycleTriedTimesObject = request.GetExtra(Request.CycleTriedTimes); if (cycleTriedTimesObject == null) { // 把自己加到目标Request中(无法控制主线程再加载此Request), 传到主线程后会把TargetRequest加到Pool中 request.Priority = 0; page.AddTargetRequest(request.PutExtra(Request.CycleTriedTimes, 1)); } else { long cycleTriedTimes = (long)cycleTriedTimesObject; cycleTriedTimes++; if (cycleTriedTimes >= site.CycleRetryTimes) { // 超过最大尝试次数, 返回空. return null; } request.Priority = 0; page.AddTargetRequest(request.PutExtra(Request.CycleTriedTimes, cycleTriedTimes)); } page.SetNeedCycleRetry(true); return page; }
public void GoToPage(PageType pageType) { RXDebug.Log("Here i am changing the page"); if(_currentPageType == pageType) return; Page pageToCreate = null; if(pageType == PageType.MenuPage) { pageToCreate = new MenuPage(); } if(pageType == PageType.InGamePage) { pageToCreate = new InGamePage(); } if(pageToCreate != null) { _currentPageType = pageType; if(_currentPage != null) { _stage.RemoveChild(_currentPage); } _currentPage = pageToCreate; _stage.AddChild(_currentPage); _currentPage.Start(); } }
/// <summary> /// Changes the page layout. /// </summary> /// <param name="page">The page.</param> /// <param name="fromLayoutTemplate">From layout template.</param> /// <param name="toLayoutTemplate">To layout template.</param> public static void ChangePageLayout(Page page, PageLayoutTemplate fromLayoutTemplate, PageLayoutTemplate toLayoutTemplate) { if (fromLayoutTemplate == null || toLayoutTemplate == null) return; page.PageLayout.LayoutTemplate = toLayoutTemplate; if (fromLayoutTemplate.ColumnsNumber > toLayoutTemplate.ColumnsNumber) { page.Widgets.Update( wd => { wd.OrderNumber = wd.ColumnNumber > toLayoutTemplate.ColumnsNumber ? page.Widgets.Where(w => w.ColumnNumber == toLayoutTemplate.ColumnsNumber).Count () + 1 : wd.OrderNumber; wd.ColumnNumber = wd.ColumnNumber > toLayoutTemplate.ColumnsNumber ? toLayoutTemplate.ColumnsNumber : wd.ColumnNumber; } ); } var pageService = ServiceLocator.Current.GetInstance<IPageService>(); pageService.Save(page); }
public Page() { //Point _Page = this; InitializeComponent(); Loaded += new RoutedEventHandler(Page_Loaded); }
/// <summary> /// Gets the page by ID. /// </summary> /// <param name="pageId">The page ID.</param> /// <returns></returns> public static Page GetPageByID(int pageId) { return CacheHelper.CacheObject<Page>(delegate { Page pageItem = new Page(pageId); return !pageItem.IsNew ? pageItem : null; }, MakePageItemKey(pageId), CacheLength.GetDefaultCacheTime, CacheItemPriority.BelowNormal); }
public static XmlDocument GetDemoXmlDocument(Page page) { //if(BasePage.demoXmlDocument == null) { BasePage.demoXmlDocument = new XmlDocument(); BasePage.demoXmlDocument.Load(page.MapPath("~/App_Data/Demos.xml")); //} return BasePage.demoXmlDocument; }
public Page<CaptainInfo> GetInfoList(string creator, string subject, int pageNum) { InfoManageBLL adminBLL = new InfoManageBLL(); Page<CaptainInfo> InfoPage = new Page<CaptainInfo>(); InfoPage = adminBLL.GetInfoList(creator, subject, pageNum); return InfoPage; }
void Awake() { frontPage = Instantiate(pagePrefab); frontPage.transform.SetParent(frontSpace, false); backPage = Instantiate(pagePrefab); backPage.transform.SetParent(backSpace, false); }
public void Alert(string message, Page page) { ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + message + "');", true); }
public static IObservable<EventPattern<DataTransferEventArgs>> SourceUpdatedObserver(this Page This) { return Observable.FromEventPattern<EventHandler<DataTransferEventArgs>, DataTransferEventArgs>(h => This.SourceUpdated += h, h => This.SourceUpdated -= h); }
public static IObservable<EventPattern<StylusButtonEventArgs>> StylusButtonUpObserver(this Page This) { return Observable.FromEventPattern<StylusButtonEventHandler, StylusButtonEventArgs>(h => This.StylusButtonUp += h, h => This.StylusButtonUp -= h); }
public static IObservable<EventPattern<StylusEventArgs>> LostStylusCaptureObserver(this Page This) { return Observable.FromEventPattern<StylusEventHandler, StylusEventArgs>(h => This.LostStylusCapture += h, h => This.LostStylusCapture -= h); }
public static IObservable<EventPattern<StylusSystemGestureEventArgs>> StylusSystemGestureObserver(this Page This) { return Observable.FromEventPattern<StylusSystemGestureEventHandler, StylusSystemGestureEventArgs>(h => This.StylusSystemGesture += h, h => This.StylusSystemGesture -= h); }
public static IObservable<EventPattern<DependencyPropertyChangedEventArgs>> DataContextChangedObserver(this Page This) { return Observable.FromEventPattern<DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(h => This.DataContextChanged += h, h => This.DataContextChanged -= h); }
public static IObservable<EventPattern<StylusEventArgs>> StylusOutOfRangeObserver(this Page This) { return Observable.FromEventPattern<StylusEventHandler, StylusEventArgs>(h => This.StylusOutOfRange += h, h => This.StylusOutOfRange -= h); }
public static IObservable<EventPattern<StylusEventArgs>> PreviewStylusInAirMoveObserver(this Page This) { return Observable.FromEventPattern<StylusEventHandler, StylusEventArgs>(h => This.PreviewStylusInAirMove += h, h => This.PreviewStylusInAirMove -= h); }
public static IObservable<EventPattern<MouseEventArgs>> GotMouseCaptureObserver(this Page This) { return Observable.FromEventPattern<MouseEventHandler, MouseEventArgs>(h => This.GotMouseCapture += h, h => This.GotMouseCapture -= h); }
public static IObservable<EventPattern<MouseWheelEventArgs>> PreviewMouseWheelObserver(this Page This) { return Observable.FromEventPattern<MouseWheelEventHandler, MouseWheelEventArgs>(h => This.PreviewMouseWheel += h, h => This.PreviewMouseWheel -= h); }
public static IObservable<EventPattern<QueryCursorEventArgs>> QueryCursorObserver(this Page This) { return Observable.FromEventPattern<QueryCursorEventHandler, QueryCursorEventArgs>(h => This.QueryCursor += h, h => This.QueryCursor -= h); }
/// <summary> /// 调用前台的JS方法 /// </summary> /// <param name="key">脚本块的唯一标识符</param> /// <param name="scriptStr">JS脚本</param> public static void RegisterClientScriptBlock(Page p, string key, string scriptStr) { p.ClientScript.RegisterClientScriptBlock(p.GetType(), key, "<script language='javascript'>" + scriptStr + "</script>"); }
public static IObservable<EventPattern<MouseEventArgs>> MouseLeaveObserver(this Page This) { return Observable.FromEventPattern<MouseEventHandler, MouseEventArgs>(h => This.MouseLeave += h, h => This.MouseLeave -= h); }
/// <summary> /// 注册页面客户端启动脚本 /// </summary> /// <param name="p">页面对象</param> /// <param name="t">类型</param> /// <param name="sKey">keys</param> /// <param name="sScripts">脚本代码,不需要包含<script>部分</param> public static void RegisterStartupScript(Page p, Type t, string sKey, string sScripts) { //sScripts = HttpUtility.HtmlEncode(sScripts); p.ClientScript.RegisterStartupScript(t, t.Name, sScripts, true); }
public static IObservable<EventPattern<MouseButtonEventArgs>> MouseRightButtonUpObserver(this Page This) { return Observable.FromEventPattern<MouseButtonEventHandler, MouseButtonEventArgs>(h => This.MouseRightButtonUp += h, h => This.MouseRightButtonUp -= h); }
/// <summary> /// 弹出页面消息 /// </summary> /// <param name="p">页面对象</param> /// <param name="sMsg">消息文本</param> public static void ShowAlertMsg(Page p, string sMsg) { ShowAlertMsg(p, p.GetType(), sMsg); }
/// <summary> /// 注册页面客户端启动脚本 /// </summary> /// <param name="p">页面对象</param> /// <param name="t">类型</param> /// <param name="sScripts">脚本代码,不需要包含<script>部分</param> public static void RegisterStartupScript(Page p, Type t, string sScripts) { RegisterStartupScript(p, t, Guid.NewGuid().ToString(), sScripts); }
/// <summary> /// 弹出页面消息 /// </summary> /// <param name="p">页面对象</param> /// <param name="t">类型</param> /// <param name="sMsg">消息文本</param> public static void ShowAlertMsg(Page p, Type t, string sMsg, Exception ex) { p.ClientScript.RegisterStartupScript(t, t.Name, string.Format("<script>alert('{0}');</script>", sMsg)); }
/// <summary> /// 弹出页面消息 /// </summary> /// <param name="p">页面对象</param> /// <param name="sMsg">消息文本</param> public static void ShowAlertMsg(Page p, string sMsg, Exception ex) { ShowAlertMsg(p, p.GetType(), sMsg, ex); }
protected void gvResultados_SelectedIndexChanged(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('DocumentoImagen.aspx?url=" + gvResultados.Rows[gvResultados.SelectedIndex].Cells[2].Text + "','_blank')", true); }
/// <summary> /// 弹出页面消息 /// </summary> /// <param name="p">页面对象</param> /// <param name="t">类型</param> /// <param name="sMsg">消息文本</param> public static void ShowAlertMsg(Page p, Type t, string sMsg) { ShowAlertMsg(p, t, sMsg, null); }
private void log(String msg, Page data) { String dataInfo = "{Id:" + data.Id + ", Title:'" + data.Title + "'}"; logService.Add((User)ctx.viewer.obj, msg, dataInfo, typeof(Page).FullName, ctx.Ip); }
private static void PSRE_SpeechRecognized(Object sender, SpeechRecognizedEventArgs e) { string txt = e.Result.Text; float confidence = e.Result.Confidence; Current current = Current.Instance; Page p = current.Page; if (confidence > 0.40) { AssistantServiceResponses(txt); if (p is WelcomeScreen) { AssistantRentCarResponse(txt); } if (p is Summary) { AssistantSummaryResponse(txt); } if (p is CarChoose) { AssistantChooseCarResponse(txt); } if (p is RentDates) { AssistantRentDatesResponse(txt); } if (p is PersonalData) { AssistantPersonalDataResponse(txt); } if (p is Finish) { AssistantFinishResponse(txt); AssistantAgainResponse(txt); } } else { if (p is WelcomeScreen) { ((WelcomeScreen)p).Message.Content = "Proszę powtórzyć"; ((WelcomeScreen)p).Message.Visibility = Visibility.Visible; } if (p is CarChoose) { ((CarChoose)p).Message.Content = "Proszę powtórzyć"; ((CarChoose)p).Message.Visibility = Visibility.Visible; } if (p is RentDates) { ((RentDates)p).Message.Content = "Proszę powtórzyć"; ((RentDates)p).Message.Visibility = Visibility.Visible; } if (p is PersonalData) { ((PersonalData)p).Message.Content = "Proszę powtórzyć"; ((PersonalData)p).Message.Visibility = Visibility.Visible; } if (p is Summary) { ((Summary)p).Message.Content = "Proszę powtórzyć"; ((Summary)p).Message.Visibility = Visibility.Visible; } if (p is Finish) { ((Finish)p).Message.Content = "Proszę powtórzyć"; ((Finish)p).Message.Visibility = Visibility.Visible; } } }
//信息表单填充 private void InfoFormFill(long KindID, long ParentID = 0) { txtInfoFormTitle.Text = KindID == 0 ? "新品类" : KindID.ToString(); hidInfoFormKindID.Value = KindID.ToString(); hidInfoFormParentID.Value = ParentID.ToString(); txtInfoFormParent.Text = ParentID == 0 ? "根类" : ParentID.ToString(); inpInfoFormOrderBy.Text = 99.ToString(); hidInfoFormLogoFileID.Value = 0.ToString(); divInfoFormLogo.Attributes["style"] = "background-image: url(/media/logos/kind_template.png)"; inpInfoFormKindName.Text = null; inpInfoFormKindTitle.Text = null; if (KindID > 0) { var kindInfo = Ziri.BLL.ITEM.Kind.GetModifyInfo(KindID, out AlertMessage alertMessage); if (alertMessage != null) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "InfoFormMessage" , string.Format("<script> swal('{0}', '', '{1}'); </script>", alertMessage.Message, alertMessage.Type)); return; } if (kindInfo == null) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "InfoFormMessage" , string.Format("<script> swal('{0}', '', '{1}'); </script>", "品类编号[" + KindID + "]不存在", AlertType.error)); return; } txtInfoFormTitle.Text = kindInfo.Title; hidInfoFormParentID.Value = kindInfo.ParentID.ToString(); inpInfoFormOrderBy.Text = kindInfo.OrderBy.ToString(); inpInfoFormKindName.Text = kindInfo.Name; inpInfoFormKindTitle.Text = kindInfo.Title; if (kindInfo.LogoFileID > 0) { hidInfoFormLogoFileID.Value = kindInfo.LogoFileID.ToString(); var fileInfo = Ziri.BLL.SYS.DOC.GetFileUploadInfo(kindInfo.LogoFileID); if (fileInfo.FileInfo != null) { divInfoFormLogo.Attributes["style"] = string.Format("background-image: url(/DOC/upload/{0}{1})", fileInfo.FileInfo.GUID, fileInfo.FileExtName.Name); } } ParentID = kindInfo.ParentID; } if (ParentID > 0) { var parentInfo = Ziri.BLL.ITEM.Kind.GetModifyInfo(ParentID, out AlertMessage alertMessage); if (alertMessage != null) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "InfoFormMessage" , string.Format("<script> swal('{0}', '', '{1}'); </script>", alertMessage.Message, alertMessage.Type)); return; } if (parentInfo == null) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "InfoFormMessage" , string.Format("<script> swal('{0}', '', '{1}'); </script>", "父类编号[" + ParentID + "]不存在", AlertType.error)); return; } txtInfoFormParent.Text = parentInfo.Title; } Page.ClientScript.RegisterStartupScript(Page.GetType(), "InfoFormActive", "<script> document.getElementById('btnListInfoFormModal').click(); </script>"); }
protected void Page_Load(object sender, EventArgs e) { SetupPermissiblePaths(); Page.DataBind(); }
private void Message(string Msg) { string Javascrip = "alert('" + Msg + "');"; ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "msg", Javascrip, true); }
public override Page Download(Request request, ISpider spider) { if (spider.Site == null) { return null; } Site site = spider.Site; var acceptStatCodes = site.AcceptStatCode; //Logger.InfoFormat("Downloading page {0}", request.Url); HttpResponseMessage response = null; var proxy = site.GetHttpProxyFromPool(); request.PutExtra(Request.Proxy, proxy); int statusCode = 200; try { if (GeneratePostBody != null) { SingleExecutor.Execute(() => { GeneratePostBody(spider.Site, request); }); } var httpMessage = GenerateHttpRequestMessage(request, site); response = RedialManagerUtils.Execute("downloader-download", (m) => { var message = (HttpRequestMessage)m; return httpClient.SendAsync(message).Result; }, httpMessage); AddRequestCount(); response.EnsureSuccessStatusCode(); if (!site.AcceptStatCode.Contains(response.StatusCode)) { throw new DownloadException($"下载 {request.Url} 失败. Code: {response.StatusCode}"); } statusCode = (int)response.StatusCode; request.PutExtra(Request.StatusCode, statusCode); Page page = HandleResponse(request, response, statusCode, site); // need update page.TargetUrl = request.Url.ToString(); //page.SetRawText(File.ReadAllText(@"C:\Users\Lewis\Desktop\taobao.html")); // 这里只要是遇上登录的, 则在拨号成功之后, 全部抛异常在Spider中加入Scheduler调度 // 因此如果使用多线程遇上多个Warning Custom Validate Failed不需要紧张, 可以考虑用自定义Exception分开 ValidatePage(page, spider); // 结束后要置空, 这个值存到Redis会导致无限循环跑单个任务 request.PutExtra(Request.CycleTriedTimes, null); //#if !NET_CORE // httpWebRequest.ServicePoint.ConnectionLimit = int.MaxValue; //#endif return page; //正常结果在上面已经Return了, 到此处必然是下载失败的值. //throw new SpiderExceptoin("Download failed."); } catch (RedialException) { throw; } catch (Exception e) { Page page = new Page(request, site.ContentType) { Exception = e }; ValidatePage(page, spider); throw; } finally { // 先Close Response, 避免前面语句异常导致没有关闭. try { //ensure the connection is released back to pool //check: //EntityUtils.consume(httpResponse.getEntity()); response?.Dispose(); } catch (Exception e) { var logger = LogUtils.GetLogger(spider); logger.Warn("Close response fail.", e); } } }
private void Open_Main() { Page Main = new MainPage(); CurrentPage = Main; }
public MyNavigationPage(Page page) { On <Android>().SetBarHeight(100); PushAsync(page); }
private void Open_InfoUser() { CurrentPage = UserInfo; }
private void Open_Stat() { Statictic = new StatisticsPage(); CurrentPage = Statictic; }