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

Developing Next Generation Smart Clients using .NET 2.0 working with Existing .NET 1.1 SOA-based XML Web Services

, 16 Aug 2005
Comprehensive guide to development of .NET 2.0 Smart Clients working with existing Service Oriented Architecture based XML web services, fully utilizing the Enterprise Library
smartclientsoa_src.zip
SmartClient
Client
SMI.App
Controls
Forms
Modules
Properties
app.manifest
Settings.settings
Resources
240.png
Bottom.png
BuilderDialog_delete.bmp
DarkBlue.bmp
download-xp.gif
Earth.png
fldropen.png
iSync.gif
Leonardo_da_Vinci_My_Computer.png
LightBlue.bmp
LoginBox.jpg
LoginButton.jpg
LoginButton1.jpg
LoginButton2.jpg
Logo1.png
LogoPic.jpg
Middle.png
Refresh.bmp
refresh.ico
refresh1.ico
RightArrow.bmp
SuccessComplete.bmp
Task.bmp
Tasks.png
Top.png
TurnOffButton.bmp
wi0062-32.ico
wi0063-32.ico
wi0064-16.ico
wi0064-32.ico
SmartInstitute.App.csproj.user
wi0064-32.ico
SMI.Automation
Commands
Course
Framework
Security
Students
UI
Controls
Documents
MiscDocuments
StudentDocuments
Factories
Forms
Helpers
Misc
Properties
Settings.settings
Resources
BuilderDialog_delete.bmp
LogoSmall.bmp
Misho.jpg
My Pic 7.jpg
table.ico
SmartInstitute.Automation.csproj.user
Web References
SmartInstituteServices.AccountService
Account.datasource
AccountService.disco
AccountService.wsdl
Reference.map
SmartInstituteServices.CourseService
Course.datasource
CourseService.disco
CourseService.wsdl
Reference.map
SmartInstituteServices.SecurityService
Reference.map
SecurityService.disco
SecurityService.wsdl
SmartInstituteServices.StudentService
Reference.map
Student.datasource
StudentService.disco
StudentService.wsdl
SMI.ObjectModel.Enhanced
Base
Models
Properties
Settings.settings
Settings
SmartInstitute.ObjectModel.csproj.user
UMS.ObjectModel.Enhanced.csproj.user
SMI.Objects
SmartInstitute.csproj.user
CodeSmith
Tier
BusinessLogicLayer
Entity.cst
EntityBase.cst
EntityCollection.cst
EntityCollectionBase.cst
Enum.cst
IEntity.cst
DataAccessLayer
App.config.cst
CommonSql.cst
Configuration.cst
DBConcurrencyException.cst
DBException.cst
Factories
EntityRepositoryFactory.cst
IEntityRepository.cst
SqlClient
CVS
Entries
Entries.Extra
Entries.Extra.Old
Entries.Old
Repository
Root
TortoiseCVS.Status
SqlEntityRepository.cst
SqlEntityRepositoryBase.cst
TransactionManager.cst
UnitTests
EntityRepositoryTest.cst
WebServiceClient
WsEntityRepository.cst
WsEntityRepositoryBase.cst
Main.cst
nant.cst
References
GotDotNet.ApplicationBlocks.Data.dll
Microsoft.ApplicationBlocks.Data.dll
nunit.framework.dll
StoredProcedures.cst
vsnet2003.project.cst
vsnet2003.solution.cst
vsnet2005.project.cst
vsnet2005.solution.cst
WebService
Web.config.cst
WebService.cst
Database
SmartInstitute.bak
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
nunit.core.dll
nunit.framework.dll
Server
BLL
SmartInstitute.csproj.user
DAL
Factories
SmartInstitute.DataAccessLayer.csproj.user
SqlClient
Utilities
GotDotNet.ApplicationBlocks.Data.dll
Microsoft.ApplicationBlocks.Data.dll
nunit.framework.dll
UnitTests
SmartInstitute.build
SmartInstitute.Facade
FacadeTest
SmartInstitute.Facade.csproj.user
SmartInstitute.Test
App.ico
SmartInstitute.Test.csproj.user
SmartInstituteServices
Global.asax
log
SmartInstituteServices.csproj.webinfo
SQL
Setup
SecurityDatabase
SecurityDatabaseConsole
App.ico
SecurityDatabaseConsole.exe.manifest
SR.strings
Tests
Tools.SecurityDatabaseConsole.csproj.user
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace SmartInstitute.Client.Automation.Controls
{
	/// <summary>
	/// An XP style Activity Bar.
	/// </summary>
	public class ActivityBar : System.Windows.Forms.UserControl
	{
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private ColorBlend cb;
		private Timer t;
		private int tickCount;

		private Color _barColor = Color.Orange;
		/// <summary>
		/// Determines the main color for the activity bar
		/// </summary>
		[Description("Determines the main color for the activity bar."), 
		Category("Appearance")]
		public Color BarColor
		{
			get { return _barColor;}
			set 
			{
				_barColor = value; 
				ColorPropertyChanged();
			}
		}

		private Color _borderColor= SystemColors.ActiveBorder;
		/// <summary>
		/// Determines the color for the activity bar border
		/// </summary>
		[Description("Determines the color for the activity bar border."), 
		Category("Appearance")]
		public Color BorderColor
		{
			get { return _borderColor;}
			set 
			{
				_borderColor = value; 
				ColorPropertyChanged();
			}
		}

		private Color _highlightColor = Color.White;
		/// <summary>
		/// Determines the highlight color for the activity bar
		/// </summary>
		[Description("Determines the highlight color for the activity bar."), 
		Category("Appearance")]
		public Color HighlightColor
		{
			get { return _highlightColor;}
			set 
			{ 
				_highlightColor = value; 
				ColorPropertyChanged();
			}
		}

		/// <summary>
		/// Default constructor
		/// </summary>
		public ActivityBar()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
			// set double buffer styles
			SetStyle(ControlStyles.ResizeRedraw, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			SetStyle(ControlStyles.ContainerControl, true);
			SetStyle(ControlStyles.SupportsTransparentBackColor, true);

			this.BackColor = Color.Transparent;				
			UpdateStyles();
			
			BuildColorBlend();

			
		}

		private void BuildColorBlend()
		{
			cb = new ColorBlend(7);
			cb.Colors  = new Color[] {
										 _barColor, 
										 _barColor,
										 _barColor,
										 _highlightColor, 
										 _highlightColor, 
										 _barColor, 
										 _barColor};

			cb.Positions = new float[] {
										   0.0f, 
										   0.01f,
										   0.2f, 
										   0.4f, 
										   0.6f, 
										   0.8f, 
										   1.0f};
		}

		private void ColorPropertyChanged()
		{
			BuildColorBlend();
			this.Refresh();
		}

		/// <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 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.SuspendLayout();
			// 
			// ActivityBar
			// 
			this.Name = "ActivityBar";
			this.Size = new System.Drawing.Size(440, 12);
			this.ResumeLayout(false);

		}
		#endregion

		protected override void OnPaint(PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			LinearGradientBrush lBrush = new LinearGradientBrush(this.ClientRectangle, Color.White, Color.Orange,
				LinearGradientMode.Horizontal);
			lBrush.InterpolationColors = cb;
			g.FillRectangle(lBrush, 1, 1, this.Width - 2, this.Height - 2);
			Brush b = new SolidBrush(_borderColor);
			Pen p = new Pen(b, 1);
			g.DrawRectangle(p, 0, 0, this.Width - 1, this.Height - 1);
			p.Dispose();
			b.Dispose();
			lBrush.Dispose();
		}

		protected override void OnPaintBackground(PaintEventArgs pevent)
		{
			// Make sure the background isn't erased, to reduce flicker

			//base.OnPaintBackground (pevent);
		}

		/// <summary>
		/// Performs the color rotation in the activity bar
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void t_Tick(object sender, EventArgs e)
		{
			// Each color segment gets "scrolled" 20 positions to the right
			// then the colors get moved to the right in the colorblend array
			// and the deltas reset
			if (++tickCount >= 20)
			{
				tickCount = 0;
				Color last = cb.Colors[6];
				for (int i = 6; i>0; i--)
				{
					cb.Colors[i] = cb.Colors[i-1];
				}
				cb.Colors[0] = last;
			}

			// get color advance delta
			float f = tickCount / 100.0f;

			// advance colors
			cb.Positions[1] = 0.01f + f;
			cb.Positions[2] = 0.2f + f;
			cb.Positions[3] = 0.4f + f;
			cb.Positions[4] = 0.6f + f;
			cb.Positions[5] = 0.8f + f;
			//redraw controls
			this.Refresh();   
		}

		public void Start()
		{
			if (null == t)
			{
				t = new Timer();
				t.Interval = 50;
				t.Tick += new EventHandler(t_Tick);

				t.Enabled = true;
				t.Start();
			}
		}

		public void Stop()
		{
			if (null != t)
			{
				t.Stop();
				t.Enabled = false;

				t.Tick -= new EventHandler(t_Tick);
				t.Dispose();

				t = null;
			}
		}
	}
}

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

Share

About the Author


| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 17 Aug 2005
Article Copyright 2005 by Omar Al Zabir
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid