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

Learn How to Build a Provider Framework - With an Easy to Understand Example Towards Applying the Provider Pattern

, 20 Jul 2007
After reading this article, you'll be able to: (1) Change your mindset a little bit, and start thinking about 'frameworks' instead of just 'code' (2) Understand a lot about practically applying the Provider pattern in your projects (3) Gain much knowledge regarding XML config files and providers.
publisher.zip
Sumeru.Publisher
bin
Debug
Sumeru.Publisher.dll
obj
Debug
temp
TempPE
Publisher.xsx
Sumeru.Publisher.csproj.user
Sumeru.Publisher.FTPPublisher
bin
Debug
Sumeru.Publisher.dll
Sumeru.Publisher.FTPPublisher.dll
obj
Debug
temp
TempPE
Sumeru.Publisher.FTPPublisher.csproj.user
Sumeru.Publisher.Loader
App.ico
bin
Debug
Sumeru.Publisher.dll
Sumeru.Publisher.FTPPublisher.dll
Sumeru.Publisher.Loader.exe
obj
Debug
temp
TempPE
Sumeru.Publisher.Loader.csproj.user
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using Sumeru.Publisher.Framework;

namespace Sumeru.Publisher.Loader
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button btnLoad;
		private System.Windows.Forms.TextBox txtFileToLoad;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <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.txtFileToLoad = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.btnLoad = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// txtFileToLoad
			// 
			this.txtFileToLoad.Location = new System.Drawing.Point(8, 40);
			this.txtFileToLoad.Name = "txtFileToLoad";
			this.txtFileToLoad.Size = new System.Drawing.Size(352, 20);
			this.txtFileToLoad.TabIndex = 0;
			this.txtFileToLoad.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(144, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "File To Load";
			// 
			// btnLoad
			// 
			this.btnLoad.Location = new System.Drawing.Point(248, 80);
			this.btnLoad.Name = "btnLoad";
			this.btnLoad.Size = new System.Drawing.Size(112, 24);
			this.btnLoad.TabIndex = 2;
			this.btnLoad.Text = "Load";
			this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(370, 130);
			this.Controls.Add(this.btnLoad);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.txtFileToLoad);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Name = "Form1";
			this.Text = "Loader";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
            this.txtFileToLoad.Text = Application.StartupPath + "\\PluginConfig.xml";
		}

		private void btnLoad_Click(object sender, System.EventArgs e)
		{
			PublisherLoader pl=new PublisherLoader();
			pl.LoadPublisher(this.txtFileToLoad.Text);
		}
	}
}

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)

About the Author


| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 20 Jul 2007
Article Copyright 2007 by Anoop Madhusudanan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid