Exemple #1
0
		public void TestCall2()
		{
			var parameters = new[] { typeof(int), typeof(int) };

			var dm = new DynamicMethod("soma", typeof(int), parameters);

			var gen = dm.GetILGenerator();

			gen.DeclareLocal (typeof(Math));
			var ctor = typeof(Math).GetConstructors () [0];

			gen.Emit (OpCodes.Newobj, ctor);
			gen.Emit (OpCodes.Stloc, 0);
            gen.Emit (OpCodes.Ldobj, 0);

			//gen.Emit(OpCodes.Ldarg_0);
			//gen.Emit(OpCodes.Ldarg_1);
			//var soma = GetType ().GetMethod ("Soma");

			//gen.EmitCall (OpCodes.Callvirt, soma, new Type[] {  });

			gen.Emit (OpCodes.Ldc_I4, 2);

			gen.Emit(OpCodes.Ret);

			var result = dm.Invoke(null, new object[] { 1, 1 });

			//var func = (Func<int, int, int>)dm.CreateDelegate(typeof(Func<int, int, int>));

			Assert.AreEqual (2, result);
		}          
Exemple #2
0
        public void Do()
        {
            var parameters = new[] { typeof(int), typeof(int) };

            var dm = new DynamicMethod("soma", typeof(int), parameters);

            var gen = dm.GetILGenerator();

            gen.Emit(OpCodes.Ldc_I4, 1);
            gen.Emit(OpCodes.Ldc_I4, 1);
            gen.Emit(OpCodes.Add);
            gen.Emit(OpCodes.Ret);

            var result = dm.Invoke(null, new object[] { 1, 1 });

            Assert.AreEqual(2, result);
        }   
Exemple #3
0
		public void TestCall()
		{
			var parameters = new[] { typeof(int), typeof(int) };

			var dm = new DynamicMethod("soma", typeof(int), parameters);

			var gen = dm.GetILGenerator();

			gen.Emit(OpCodes.Ldarg_0);
			gen.Emit(OpCodes.Ldarg_1);

			var soma = GetType ().GetMethod ("Soma");

			gen.Emit (OpCodes.Call, soma);

			gen.Emit(OpCodes.Ret);

			var result = dm.Invoke(null, new object[] { 1, 1 });

			Assert.AreEqual (2, result);
		}         
Exemple #4
0
		/// <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());
			}
			
		}
Exemple #5
0
		/// <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());
			}
			
		}
Exemple #6
0
		/// <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());
			}
			
		}
Exemple #7
0
		/// <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());
			}
			
		}
Exemple #8
0
		/// <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());
			}
			
		}
Exemple #9
0
		void buildTextures ()
		{
			Content.AddContent (
				"outline",
				textures.OutlineTexture (
					new MonoGame.Extended.Size (15, 10),
					Color.White,
					Color.Black));

			Content.AddContent (
				"solid",
				textures.SolidTexture (
					new MonoGame.Extended.Size (1, 1),
					Color.White));


			#region Alternates Test
			var altColor = new [] { Color.White, Color.Black };
			Content.AddContent (
				"alt_1",
				textures.AlternatingTexture (
					new MonoGame.Extended.Size (1, 1),
					altColor));
			Content.AddContent (
				"alt_2",
				textures.AlternatingTexture (
					new MonoGame.Extended.Size (5, 5),
					altColor));
			Content.AddContent (
				"alt_3",
				textures.AlternatingTexture (
					new MonoGame.Extended.Size (50, 20),
					altColor));
			Content.AddContent (
				"alt_4",
				textures.AlternatingTexture (
					new MonoGame.Extended.Size (50, 100),
					altColor));
			
			#endregion
			#region Solid
			Content.AddContent (
				"sol_1",
				textures.AlternatingTexture (
					new MonoGame.Extended.Size (1, 1),
					altColor));
			Content.AddContent (
				"sol_2",
				textures.SolidTexture (
					new MonoGame.Extended.Size (5, 5),
					Color.White));
			Content.AddContent (
				"sol_3",
				textures.SolidTexture (
					new MonoGame.Extended.Size (5, 100),
					Color.White));
			Content.AddContent (
				"sol_4",
				textures.SolidTexture (
					new MonoGame.Extended.Size (100, 100),
					Color.White));

			#endregion
			#region Outline
			Content.AddContent (
				"out_1",
				textures.OutlineTexture (
					new MonoGame.Extended.Size (1, 1),
					Color.White));
			Content.AddContent (
				"out_2",
				textures.OutlineTexture (
					new MonoGame.Extended.Size (3, 3),
					Color.White));
			Content.AddContent (
				"out_3",
				textures.OutlineTexture (
					new MonoGame.Extended.Size (100, 3),
					Color.White));
			Content.AddContent (
				"out_4",
				textures.OutlineTexture (
					new MonoGame.Extended.Size (6, 6),
					Color.White));
			Content.AddContent (
				"out_5",
				textures.OutlineTexture (
					new MonoGame.Extended.Size (20, 20), // El tamaño de la imagen de muestra
					Color.White));
			#endregion
		}
        private void OnViewChanged(object sender, FileSystemEventArgs e)
        {
            var fullpath = e.FullPath;
            fullpath = fullpath.Replace("\\", "/").Replace("//", "/");
            if (Path.GetExtension(e.FullPath).IndexOf(this.ViewFileExtension) == -1 &&
                Path.GetExtension(e.FullPath).IndexOf(this.JSGeneratorFileExtension) == -1 &&
                Path.GetExtension(e.FullPath).IndexOf(".boo") == -1)
            {
                return; //early return since only watching view extensions and jsgenerator extensions
            }

            string viewRoot = String.Empty;
            IViewSourceLoader loaderThatDetectedTheChange = sender as IViewSourceLoader;
            if (loaderThatDetectedTheChange == null)
            {
                viewRoot = ViewRootDir;
            }
            else
            {
                var pathprobes =
                    new[] { loaderThatDetectedTheChange.ViewRootDir }.Union(loaderThatDetectedTheChange.PathSources.OfType<string>())
                    .Select(x=>x.Replace("\\","/")).ToArray();
                foreach (var pathprobe in pathprobes)
                {
                    if (fullpath.StartsWith(pathprobe))
                    {
                        viewRoot = pathprobe;
                        break;
                    }
                }
            }

            string path = e.FullPath.Substring(viewRoot.Length);
            path = EnsurePathDoesNotStartWithDirectorySeparator(path);
            path = path.Replace("/", "\\");
            if (path.IndexOf(options.CommonScriptsDirectory) != -1)
            {
                Log("Detected a change in commons scripts directory " + options.CommonScriptsDirectory + ", recompiling site");
                // need to invalidate the entire CommonScripts assembly
                // not worrying about concurrency here, since it is assumed
                // that changes here are rare. Note, this force a recompile of the 
                // whole site!
                try
                {
                    WaitForFileToBecomeAvailableForReading(e);
                    CompileCommonScripts();
                }
                catch (Exception ex)
                {
                    // we failed to recompile the commons scripts directory, but because we are running
                    // on another thread here, and exception would kill the application, so we log it 
                    // and continue on. CompileCommonScripts() will only change the global state if it has
                    // successfully compiled the commons scripts directory.
                    if (logger != null && logger.IsErrorEnabled)
                    {
                        logger.Error("Failed to recompile the commons scripts directory!", ex);
                    }
                }
            }
            else
            {
                Log("Detected a change in {0}, removing from complied cache", e.Name);
                // Will cause a recompilation
                compilations[path] = null;
            }
            ViewRecompiled(path);
        }
Exemple #11
0
		/// <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());
			}
			
		}
