Exemplo n.º 1
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Closes the current web page when it has finished loading in the browser and returns the specified value to
		/// the web page that opened it.
		/// </summary>
		/// <param name="page">The current web page.</param>
		/// <param name="returnValue">The value to be returned to the parent web page that open this web page.</param>
		/// <remarks></remarks>
		public static void Close(System.Web.UI.Page page, string returnValue)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("Close"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "Close", CreateClientSideScript(ClientSideScript.Close));
			}
			
			if (! page.ClientScript.IsStartupScriptRegistered("Close.Page"))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
				with_1.Append("   Close(\'" + returnValue + "\');" + System.Environment.NewLine);
				with_1.Append("</script>" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "Close.Page", with_1.ToString());
			}
			
		}
Exemplo n.º 2
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Shows a modal popup window for the specified web page url when the specified web page has loaded.
		/// </summary>
		/// <param name="page">The web page that will show the popup window when loaded.</param>
		/// <param name="url">The web page url for which the popup windows is to be shown.</param>
		/// <param name="dialogResultHolder">
		/// The web control whose text is to updated with the text returned by the web page displayed in the popup window.
		/// </param>
		/// <param name="height">The height of the popup window.</param>
		/// <param name="width">The width of the popup window.</param>
		/// <param name="left">Location of the popup window on X-axis.</param>
		/// <param name="top">Location of the popup window on Y-axis.</param>
		/// <param name="center">True if the popup window is to be centered; otherwise False.</param>
		/// <param name="help">True if help button is to be displayed; otherwise False.</param>
		/// <param name="resizable">True if the popup window can be resized; otherwise False.</param>
		/// <param name="status">True if the status bar is to be displayed; otherwise False.</param>
		/// <remarks></remarks>
		public static void ShowDialog(System.Web.UI.Page page, string url, System.Web.UI.Control dialogResultHolder, int height, int width, int left, int top, bool center, bool help, bool resizable, bool status)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("ShowDialog"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ShowDialog", CreateClientSideScript(ClientSideScript.ShowDialog));
			}
			
			if (! page.ClientScript.IsStartupScriptRegistered("ShowDialog." + url))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<input type=\"hidden\" name=\"PCS_EVENT_TARGET\" value=\"\" />" + System.Environment.NewLine);
				with_1.Append("<input type=\"hidden\" name=\"PCS_EVENT_ARGUMENT\" value=\"\" />" + System.Environment.NewLine);
				with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
				if (dialogResultHolder != null)
				{
					with_1.Append("   ShowDialog(\'" + url + "\', \'" + dialogResultHolder.ClientID+ "\', " + height + ", " + width + ", " + left + ", " + top + ", " + Math.Abs(System.Convert.ToInt32(center)) + ", " + Math.Abs(System.Convert.ToInt32(help)) + ", " + Math.Abs(System.Convert.ToInt32(resizable)) + ", " + Math.Abs(System.Convert.ToInt32(status)) + ");" + System.Environment.NewLine);
				}
				else
				{
					with_1.Append("   if (ShowDialog(\'" + url + "\', null, " + height + ", " + width + ", " + left + ", " + top + ", " + Math.Abs(System.Convert.ToInt32(center)) + ", " + Math.Abs(System.Convert.ToInt32(help)) + ", " + Math.Abs(System.Convert.ToInt32(resizable)) + ", " + Math.Abs(System.Convert.ToInt32(status)) + "))" + System.Environment.NewLine);
					with_1.Append("   {" + System.Environment.NewLine);
					
					foreach (System.Web.UI.Control Control in page.Controls)
					{
						if (Control is System.Web.UI.HtmlControls.HtmlForm)
						{
							with_1.Append("       " + Control.ClientID() + ".PCS_EVENT_TARGET.value = \'ShowDialog\';" + System.Environment.NewLine);
							with_1.Append("       " + Control.ClientID+ ".PCS_EVENT_ARGUMENT.value = \'" + url + "\';" + System.Environment.NewLine);
							with_1.Append("       document." + Control.ClientID() + ".submit();" + System.Environment.NewLine);
							break;
						}
					}
					with_1.Append("   }" + System.Environment.NewLine);
				}
				with_1.Append("</script>" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "ShowDialog." + url, with_1.ToString());
			}
			
		}
Exemplo n.º 3
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Shows a popup for the specified web page url when the specified web page has loaded.
		/// </summary>
		/// <param name="page">The web page that will show the popup when loaded.</param>
		/// <param name="url">The web page url for which the popup is to be shown.</param>
		/// <param name="height">The height of the popup.</param>
		/// <param name="width">The width of the popup.</param>
		/// <param name="left">Location of the popup on X-axis.</param>
		/// <param name="top">Location of the popup on Y-axis.</param>
		/// <param name="center">True if the popup is to be centered; otherwise False.</param>
		/// <param name="resizable">True if the popup can be resized; otherwise False.</param>
		/// <param name="scrollbars">True is the scrollbars are to be displayed; otherwise False.</param>
		/// <param name="toolbar">True if the toolbar is to be displayed; otherwise False.</param>
		/// <param name="menubar">True if the menu bar is to be displayed; otherwise False.</param>
		/// <param name="location">True if the address bar is to be displayed; otherwise False.</param>
		/// <param name="status">True if the status bar is to be displayed; otherwise False.</param>
		/// <param name="directories">True if the directories buttons (Netscape only) are to be displayed; otherwise False.</param>
		/// <remarks></remarks>
		public static void ShowPopup(System.Web.UI.Page page, string url, int height, int width, int left, int top, bool center, bool resizable, bool scrollbars, bool toolbar, bool menubar, bool location, bool status, bool directories)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("ShowPopup"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ShowPopup", CreateClientSideScript(ClientSideScript.ShowPopup));
			}
			
			if (! page.ClientScript.IsStartupScriptRegistered("ShowPopup." + url))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
				with_1.Append("   ShowPopup(\'" + url + "\', " + height + ", " + width + ", " + left + ", " + top + ", " + Math.Abs(System.Convert.ToInt32(center)) + ", " + Math.Abs(System.Convert.ToInt32(resizable)) + ", " + Math.Abs(System.Convert.ToInt32(scrollbars)) + ", " + Math.Abs(System.Convert.ToInt32(toolbar)) + ", " + Math.Abs(System.Convert.ToInt32(menubar)) + ", " + Math.Abs(System.Convert.ToInt32(location)) + ", " + Math.Abs(System.Convert.ToInt32(status)) + ", " + Math.Abs(System.Convert.ToInt32(directories)) + ");" + System.Environment.NewLine);
				with_1.Append("</script>" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "ShowPopup." + url, with_1.ToString());
			}
			
		}
Exemplo n.º 4
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Pushes the browser window in which the specified web page has loaded to the background.
		/// </summary>
		/// <param name="page">The web page whose browser window is to be pushed to the background.</param>
		/// <remarks></remarks>
		public static void PushToBack(System.Web.UI.Page page)
		{
			
			if (! page.ClientScript.IsStartupScriptRegistered("PushToBack"))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
				with_1.Append("   window.blur();" + System.Environment.NewLine);
				with_1.Append("</script>" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "PushToBack", with_1.ToString());
			}
			
		}
Exemplo n.º 5
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Plays audio in the background when the specified web page has loaded.
		/// </summary>
		/// <param name="page">The web page in which audio is to be played.</param>
		/// <param name="soundFilename">Name of the audio file.</param>
		/// <param name="repeatCount">Number of times the audio is to be replayed.</param>
		/// <remarks></remarks>
		public static void PlayBackgroundSound(System.Web.UI.Page page, string soundFilename, int repeatCount)
		{
			
			if (! page.ClientScript.IsStartupScriptRegistered("PlayBackgroundSound"))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<BGSOUND SRC=\"" + soundFilename + "\" LOOP=\"" + repeatCount + "\">" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "PlayBackgroundSound", with_1.ToString());
			}
			
		}
Exemplo n.º 6
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Runs the specified executable on the client's machine when the specified web page finishes loading in the browser.
		/// </summary>
		/// <param name="page">The web page that will run the executable.</param>
		/// <param name="executable">Name of the executable to run.</param>
		/// <remarks></remarks>
		public static void RunClientExe(System.Web.UI.Page page, string executable)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("RunClientExe"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "RunClientExe", CreateClientSideScript(ClientSideScript.RunClientExe));
			}
			
			if (! page.ClientScript.IsStartupScriptRegistered("RunClientExe." + executable))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
				with_1.Append("   RunClientExe(\'" + JavaScriptEncode(executable) + "\');" + System.Environment.NewLine);
				with_1.Append("</script>" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "RunClientExe." + executable, with_1.ToString());
			}
			
		}
Exemplo n.º 7
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Sets the focus to the specified web control.
		/// </summary>
		/// <param name="control">The web control to which the focus is to be set.</param>
		/// <remarks></remarks>
		public static void Focus(System.Web.UI.Control control)
		{
			
			if (! control.Page.ClientScript.IsClientScriptBlockRegistered("Focus"))
			{
				control.Page.ClientScript.RegisterClientScriptBlock(control.Page.GetType(), "Focus", CreateClientSideScript(ClientSideScript.Focus));
			}
			
			System.Text.StringBuilder with_1 = new StringBuilder;
			with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
			with_1.Append("   Focus(\'" + control.ClientID+ "\');" + System.Environment.NewLine);
			with_1.Append("</script>" + System.Environment.NewLine);
			
			if (! control.Page.ClientScript.IsStartupScriptRegistered("Focus." + control.ClientID))
			{
				control.Page.ClientScript.RegisterStartupScript(control.Page.GetType(), "Focus." + control.ClientID, with_1.ToString());
			}
			
		}
Exemplo n.º 8
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Maximizes the browser window when the specified web page has loaded.
		/// </summary>
		/// <param name="page">The web page whose browser window is to be maximized when loaded.</param>
		/// <remarks></remarks>
		public static void Maximize(System.Web.UI.Page page)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("Maximize"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "Maximize", CreateClientSideScript(ClientSideScript.Maximize));
			}
			
			System.Text.StringBuilder with_1 = new StringBuilder;
			with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
			with_1.Append("   Maximize();" + System.Environment.NewLine);
			with_1.Append("</script>" + System.Environment.NewLine);
			
			page.ClientScript.RegisterStartupScript(page.GetType(), "Maximize:" + VBMath.Rnd(), with_1.ToString());
			
		}
Exemplo n.º 9
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Refreshes the web page as soon as it has loaded.
		/// </summary>
		/// <param name="page">The web page that is to be refreshed.</param>
		/// <param name="postRefresh">
		/// True if the web page is to be refreshed after the entire web page is rendered and loaded; otherwise False.
		/// </param>
		/// <remarks></remarks>
		public static void Refresh(System.Web.UI.Page page, bool postRefresh)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("Refresh"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "Refresh", CreateClientSideScript(ClientSideScript.Refresh));
			}
			
			if (postRefresh)
			{
				if (! page.ClientScript.IsStartupScriptRegistered("PostRefresh"))
				{
					System.Text.StringBuilder with_1 = new StringBuilder;
					with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
					with_1.Append("   Refresh();" + System.Environment.NewLine);
					with_1.Append("</script>" + System.Environment.NewLine);
					
					page.ClientScript.RegisterStartupScript(page.GetType(), "PostRefresh", with_1.ToString());
				}
			}
			else
			{
				if (! page.ClientScript.IsClientScriptBlockRegistered("PreRefresh"))
				{
					System.Text.StringBuilder with_2 = new StringBuilder;
					with_2.Append("<script language=\"javascript\">" + System.Environment.NewLine);
					with_2.Append("   Refresh();" + System.Environment.NewLine);
					with_2.Append("</script>" + System.Environment.NewLine);
					
					page.ClientScript.RegisterClientScriptBlock(page.GetType(), "PreRefresh", with_2.ToString());
				}
			}
			
		}
Exemplo n.º 10
0
Arquivo: Common.cs Projeto: avs009/gsf
		/// <summary>
		/// Shows a windows application style message box when the specified web page has loaded.
		/// </summary>
		/// <param name="page">The web page that will show the message box when loaded.</param>
		/// <param name="prompt">The text that is to be displayed in the message box.</param>
		/// <param name="title">The title of the message box.</param>
		/// <param name="buttons">The buttons to be displayed in the message box.</param>
		/// <param name="doPostBack">
		/// True if a post-back is to be performed when either OK, Retry, or Yes buttons are clicked in the message box;
		/// otherwise False.
		/// </param>
		/// <remarks></remarks>
		public static void MsgBox(System.Web.UI.Page page, string prompt, string title, MsgBoxStyle buttons, bool doPostBack)
		{
			
			if (! page.ClientScript.IsClientScriptBlockRegistered("ShowMsgBox"))
			{
				page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ShowMsgBox", CreateClientSideScript(ClientSideScript.MsgBox));
			}
			
			if (! page.ClientScript.IsStartupScriptRegistered("ShowMsgBox." + prompt))
			{
				System.Text.StringBuilder with_1 = new StringBuilder;
				with_1.Append("<input type=\"hidden\" name=\"PCS_EVENT_TARGET\" value=\"\" />" + System.Environment.NewLine);
				with_1.Append("<input type=\"hidden\" name=\"PCS_EVENT_ARGUMENT\" value=\"\" />" + System.Environment.NewLine);
				with_1.Append("<script language=\"javascript\">" + System.Environment.NewLine);
				with_1.Append("   if (ShowMsgBox(\'" + JavaScriptEncode(prompt) + " \', \'" + title + "\', " + buttons + ", " + Strings.LCase(doPostBack) + ")) " + System.Environment.NewLine);
				with_1.Append("   {" + System.Environment.NewLine);
				
				foreach (System.Web.UI.Control Control in page.Controls)
				{
					if (Control is System.Web.UI.HtmlControls.HtmlForm)
					{
						with_1.Append("       " + Control.ClientID() + ".PCS_EVENT_TARGET.value = \'MsgBox\';" + System.Environment.NewLine);
						with_1.Append("       " + Control.ClientID() + ".PCS_EVENT_ARGUMENT.value = \'" + title + "\';" + System.Environment.NewLine);
						with_1.Append("       document." + Control.ClientID() + ".submit();" + System.Environment.NewLine);
						break;
					}
				}
				with_1.Append("   }" + System.Environment.NewLine);
				with_1.Append("</script>" + System.Environment.NewLine);
				
				page.ClientScript.RegisterStartupScript(page.GetType(), "ShowMsgBox." + prompt, with_1.ToString());
			}
			
		}