Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Propagator in C# - An Alternative to the Observer Design Pattern

, 13 Jul 2009 CPOL
Re-usable implementation of the Propagator Design Pattern in C#, a potentially more powerful alternative to the well-known Observer Design Pattern.
namespace PropagatorDemo
{
    partial class ColorControl
    {
        /// <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 Component 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.groupBox = new System.Windows.Forms.GroupBox();
            this.panelColor = new System.Windows.Forms.Panel();
            this.buttonSelectColor = new System.Windows.Forms.Button();
            this.labelExample = new System.Windows.Forms.Label();
            this.groupBox.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox
            // 
            this.groupBox.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.groupBox.Controls.Add(this.labelExample);
            this.groupBox.Controls.Add(this.buttonSelectColor);
            this.groupBox.Controls.Add(this.panelColor);
            this.groupBox.Location = new System.Drawing.Point(3, 3);
            this.groupBox.Name = "groupBox";
            this.groupBox.Size = new System.Drawing.Size(232, 186);
            this.groupBox.TabIndex = 0;
            this.groupBox.TabStop = false;
            this.groupBox.Text = "Color Control";
            // 
            // panelColor
            // 
            this.panelColor.Location = new System.Drawing.Point(13, 23);
            this.panelColor.Name = "panelColor";
            this.panelColor.Size = new System.Drawing.Size(84, 42);
            this.panelColor.TabIndex = 0;
            // 
            // buttonSelectColor
            // 
            this.buttonSelectColor.Location = new System.Drawing.Point(15, 70);
            this.buttonSelectColor.Name = "buttonSelectColor";
            this.buttonSelectColor.Size = new System.Drawing.Size(100, 40);
            this.buttonSelectColor.TabIndex = 1;
            this.buttonSelectColor.Text = "Select color...";
            this.buttonSelectColor.UseVisualStyleBackColor = true;
            this.buttonSelectColor.Click += new System.EventHandler(this.buttonSelectColor_Click);
            // 
            // labelExample
            // 
            this.labelExample.AutoSize = true;
            this.labelExample.Location = new System.Drawing.Point(12, 133);
            this.labelExample.Name = "labelExample";
            this.labelExample.Size = new System.Drawing.Size(94, 13);
            this.labelExample.TabIndex = 2;
            this.labelExample.Text = "This is an example";
            // 
            // ColorControl
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.groupBox);
            this.Name = "ColorControl";
            this.Size = new System.Drawing.Size(238, 192);
            this.groupBox.ResumeLayout(false);
            this.groupBox.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox;
        private System.Windows.Forms.Label labelExample;
        private System.Windows.Forms.Button buttonSelectColor;
        private System.Windows.Forms.Panel panelColor;
    }
}

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)

Share

About the Author

Martijn Boeker
Software Developer (Senior) Phi International
Canada Canada
Grew up in Amsterdam, now living in downtown Vancouver. There are definitely more mountains here.
 
My first internship was with the first company in the Netherlands to teach C++ (www.datasim.nl). During this internship I got to know Object Oriented Design, which kept my interest until this day. In the mean time, I have worked for different companies in the Netherlands and Canada. I have done most of my recent work in C#, developing Database/Web/Desktop applications.
 
I am currently working as a freelance Software Developer for PHI International in Amsterdam.
 
The CodeProject rocks!

| Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 14 Jul 2009
Article Copyright 2009 by Martijn Boeker
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid