Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » XML » Web Services » Downloads
 
Add your own
alternative version

Implementing WS-SecureConversation in Microsoft IssueVision

, 27 Sep 2005
Adding secure communications to the Microsoft IssueVision sample application using WSE 2.0.
issuevisionwsesmartclient.zip
Database
IssueVision
Controls
Outlook
Images
statusbar
toolbar
types
Libraries
ThreadHelper Documentation
Panes
Patterns
Web References
localhost
IssueVisionWebWseCS
Libraries
App.ico
IssueVision.csproj.user
IssueVision.snk
IssueVisionServices.disco
IssueVisionServices.wsdl
Reference.map
AppUpdater.dll
ThreadHelper.dll
About BackgroundWorker.doc
Async Windows Forms Programming with BackgroundWorker.doc
IssueVision-about-banner.png
mosaic-light.png
Signin.png
all_staffers.png
all_types.png
computer.png
environmental.png
help_desk.png
network.png
none.png
printer.png
staff.png
technicians.png
technicians_group.png
telecom.png
new_task.png
synchronize.png
work_offline.png
StatusConnected.ico
StatusDisconnected.ico
StatusSynchronizing.ico
IssueVisionWebWseCS.csproj.webinfo
IVDataSet.xsx
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Resources;
using System.Windows.Forms;

namespace IssueVision
{
	// The IssueTreeView user control implements the view selection ui for IssueVision
	public class IssueTreeView : UserControl, IObserver
	{
		// icons that can appear in the treeview
		private enum TypeIcon
		{
			None = 0,
			AllStaffers = 1,
			Staff = 2,
			Technician = 3
		}
		
		private TreeView trvViews;
		private ImageList images;
		
		private IssueSubject m_subject = null;
		private const string m_fontname = "Tahoma";

		private IContainer components;
		
		public virtual ISubject Subject
		{
			set
			{
				m_subject = (IssueSubject)value;
				m_subject.LookupDataChanged += new IssueSubject.LookupDataChangedEventHandler(this.Subject_LookupDataChanged);
				m_subject.ConflictDataChanged += new IssueSubject.ConflictDataChangedEventHandler(this.Subject_ConflictDataChanged);
			}
		}

		public IssueTreeView()
		{
			InitializeComponent();
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		[DebuggerStepThroughAttribute()]
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(IssueTreeView));
			this.trvViews = new System.Windows.Forms.TreeView();
			this.images = new System.Windows.Forms.ImageList(this.components);
			this.SuspendLayout();
			// 
			// trvViews
			// 
			this.trvViews.AllowDrop = true;
			this.trvViews.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.trvViews.Dock = System.Windows.Forms.DockStyle.Fill;
			this.trvViews.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			this.trvViews.HideSelection = false;
			this.trvViews.ImageList = this.images;
			this.trvViews.Location = new System.Drawing.Point(1, 1);
			this.trvViews.Name = "trvViews";
			this.trvViews.Size = new System.Drawing.Size(190, 334);
			this.trvViews.TabIndex = 9;
			this.trvViews.AfterSelect += new TreeViewEventHandler(this.trvViews_AfterSelect);
			// 
			// images
			// 
			this.images.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
			this.images.ImageSize = new System.Drawing.Size(16, 16);
			this.images.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("images.ImageStream")));
			this.images.TransparentColor = System.Drawing.Color.Magenta;
			// 
			// IssueTreeView
			// 
			this.Controls.Add(this.trvViews);
			this.DockPadding.All = 1;
			this.Name = "IssueTreeView";
			this.Size = new System.Drawing.Size(192, 336);
			base.Load += new EventHandler(this.IssueTreeView_Load);
			this.ResumeLayout(false);
		}
		
		private void Subject_LookupDataChanged(object sender, EventArgs e)
		{
			TreeNode staffersNode = trvViews.Nodes[0];
			staffersNode.Nodes.Clear();
			
			foreach (DataRow row in m_subject.Staffers.Rows)
			{
				TreeNode stafferNode = new TreeNode((string)row["DisplayName"]);
				stafferNode.Tag = (int)row["StafferID"];
				
				int icon = (int)GetIconType((string)row["StafferType"]);
				
				stafferNode.ImageIndex = icon;
				stafferNode.SelectedImageIndex = icon;
				staffersNode.Nodes.Add(stafferNode);
			}
			
			trvViews.Nodes[0].ExpandAll();
		}

		private void Subject_ConflictDataChanged(object sender, EventArgs e)
		{
			if (m_subject.HasConflicts)
			{
				trvViews.Nodes[1].Text = "Conflicts (" + m_subject.Conflicts.Rows.Count + ")    ";
				trvViews.Nodes[1].NodeFont = new Font(m_fontname, 8.0F, FontStyle.Bold);
			}
			else
			{
				trvViews.Nodes[1].Text = "Conflicts  ";
				trvViews.Nodes[1].NodeFont = new Font(m_fontname, 8.0F, FontStyle.Bold);
			}
		}

		private void IssueTreeView_Load(object sender, EventArgs e)
		{
			trvViews.Nodes.AddRange(new TreeNode[]{new TreeNode("All Staffers", 1, 1), new TreeNode("Conflicts  ", 4, 4)});
			trvViews.Nodes[1].NodeFont = new Font(m_fontname, 8.0F, FontStyle.Bold);
			
			trvViews.SelectedNode = trvViews.Nodes[0];
		}

		private void trvViews_AfterSelect(object sender, TreeViewEventArgs e)
		{
			if (m_subject != null)
			{
				if (e.Node.Text.StartsWith("Conflicts"))
				{
					m_subject.SetFilter("Conflicts", string.Empty, string.Empty);
				}
				else if (e.Node.Text == "All Staffers")
				{
					m_subject.SetFilter("Issues", string.Empty, string.Empty);
				}
				else
				{
					m_subject.SetFilter("Issues", "StafferID", e.Node.Tag.ToString());
				}
			}
		}

		private int GetIconType(string type)
		{
			switch (type)
			{
				case "H":
					return (int)TypeIcon.Staff;
				case "T":
					return (int)TypeIcon.Technician;
			}

			return (int)TypeIcon.None;
		}		
	}
}

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

Weidong Shen
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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141220.1 | Last Updated 27 Sep 2005
Article Copyright 2005 by Weidong Shen
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid