Click here to Skip to main content
15,884,722 members
Articles / Programming Languages / C++/CLI

MaChat - a chat with a browser for LANs

Rate me:
Please Sign up or sign in to vote.
4.97/5 (27 votes)
30 Jul 200211 min read 582.1K   12.4K   119  
This article shows how to create a Chat for Local Area Networks which uses the WebBrowser control to display the messages.
// *****************************************************************************
// 
//  (c) Crownwood Consulting Limited 2002 
//  All rights reserved. The software and associated documentation 
//  supplied hereunder are the proprietary information of Crownwood Consulting 
//	Limited, Haxey, North Lincolnshire, England and are supplied subject to 
//	licence terms.
// 
//  Magic Version 1.6	www.dotnetmagic.com
// *****************************************************************************

using System;
using System.Drawing;
using System.Windows.Forms;
using Crownwood.Magic.Docking;
using Crownwood.Magic.Collections;

namespace Crownwood.Magic.Docking
{
    public class ZoneHelper
    {
		public static ContentCollection Contents(Zone z)
		{
			// Container for returned group of found Content objects
			ContentCollection cc = new ContentCollection();

			// Process each Window in the Zone
			foreach(Window w in z.Windows)
			{
				WindowContent wc = w as WindowContent;

				// Is the Zone a Content derived variation?
				if (wc != null)
				{
					// Add each Content into the collection
					foreach(Content c in wc.Contents)
						cc.Add(c);
				}
			}

			return cc;
		}

		public static StringCollection ContentNames(Zone z)
		{
			// Container for returned group of found String objects
			StringCollection sc = new StringCollection();

			// Process each Window in the Zone
			foreach(Window w in z.Windows)
			{
				WindowContent wc = w as WindowContent;

				// Is the Zone a Content derived variation?
				if (wc != null)
				{
					// Add each Content into the collection
					foreach(Content c in wc.Contents)
						sc.Add(c.Title);
				}
			}

			return sc;
		}

		public static StringCollection ContentNamesInPriority(Zone z, Content c)
		{
			// Container for returned group of found Content objects
			StringCollection sc = new StringCollection();

			// Process each Window in the Zone
			foreach(Window w in z.Windows)
			{
				WindowContent wc = w as WindowContent;

				// Is the Zone a Content derived variation?
				if (wc != null)
				{
					// Does this contain the interesting Content?
					if (wc.Contents.Contains(c))
					{
						// All Content of this Window are given priority and 
						// added into the start of the collection
						foreach(Content content in wc.Contents)
							sc.Insert(0, content.Title);
					}
					else
					{
						// Lower priority Window and so contents are always
						// added to the end of the collection
						foreach(Content content in wc.Contents)
							sc.Add(content.Title);
					}
				}
			}

			return sc;
		}
    }
}

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
Architect macmichal.pl
Poland Poland
Micheal is an independent consultant - www.macmichal.pl.
He's main areas of interest are: DDD\CqRS, TDD, SaaS, Design Patterns, Architecture. He specializes in .Net/C# for the early beginning of it and T-SQL. He's a writer, blogger (blog.macmichal.pl) and speaker.

In his spare time, he's climbing the mountains all over the Europe.

Comments and Discussions