Click here to Skip to main content
15,893,381 members
Articles / Web Development / HTML

Implementing WS-SecureConversation in Microsoft IssueVision

Rate me:
Please Sign up or sign in to vote.
4.61/5 (12 votes)
27 Sep 20056 min read 73.3K   776   38  
Adding secure communications to the Microsoft IssueVision sample application using WSE 2.0.
using System;

namespace IssueVision
{
	// The Command class is used to implement the Command pattern in IssueVision.
	// Each command manages a set of UI elements that provide a user different ways
	// of initiating the same action.  For example, an application might allow the 
	// user to Save data using the File menu, a toolbar button, and a context menu.  
	// A single Command object could manage the menu item, toolbar button and context
	// menu as a unit.
	//
	// Command objects provide a unified means of calling the action method, as well as 
	// setting the enabled state of all of the related ui elements using a single line
	// of code.
	public class Command
	{
		// The EnableChanged event is raised when the IsEnabled value of the command 
		// changes. This is handled in the Commander objects to set the Enabled property
		// of the managed controls.
		public delegate void EnableChangedEventHandler(object sender, Command.EnableChangedEventArgs e);
		public virtual event EnableChangedEventHandler EnableChanged;
		public delegate void Action();
		
		private Action m_action;
		private bool m_isEnabled = true;
		
		// The IsEnabled property is used to set/retrieve the enabled state of all UI
		// controls that the command manages
		public bool IsEnabled
		{
			get
			{
				return m_isEnabled;
			}

			set
			{
				if (m_isEnabled != value)
				{
					m_isEnabled = value;
					if (EnableChanged != null)
					{
						EnableChanged(this, new EnableChangedEventArgs(IsEnabled));
					}
				}
			}
		}

		public Command(Action action)
		{
			m_action = action;
		}

		// Invokes the method assigned to this command.
		public void Execute()
		{
			m_action();
		}
		
		// Arguments passed to the EnableChanged event.
		public class EnableChangedEventArgs : EventArgs
		{
			private bool m_isEnabled = false;

			public bool IsEnabled
			{
				get
				{
					return m_isEnabled;
				}
			}

			public EnableChangedEventArgs(bool isEnabled)
			{
				m_isEnabled = isEnabled;
			}
		}
	}
}

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


Written By
Software Developer (Senior)
United States United States
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET

Comments and Discussions