Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / Visual Basic

Automatic Implementation of the Event-Based Asynchronous Pattern

Rate me:
Please Sign up or sign in to vote.
4.78/5 (32 votes)
26 Nov 2008CPOL20 min read 63.2K   912   101  
Implement the event-based asynchronous pattern automatically with this code generator
namespace EventBasedAsync
{
	partial class Client
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.button1 = new System.Windows.Forms.Button();
			this.panel1 = new System.Windows.Forms.Panel();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.panel3 = new System.Windows.Forms.Panel();
			this.label1 = new System.Windows.Forms.Label();
			this.newWorkItemsUpDownControl = new System.Windows.Forms.NumericUpDown();
			this.panel2 = new System.Windows.Forms.Panel();
			this.statusStrip1 = new System.Windows.Forms.StatusStrip();
			this.listViewContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
			this.purgeCompletedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
			this.cancelSelectedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
			this.listView1 = new ListViewEmbeddedControls.ListViewEx();
			this.submittedColumnHeader = new System.Windows.Forms.ColumnHeader();
			this.progressColumnHeader = new System.Windows.Forms.ColumnHeader();
			this.statusColumnHeader = new System.Windows.Forms.ColumnHeader();
			this.argColumnHeader = new System.Windows.Forms.ColumnHeader();
			this.resultColumnHeader = new System.Windows.Forms.ColumnHeader();
			//this.serverAsyncWrapper = new EventBasedAsync.ServerAsyncWrapper(this.components);
			this.panel1.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.panel3.SuspendLayout();
			((System.ComponentModel.ISupportInitialize) (this.newWorkItemsUpDownControl)).BeginInit();
			this.panel2.SuspendLayout();
			this.listViewContextMenu.SuspendLayout();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
						| System.Windows.Forms.AnchorStyles.Right)));
			this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (177)));
			this.button1.Location = new System.Drawing.Point(8, 6);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(184, 40);
			this.button1.TabIndex = 0;
			this.button1.Text = "Submit Request(s)";
			this.button1.UseVisualStyleBackColor = true;
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// panel1
			// 
			this.panel1.Controls.Add(this.groupBox1);
			this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.panel1.Location = new System.Drawing.Point(0, 238);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(608, 85);
			this.panel1.TabIndex = 4;
			// 
			// groupBox1
			// 
			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
						| System.Windows.Forms.AnchorStyles.Left)
						| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox1.Controls.Add(this.panel3);
			this.groupBox1.Controls.Add(this.panel2);
			this.groupBox1.Location = new System.Drawing.Point(10, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(588, 72);
			this.groupBox1.TabIndex = 2;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Submit New Work Items";
			// 
			// panel3
			// 
			this.panel3.Controls.Add(this.label1);
			this.panel3.Controls.Add(this.newWorkItemsUpDownControl);
			this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel3.Location = new System.Drawing.Point(3, 16);
			this.panel3.Name = "panel3";
			this.panel3.Size = new System.Drawing.Size(381, 53);
			this.panel3.TabIndex = 2;
			// 
			// label1
			// 
			this.label1.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
						| System.Windows.Forms.AnchorStyles.Right)));
			this.label1.AutoSize = true;
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (177)));
			this.label1.Location = new System.Drawing.Point(221, 18);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(78, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "How many?";
			// 
			// newWorkItemsUpDownControl
			// 
			this.newWorkItemsUpDownControl.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
						| System.Windows.Forms.AnchorStyles.Right)));
			this.newWorkItemsUpDownControl.Location = new System.Drawing.Point(309, 16);
			this.newWorkItemsUpDownControl.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
			this.newWorkItemsUpDownControl.Name = "newWorkItemsUpDownControl";
			this.newWorkItemsUpDownControl.Size = new System.Drawing.Size(56, 20);
			this.newWorkItemsUpDownControl.TabIndex = 0;
			this.newWorkItemsUpDownControl.Value = new decimal(new int[] {
            1,
            0,
            0,
            0});
			// 
			// panel2
			// 
			this.panel2.Controls.Add(this.button1);
			this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
			this.panel2.Location = new System.Drawing.Point(384, 16);
			this.panel2.Name = "panel2";
			this.panel2.Size = new System.Drawing.Size(201, 53);
			this.panel2.TabIndex = 1;
			// 
			// statusStrip1
			// 
			this.statusStrip1.Location = new System.Drawing.Point(0, 323);
			this.statusStrip1.Name = "statusStrip1";
			this.statusStrip1.Size = new System.Drawing.Size(608, 22);
			this.statusStrip1.TabIndex = 3;
			this.statusStrip1.Text = "statusStrip1";
			// 
			// listViewContextMenu
			// 
			this.listViewContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.purgeCompletedToolStripMenuItem,
            this.cancelSelectedToolStripMenuItem});
			this.listViewContextMenu.Name = "listViewContextMenu";
			this.listViewContextMenu.ShowImageMargin = false;
			this.listViewContextMenu.Size = new System.Drawing.Size(132, 48);
			// 
			// purgeCompletedToolStripMenuItem
			// 
			this.purgeCompletedToolStripMenuItem.Name = "purgeCompletedToolStripMenuItem";
			this.purgeCompletedToolStripMenuItem.Size = new System.Drawing.Size(131, 22);
			this.purgeCompletedToolStripMenuItem.Text = "Purge Completed";
			this.purgeCompletedToolStripMenuItem.Click += new System.EventHandler(this.purgeCompletedToolStripMenuItem_Click);
			// 
			// cancelSelectedToolStripMenuItem
			// 
			this.cancelSelectedToolStripMenuItem.Name = "cancelSelectedToolStripMenuItem";
			this.cancelSelectedToolStripMenuItem.Size = new System.Drawing.Size(131, 22);
			this.cancelSelectedToolStripMenuItem.Text = "Cancel Selected";
			this.cancelSelectedToolStripMenuItem.Click += new System.EventHandler(this.cancelSelectedToolStripMenuItem_Click);
			// 
			// listView1
			// 
			this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.submittedColumnHeader,
            this.progressColumnHeader,
            this.statusColumnHeader,
            this.argColumnHeader,
            this.resultColumnHeader});
			this.listView1.ContextMenuStrip = this.listViewContextMenu;
			this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.listView1.FullRowSelect = true;
			this.listView1.GridLines = true;
			this.listView1.Location = new System.Drawing.Point(0, 0);
			this.listView1.Name = "listView1";
			this.listView1.Size = new System.Drawing.Size(608, 238);
			this.listView1.TabIndex = 6;
			this.listView1.UseCompatibleStateImageBehavior = false;
			this.listView1.View = System.Windows.Forms.View.Details;
			// 
			// submittedColumnHeader
			// 
			this.submittedColumnHeader.Text = "Submitted";
			this.submittedColumnHeader.Width = 120;
			// 
			// progressColumnHeader
			// 
			this.progressColumnHeader.DisplayIndex = 3;
			this.progressColumnHeader.Text = "Progress";
			this.progressColumnHeader.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			this.progressColumnHeader.Width = 200;
			// 
			// statusColumnHeader
			// 
			this.statusColumnHeader.DisplayIndex = 1;
			this.statusColumnHeader.Text = "Status";
			this.statusColumnHeader.Width = 80;
			// 
			// argColumnHeader
			// 
			this.argColumnHeader.DisplayIndex = 2;
			this.argColumnHeader.Text = "Argument";
			this.argColumnHeader.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// resultColumnHeader
			// 
			this.resultColumnHeader.Text = "Result";
			// 
			// serverAsyncWrapper
			// 
			//this.serverAsyncWrapper.Server = null;
			//this.serverAsyncWrapper.DoSomethingProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.server_DoSomethingProgressChanged);
			//this.serverAsyncWrapper.DoSomethingCompleted += new EventBasedAsync.DoSomethingCompletedEventHandler(this.server_DoSomethingCompleted);
			// 
			// Client
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(608, 345);
			this.Controls.Add(this.listView1);
			this.Controls.Add(this.panel1);
			this.Controls.Add(this.statusStrip1);
			this.MinimumSize = new System.Drawing.Size(400, 300);
			this.Name = "Client";
			this.Text = "Event-Based Async Client";
			this.panel1.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.panel3.ResumeLayout(false);
			this.panel3.PerformLayout();
			((System.ComponentModel.ISupportInitialize) (this.newWorkItemsUpDownControl)).EndInit();
			this.panel2.ResumeLayout(false);
			this.listViewContextMenu.ResumeLayout(false);
			this.ResumeLayout(false);
			this.PerformLayout();

		}

		#endregion

		private System.Windows.Forms.Button button1;
		//private ServerAsyncWrapper serverAsyncWrapper;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Panel panel2;
		private System.Windows.Forms.Panel panel3;
		private System.Windows.Forms.NumericUpDown newWorkItemsUpDownControl;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.StatusStrip statusStrip1;
		private System.Windows.Forms.GroupBox groupBox1;
		private ListViewEmbeddedControls.ListViewEx listView1;
		private System.Windows.Forms.ColumnHeader submittedColumnHeader;
		private System.Windows.Forms.ColumnHeader progressColumnHeader;
		private System.Windows.Forms.ColumnHeader statusColumnHeader;
		private System.Windows.Forms.ContextMenuStrip listViewContextMenu;
		private System.Windows.Forms.ToolStripMenuItem purgeCompletedToolStripMenuItem;
		private System.Windows.Forms.ToolStripMenuItem cancelSelectedToolStripMenuItem;
		private System.Windows.Forms.ColumnHeader argColumnHeader;
		private System.Windows.Forms.ColumnHeader resultColumnHeader;
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Philips Healthcare
Israel Israel
I got my B.Sc. in Mathematics and Computer Science from Tel Aviv University in 1997. Since then I have developed software in UNIX, Win32 and .NET. I currently live in Haifa.

Comments and Discussions