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

Flexible and Plug-in-based .NET Application using Provider Pattern

, , 1 Dec 2005
This paper demonstrates creating a flexible, extensible, plug-in-based .NET application (JOM - Smart Job Manager). JOM is an asynchronous job processing engine built using the MS Provider design pattern and the .NET technology available today.
smartjobmanager.zip
Code
Bin
ClientApplication.exe
EntLibHelper.dll
log
exceptions
SmartJobManager.log
Microsoft.Practices.EnterpriseLibrary.Caching.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Configuration.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Security.ActiveDirectory.dll
Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.dll
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll
Microsoft.Practices.EnterpriseLibrary.Security.Database.Authentication.dll
Microsoft.Practices.EnterpriseLibrary.Security.Database.dll
Microsoft.Practices.EnterpriseLibrary.Security.dll
Providers.dll
SampleProviders.dll
ScreencaptureJobManagerProvider.dll
SimpleJobManagerProvider.dll
SmartJobManager.BusinessLogicLayer.dll
SmartJobManagerService.exe
ClientApplication
App.ico
bin
ClientApplication.csproj.user
EntLibHelper
bin
EntLibHelper.csproj.user
Library
Microsoft.Practices.EnterpriseLibrary.Caching.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Configuration.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Security.ActiveDirectory.dll
Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.dll
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll
Microsoft.Practices.EnterpriseLibrary.Security.Database.Authentication.dll
Microsoft.Practices.EnterpriseLibrary.Security.Database.dll
Microsoft.Practices.EnterpriseLibrary.Security.dll
Objects
bin
Release
SmartJobManager.BusinessLogicLayer.dll
SmartJobManager.csproj.user
Providers
bin
Configuration
Providers.csproj.user
System
Configuration
Providers
Providers
SampleProviders
bin
SampleProviders.csproj.user
ScreencaptureJobManagerProvider
bin
ScreencaptureJobManagerProvider.csproj.user
SimpleJobManagerProvider
bin
SimpleJobManagerProvider.csproj.user
SmartJobManagerService
bin
SmartJobManagerService.csproj.user
// =====================================================================================
// Copyright � 2005 by Shahed Khan. All rights are reserved.
// 
// If you like this code then feel free to go ahead and use it.
// The only thing I ask is that you don't remove or alter my copyright notice.
//
// Your use of this software is entirely at your own risk. I make no claims or
// warrantees about the reliability or fitness of this code for any particular purpose.
// If you make changes or additions to this code please mark your code as being yours.
// 
// website , email shahed.khan@gmail.com
// =====================================================================================


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ClientApplication
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class frmMain : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnSimpleJob;
		private System.Windows.Forms.Button btnTextToFileJob;
		private System.Windows.Forms.Button btnTextToImageJob;
		private System.Windows.Forms.Button btnCaptureImageJob;
		private System.Windows.Forms.TextBox tbText;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmMain()
		{
			//
			// 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.btnSimpleJob = new System.Windows.Forms.Button();
			this.btnTextToFileJob = new System.Windows.Forms.Button();
			this.btnTextToImageJob = new System.Windows.Forms.Button();
			this.btnCaptureImageJob = new System.Windows.Forms.Button();
			this.tbText = new System.Windows.Forms.TextBox();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.btnExit = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// btnSimpleJob
			// 
			this.btnSimpleJob.Location = new System.Drawing.Point(32, 200);
			this.btnSimpleJob.Name = "btnSimpleJob";
			this.btnSimpleJob.Size = new System.Drawing.Size(152, 23);
			this.btnSimpleJob.TabIndex = 0;
			this.btnSimpleJob.Text = "Send Simple Job";
			this.btnSimpleJob.Click += new System.EventHandler(this.btnSimpleJob_Click);
			// 
			// btnTextToFileJob
			// 
			this.btnTextToFileJob.Location = new System.Drawing.Point(32, 80);
			this.btnTextToFileJob.Name = "btnTextToFileJob";
			this.btnTextToFileJob.Size = new System.Drawing.Size(152, 23);
			this.btnTextToFileJob.TabIndex = 1;
			this.btnTextToFileJob.Text = "Send Text To File Job";
			this.btnTextToFileJob.Click += new System.EventHandler(this.btnTextToFileJob_Click);
			// 
			// btnTextToImageJob
			// 
			this.btnTextToImageJob.Location = new System.Drawing.Point(32, 112);
			this.btnTextToImageJob.Name = "btnTextToImageJob";
			this.btnTextToImageJob.Size = new System.Drawing.Size(152, 23);
			this.btnTextToImageJob.TabIndex = 2;
			this.btnTextToImageJob.Text = "Send Text To Image Job";
			this.btnTextToImageJob.Click += new System.EventHandler(this.btnTextToImageJob_Click);
			// 
			// btnCaptureImageJob
			// 
			this.btnCaptureImageJob.Location = new System.Drawing.Point(32, 232);
			this.btnCaptureImageJob.Name = "btnCaptureImageJob";
			this.btnCaptureImageJob.Size = new System.Drawing.Size(152, 23);
			this.btnCaptureImageJob.TabIndex = 3;
			this.btnCaptureImageJob.Text = "Send Screen Capture Job";
			this.btnCaptureImageJob.Click += new System.EventHandler(this.btnCaptureImageJob_Click);
			// 
			// tbText
			// 
			this.tbText.Location = new System.Drawing.Point(208, 80);
			this.tbText.Name = "tbText";
			this.tbText.Size = new System.Drawing.Size(360, 20);
			this.tbText.TabIndex = 4;
			this.tbText.Text = "Type Text Here";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Location = new System.Drawing.Point(16, 48);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(584, 112);
			this.groupBox1.TabIndex = 5;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Type Text and Send a Job";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(192, 64);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(368, 23);
			this.label4.TabIndex = 2;
			this.label4.Text = "This will write a file or image on  c:\\tmp\\  with the text you type in.";
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.LightBlue;
			this.label1.Dock = System.Windows.Forms.DockStyle.Top;
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.ForeColor = System.Drawing.Color.White;
			this.label1.Location = new System.Drawing.Point(0, 0);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(632, 40);
			this.label1.TabIndex = 6;
			this.label1.Text = "Client Test Application";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.label2);
			this.groupBox2.Location = new System.Drawing.Point(16, 176);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(584, 96);
			this.groupBox2.TabIndex = 7;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Send a Job";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(192, 56);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(368, 23);
			this.label3.TabIndex = 1;
			this.label3.Text = "This will capture the Image of your screen and write a file on  c:\\tmp\\ ";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(192, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(352, 23);
			this.label2.TabIndex = 0;
			this.label2.Text = "This will write a file on c:\\tmp\\ ";
			// 
			// btnExit
			// 
			this.btnExit.Location = new System.Drawing.Point(480, 280);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(120, 23);
			this.btnExit.TabIndex = 8;
			this.btnExit.Text = "E&xit";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// frmMain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.SystemColors.Control;
			this.ClientSize = new System.Drawing.Size(632, 318);
			this.Controls.Add(this.btnExit);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.tbText);
			this.Controls.Add(this.btnCaptureImageJob);
			this.Controls.Add(this.btnTextToImageJob);
			this.Controls.Add(this.btnTextToFileJob);
			this.Controls.Add(this.btnSimpleJob);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.groupBox2);
			this.Name = "frmMain";
			this.Text = "ClientApp";
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

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

		private void btnSimpleJob_Click(object sender, System.EventArgs e)
		{
			QueuedClient client = new QueuedClient();
			client.QueueSimpleJob();
			if (client.IsErrorExists)
				MessageBox.Show(client.ErrorMessage);
			else
				MessageBox.Show("Message Sent");
		}

		private void btnTextToFileJob_Click(object sender, System.EventArgs e)
		{
			QueuedClient client = new QueuedClient();
			client.QueueTextToFileJob(tbText.Text);
			if (client.IsErrorExists)
				MessageBox.Show(client.ErrorMessage);
			else
				MessageBox.Show("Message Sent");
		}

		private void btnTextToImageJob_Click(object sender, System.EventArgs e)
		{
			QueuedClient client = new QueuedClient();
			client.QueueTextToImageJob(tbText.Text);
			if (client.IsErrorExists)
				MessageBox.Show(client.ErrorMessage);
			else
				MessageBox.Show("Message Sent");
		}

		private void btnCaptureImageJob_Click(object sender, System.EventArgs e)
		{
			QueuedClient client = new QueuedClient();
			client.QueueScreenCaptureImageJob();
			if (client.IsErrorExists)
				MessageBox.Show(client.ErrorMessage);
			else
				MessageBox.Show("Message Sent");
		}

		private void btnExit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Authors

Shahed.Khan
Web Developer
Australia Australia
I have been awarded MVP (Visual C#) for year 2007, 2008, 2009. I am a Microsoft Certified Application Developer (C# .Net). I currently live in Melbourne, Australia. I am a co-founder and core developer of Pageflakes www.pageflakes.com and Founder of Simplexhub, a highly experienced software development company based in Melbourne Australia and Dhaka, Bangladesh. Simplexhub.
My BLOG http://www.geekswithblogs.net/shahed
http://msmvps.com/blogs/shahed/Default.aspx.

David.Grinberg

Australia Australia
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 1 Dec 2005
Article Copyright 2005 by Shahed.Khan, David.Grinberg
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid