Click here to Skip to main content
11,719,973 members (85,547 online)
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 56.3K 741 38
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.Windows.Forms;

namespace IssueVision
{
	public class MiddlePane : UserControl, IObserver
	{
		private IssueList issueList;
		private CheckBox chkShowClosed;
		private Label labelShowClosed;
		private SectionHeader header;
		private PaneCaption PaneCaption1;
		
		private IssueSubject m_subject;
		
		// the IssueID of the currently selected row
		private int m_selectedID;
		
		// currently selected row, used to reselect the row
		// if the issue list is updated
		private DataRowView m_selectedRow;
		
		private IContainer components = null;

		public ISubject Subject
		{
			set
			{
				m_subject = (IssueSubject)value;
				
				// the issue list needs the subject to determine if a
				// row is in the conflict state
				issueList.Subject = m_subject;
				m_subject.IssueDataChanged += new IssueSubject.IssueDataChangedEventHandler(this.Subject_IssueDataChanged);
			}
		}

		public MiddlePane()
		{
			InitializeComponent();
		}

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

		[DebuggerStepThroughAttribute()]
		private void InitializeComponent()
		{
			PaneCaption1 = new PaneCaption();
			header = new SectionHeader();
			labelShowClosed = new Label();
			chkShowClosed = new CheckBox();
			issueList = new IssueList();
			header.SuspendLayout();
			SuspendLayout();
			
			PaneCaption1.Caption = "Issues";
			PaneCaption1.Dock = DockStyle.Top;
			PaneCaption1.Font = new Font("Tahoma", 12.0F, FontStyle.Bold);
			PaneCaption1.Location = new Point(1, 1);
			PaneCaption1.Name = "PaneCaption1";
			PaneCaption1.Size = new Size(318, 31);
			PaneCaption1.TabIndex = 15;
			
			header.Controls.Add(labelShowClosed);
			header.Controls.Add(chkShowClosed);
			header.Dock = DockStyle.Top;
			header.Location = new Point(1, 32);
			header.Name = "header";
			header.Size = new Size(318, 20);
			header.TabIndex = 16;
			
			labelShowClosed.Anchor = AnchorStyles.Top | AnchorStyles.Right;
			labelShowClosed.BackColor = Color.Transparent;
			labelShowClosed.Location = new Point(200, 4);
			labelShowClosed.Name = "labelShowClosed";
			labelShowClosed.Size = new Size(112, 14);
			labelShowClosed.TabIndex = 2;
			labelShowClosed.Text = "Show Closed Issues";
			labelShowClosed.Click += new EventHandler(this.labelShowClosed_Click);
			
			chkShowClosed.Anchor = AnchorStyles.Top | AnchorStyles.Right;
			chkShowClosed.BackColor = Color.Transparent;
			chkShowClosed.Checked = true;
			chkShowClosed.CheckState = CheckState.Checked;
			chkShowClosed.FlatStyle = FlatStyle.System;
			chkShowClosed.Location = new Point(184, 4);
			chkShowClosed.Name = "chkShowClosed";
			chkShowClosed.Size = new Size(13, 13);
			chkShowClosed.TabIndex = 1;
			chkShowClosed.CheckedChanged += new EventHandler(this.chkShowClosed_CheckedChanged);
			
			issueList.AutoScroll = true;
			issueList.Dock = DockStyle.Fill;
			issueList.Location = new Point(1, 52);
			issueList.Name = "issueList";
			issueList.Size = new Size(318, 355);
			issueList.TabIndex = 17;
			issueList.SelectionChanged += new ExpandableList.SelectionChangedEventHandler(this.issueList_SelectionChanged);
			issueList.SelectionDoubleClicked += new ExpandableList.SelectionDoubleClickedEventHandler(this.issueList_SelectionDoubleClicked);
			
			AutoScroll = true;
			Controls.Add(issueList);
			Controls.Add(header);
			Controls.Add(PaneCaption1);
			DockPadding.All = 1;
			Name = "MiddlePane";
			Size = new Size(320, 408);
			header.ResumeLayout(false);
			ResumeLayout(false);
		}

		// a new row was selected
		private void issueList_SelectionChanged(DataRowView dr)
		{
			if (dr == null)
			{
				m_selectedID = 0;
			}
			else
			{
				m_selectedID = (int)dr["IssueID"];
			}
			
			m_selectedRow = dr;
			m_subject.CurrentItem = dr;
		}

		// show edit form for selected row
		private void issueList_SelectionDoubleClicked(DataRowView dr)
		{
			IssueEditForm f = new IssueEditForm((Form)TopLevelControl);
			f.Subject = m_subject;
			f.Show();
		}

		// the main data source has been updated
		private void Subject_IssueDataChanged(object sender, EventArgs e)
		{
			Cursor = Cursors.WaitCursor;
			
			//repopulate the list
			issueList.GroupList.Clear();
			issueList.DataSource = m_subject.CurrentView;
			int prevGroupID = 0;
			
			//go through and create the different groups
			foreach (DataRowView row in m_subject.CurrentView)
			{
				int groupID = (int)row["IssueTypeID"];
				if (groupID != prevGroupID)
				{
					// came across a new group
					issueList.GroupList.Add(new GroupItem((string)row["IssueType"], groupID.ToString()));
					prevGroupID = groupID;
				}
			}
			
			//done populating the list, tell it to layout everything
			issueList.LayoutSections();
			
			if (issueList.GroupList.Count == 0)
			{
				issueList.SelectEmptyRow(true);
			}
			else 
			{
				// select the current row, if that does not exist,
				// select the first row in the first group
				if (!issueList.SelectRow(m_selectedRow, true))
				{
					issueList.SelectFirstRow(true);
				}
			}
			
			Cursor = Cursors.Default;
		}

		private void labelShowClosed_Click(object sender, EventArgs e)
		{
			// the checkbox control does not support transparency (with System FlatStyle), 
			// use a label control instead, clicking on the label should	be the same 
			// as clicking on the checkbox
			chkShowClosed.Checked = !(chkShowClosed.Checked);
			chkShowClosed_CheckedChanged(Parent, EventArgs.Empty);
		}

		private void chkShowClosed_CheckedChanged(object sender, EventArgs e)
		{
			if (m_subject != null)
			{
				m_subject.ShowClosedIssues = chkShowClosed.Checked;
			}
		}
	}
}

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

You may also be interested in...

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