Exemple #12
0
 private static Process2 AttachAndWaitForMode(VisualStudioApp app, SD.Process processToAttach, object debugEngines, dbgDebugMode expectedMode) {
     Debugger2 dbg2 = (Debugger2)app.Dte.Debugger;
     System.Threading.Thread.Sleep(1000);
     Process2 result = null;
     Transport t = dbg2.Transports.Item("Default");
     bool foundit = false;
     foreach (Process2 p in dbg2.LocalProcesses) {
         if (p.ProcessID == processToAttach.Id) {
             foundit = true;
             p.Attach2(debugEngines);
             result = p;
             break;
         }
     }
     Assert.IsTrue(foundit, "The process to attach [{0}] could not be found in LocalProcesses (did it exit immediately?)", processToAttach.Id);
     DebugProject.WaitForMode(app, expectedMode);
     return result;
 }
        public void ColoringRuleDefaults()
        {
            var expectedRules = new[]
            {
                new RichTextBoxRowColoringRule("level == LogLevel.Fatal", "White", "Red", FontStyle.Bold),
                new RichTextBoxRowColoringRule("level == LogLevel.Error", "Red", "Empty", FontStyle.Bold | FontStyle.Italic),
                new RichTextBoxRowColoringRule("level == LogLevel.Warn", "Orange", "Empty", FontStyle.Underline),
                new RichTextBoxRowColoringRule("level == LogLevel.Info", "Black", "Empty"),
                new RichTextBoxRowColoringRule("level == LogLevel.Debug", "Gray", "Empty"),
                new RichTextBoxRowColoringRule("level == LogLevel.Trace", "DarkGray", "Empty", FontStyle.Italic),
            };

            var actualRules = RichTextBoxTarget.DefaultRowColoringRules;
            Assert.AreEqual(expectedRules.Length, actualRules.Count);
            for (int i = 0; i < expectedRules.Length; ++i)
            {
                Assert.AreEqual(expectedRules[i].BackgroundColor, actualRules[i].BackgroundColor);
                Assert.AreEqual(expectedRules[i].FontColor, actualRules[i].FontColor);
                Assert.AreEqual(expectedRules[i].Condition.ToString(), actualRules[i].Condition.ToString());
                Assert.AreEqual(expectedRules[i].Style, actualRules[i].Style);
            }
        }
        /// <summary>
        /// Traces the event.
        /// </summary>
        /// <param name="traceSource">The trace source.</param>
        /// <param name="type">The type.</param>
        /// <param name="message">The message.</param>
        public static void TraceEvent(string traceSource, SD.TraceEventType type, string message)
        {
            SD.TraceSource ts = new SD.TraceSource(traceSource);

            if (SD.Trace.CorrelationManager.ActivityId == Guid.Empty)
            {
                SD.Trace.CorrelationManager.ActivityId = Guid.NewGuid();
            }

            ts.TraceEvent(type, 0, message);
        }
Exemple #15
0
		/// <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());
			}
			
		}
Exemple #16
0
		/// <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());
				}
			}
			
		}
Exemple #17
0
		/// <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());
			}
			
		}
Exemple #18
0
		/// <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());
			
		}
        public void BatchErrorHandlingTest()
        {
            var fileTarget = new FileTarget();
            fileTarget.FileName = "${logger}";
            fileTarget.Layout = "${message}";
            fileTarget.Initialize(null);

            // make sure that when file names get sorted, the asynchronous continuations are sorted with them as well
            var exceptions = new List<Exception>();
            var events = new[]
            {
                new LogEventInfo(LogLevel.Info, "file99.txt", "msg1").WithContinuation(exceptions.Add),
                new LogEventInfo(LogLevel.Info, "a/", "msg1").WithContinuation(exceptions.Add),
                new LogEventInfo(LogLevel.Info, "a/", "msg2").WithContinuation(exceptions.Add),
                new LogEventInfo(LogLevel.Info, "a/", "msg3").WithContinuation(exceptions.Add),
            };

            fileTarget.WriteAsyncLogEvents(events);

            Assert.AreEqual(4, exceptions.Count);
            Assert.IsNull(exceptions[0]);
            Assert.IsNotNull(exceptions[1]);
            Assert.IsNotNull(exceptions[2]);
            Assert.IsNotNull(exceptions[3]);
        }
 static void ReadProcessOutputEventHandler(object sender, SD.DataReceivedEventArgs e)
 {
     if (e.Data == null) return;
     Debug.Log(e.Data);
 }