Click here to Skip to main content
15,892,059 members
Articles / Programming Languages / C#

Hello UIPAB

Rate me:
Please Sign up or sign in to vote.
4.76/5 (27 votes)
24 Mar 2005CPOL14 min read 118K   230   84  
A primer to Microsoft's User Interface Process Application Block.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.UIProcess;

namespace SimpleWinUIPAB
{
	/// <summary>
	/// Summary description for View3.
	/// </summary>
	public class View3 : WindowsFormView
	{
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label lblName;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button2;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public View3()
		{
			InitializeComponent();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(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.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.lblName = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.BackColor = System.Drawing.SystemColors.Control;
            this.label1.ForeColor = System.Drawing.Color.Maroon;
            this.label1.Location = new System.Drawing.Point(4, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(352, 23);
            this.label1.TabIndex = 0;
            this.label1.Text = "Display the value passed by the UIPAB\'s State Persistence Provider.";
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(8, 48);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(32, 23);
            this.label2.TabIndex = 1;
            this.label2.Text = "Hello,";
            // 
            // lblName
            // 
            this.lblName.Location = new System.Drawing.Point(40, 48);
            this.lblName.Name = "lblName";
            this.lblName.TabIndex = 2;
            this.lblName.Text = "label3";
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(8, 96);
            this.button1.Name = "button1";
            this.button1.TabIndex = 3;
            this.button1.Text = "Previous";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(184, 96);
            this.button3.Name = "button3";
            this.button3.TabIndex = 5;
            this.button3.Text = "Exit";
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(96, 96);
            this.button2.Name = "button2";
            this.button2.TabIndex = 6;
            this.button2.Text = "Restart";
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // View3
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(360, 266);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.lblName);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Name = "View3";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "View3";
            this.Load += new System.EventHandler(this.View3_Load);
            this.ResumeLayout(false);

        }
		#endregion

        private void button1_Click(object sender, System.EventArgs e)
        {
            // the controller handles the navigation between views
            SimpleController simpleController = (SimpleController)Controller;
            simpleController.Previous();                
        }

        private void button2_Click(object sender, System.EventArgs e)
        {
            // the controller handles the navigation between views
            SimpleController simpleController = (SimpleController)Controller;
            simpleController.Restart();                
        }

        private void button3_Click(object sender, System.EventArgs e)
        {
            Application.Exit();
        }

        private void View3_Load(object sender, System.EventArgs e)
        {
            lblName.Text = (string) Controller.State["name"];
        }
	}
}

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
Architect
United States United States
Roy is a software developer who digs all aspects of software development, from design and architecture to implementation.

Comments and Discussions