Click here to Skip to main content
15,881,787 members
Articles / Desktop Programming / Windows Forms

Fun with Rx

Rate me:
Please Sign up or sign in to vote.
4.93/5 (69 votes)
8 Sep 2010CPOL15 min read 150.2K   1.2K   120  
A brief look into the DevLabs Reactive Framework.
namespace RxAsyncWebCalls
{
    partial class Form1
    {
        /// <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()
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            this.panel1 = new System.Windows.Forms.Panel();
            this.label1 = new System.Windows.Forms.Label();
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.dgvPeople = new System.Windows.Forms.DataGridView();
            this.BtnStandardWCFCall = new System.Windows.Forms.Button();
            this.pnlWait = new System.Windows.Forms.Panel();
            this.label2 = new System.Windows.Forms.Label();
            this.BtnAsyncUsingRx = new System.Windows.Forms.Button();
            this.BtnAsyncUsingRxFailure = new System.Windows.Forms.Button();
            this.BtnStandardWCFCall_Fail = new System.Windows.Forms.Button();
            this.panel1.SuspendLayout();
            this.tableLayoutPanel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvPeople)).BeginInit();
            this.pnlWait.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.Color.CornflowerBlue;
            this.panel1.Controls.Add(this.label1);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(747, 47);
            this.panel1.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.White;
            this.label1.Location = new System.Drawing.Point(13, 13);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(485, 24);
            this.label1.TabIndex = 0;
            this.label1.Text = "This small sample illustrates Rx Async service calls";
            // 
            // tableLayoutPanel1
            // 
            this.tableLayoutPanel1.BackColor = System.Drawing.Color.White;
            this.tableLayoutPanel1.ColumnCount = 4;
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tableLayoutPanel1.Controls.Add(this.dgvPeople, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.BtnStandardWCFCall, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.pnlWait, 0, 2);
            this.tableLayoutPanel1.Controls.Add(this.BtnAsyncUsingRx, 2, 0);
            this.tableLayoutPanel1.Controls.Add(this.BtnAsyncUsingRxFailure, 3, 0);
            this.tableLayoutPanel1.Controls.Add(this.BtnStandardWCFCall_Fail, 1, 0);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 47);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 3;
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
            this.tableLayoutPanel1.Size = new System.Drawing.Size(747, 310);
            this.tableLayoutPanel1.TabIndex = 2;
            // 
            // dgvPeople
            // 
            this.dgvPeople.AllowUserToAddRows = false;
            this.dgvPeople.AllowUserToDeleteRows = false;
            dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightBlue;
            this.dgvPeople.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
            this.dgvPeople.BackgroundColor = System.Drawing.Color.White;
            this.dgvPeople.BorderStyle = System.Windows.Forms.BorderStyle.None;
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ActiveCaption;
            dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgvPeople.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
            this.dgvPeople.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.tableLayoutPanel1.SetColumnSpan(this.dgvPeople, 4);
            this.dgvPeople.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dgvPeople.Location = new System.Drawing.Point(3, 48);
            this.dgvPeople.Name = "dgvPeople";
            this.dgvPeople.ReadOnly = true;
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.ActiveCaption;
            dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgvPeople.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
            dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
            this.dgvPeople.RowsDefaultCellStyle = dataGridViewCellStyle4;
            this.dgvPeople.Size = new System.Drawing.Size(741, 239);
            this.dgvPeople.TabIndex = 2;
            // 
            // BtnStandardWCFCall
            // 
            this.BtnStandardWCFCall.Dock = System.Windows.Forms.DockStyle.Fill;
            this.BtnStandardWCFCall.Location = new System.Drawing.Point(10, 10);
            this.BtnStandardWCFCall.Margin = new System.Windows.Forms.Padding(10);
            this.BtnStandardWCFCall.Name = "BtnStandardWCFCall";
            this.BtnStandardWCFCall.Size = new System.Drawing.Size(166, 25);
            this.BtnStandardWCFCall.TabIndex = 1;
            this.BtnStandardWCFCall.Text = "Standard IAsyncResult";
            this.BtnStandardWCFCall.UseVisualStyleBackColor = true;
            this.BtnStandardWCFCall.Click += new System.EventHandler(this.BtnStandardWCFCall_Click);
            // 
            // pnlWait
            // 
            this.pnlWait.BackColor = System.Drawing.Color.WhiteSmoke;
            this.tableLayoutPanel1.SetColumnSpan(this.pnlWait, 4);
            this.pnlWait.Controls.Add(this.label2);
            this.pnlWait.Location = new System.Drawing.Point(0, 290);
            this.pnlWait.Margin = new System.Windows.Forms.Padding(0);
            this.pnlWait.Name = "pnlWait";
            this.pnlWait.Size = new System.Drawing.Size(747, 20);
            this.pnlWait.TabIndex = 3;
            this.pnlWait.Visible = false;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.Location = new System.Drawing.Point(11, 4);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(189, 13);
            this.label2.TabIndex = 0;
            this.label2.Text = "Please wait calling WCF service";
            // 
            // BtnAsyncUsingRx
            // 
            this.BtnAsyncUsingRx.Dock = System.Windows.Forms.DockStyle.Fill;
            this.BtnAsyncUsingRx.Location = new System.Drawing.Point(382, 10);
            this.BtnAsyncUsingRx.Margin = new System.Windows.Forms.Padding(10);
            this.BtnAsyncUsingRx.Name = "BtnAsyncUsingRx";
            this.BtnAsyncUsingRx.Size = new System.Drawing.Size(166, 25);
            this.BtnAsyncUsingRx.TabIndex = 4;
            this.BtnAsyncUsingRx.Text = "Async Call Using RX";
            this.BtnAsyncUsingRx.UseVisualStyleBackColor = true;
            this.BtnAsyncUsingRx.Click += new System.EventHandler(this.BtnAsyncUsingRx_Click);
            // 
            // BtnAsyncUsingRxFailure
            // 
            this.BtnAsyncUsingRxFailure.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.BtnAsyncUsingRxFailure.Location = new System.Drawing.Point(568, 10);
            this.BtnAsyncUsingRxFailure.Margin = new System.Windows.Forms.Padding(10);
            this.BtnAsyncUsingRxFailure.Name = "BtnAsyncUsingRxFailure";
            this.BtnAsyncUsingRxFailure.Size = new System.Drawing.Size(169, 25);
            this.BtnAsyncUsingRxFailure.TabIndex = 5;
            this.BtnAsyncUsingRxFailure.Text = "Async Call Using RX Fail";
            this.BtnAsyncUsingRxFailure.UseVisualStyleBackColor = true;
            this.BtnAsyncUsingRxFailure.Click += new System.EventHandler(this.BtnAsyncUsingRxFailure_Click);
            // 
            // BtnStandardWCFCall_Fail
            // 
            this.BtnStandardWCFCall_Fail.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.BtnStandardWCFCall_Fail.Location = new System.Drawing.Point(196, 10);
            this.BtnStandardWCFCall_Fail.Margin = new System.Windows.Forms.Padding(10);
            this.BtnStandardWCFCall_Fail.Name = "BtnStandardWCFCall_Fail";
            this.BtnStandardWCFCall_Fail.Size = new System.Drawing.Size(166, 25);
            this.BtnStandardWCFCall_Fail.TabIndex = 6;
            this.BtnStandardWCFCall_Fail.Text = "Standard IAsyncResult Fail";
            this.BtnStandardWCFCall_Fail.UseVisualStyleBackColor = true;
            this.BtnStandardWCFCall_Fail.Click += new System.EventHandler(this.BtnStandardWCFCall_Fail_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(747, 357);
            this.Controls.Add(this.tableLayoutPanel1);
            this.Controls.Add(this.panel1);
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Demonstrates how RX can call Async services";
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.tableLayoutPanel1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dgvPeople)).EndInit();
            this.pnlWait.ResumeLayout(false);
            this.pnlWait.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
        private System.Windows.Forms.DataGridView dgvPeople;
        private System.Windows.Forms.Button BtnStandardWCFCall;
        private System.Windows.Forms.Panel pnlWait;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button BtnAsyncUsingRx;
        private System.Windows.Forms.Button BtnAsyncUsingRxFailure;
        private System.Windows.Forms.Button BtnStandardWCFCall_Fail;

    }
}

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)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

Comments and Discussions