Click here to Skip to main content
11,573,618 members (52,997 online)
Click here to Skip to main content
Add your own
alternative version

Implement an Autoplay Handler

, 18 Sep 2006 CPOL 74K 1.4K 78
Implementing an Autoplay handler in C#.
autoplaydemo_demo.zip
Almdal.RegistryScript.dll
Almdal.SharedPipes.dll
AutoPlayDemo.exe
AutoPlayListener.dll
autoplaydemo_src.zip
AutoPlayDemo
Autoplay.ico
AutoPlayDemo.csproj.user
bin
Properties
Settings.settings
Resources
AutoPlayListener
Autoplay.ico
AutoPlayListener.snk
bin
Properties
Resources
Autoplay.ico
RegistryScript
Almdal.RegistryScript.snk
bin
Properties
SharedPipies
Almdal.SharedPipes.snk
bin
Properties
using System;
using System.Collections.Generic;
using System.Text;

/***************************************************************************
 * The code in this class was originally developed by Marc Clifton in
 * the article: http://www.codeproject.com/csharp/idispose.asp.  All
 * I can take credit for is implementing it as a  class that can be used as 
 * a base class to encapsulate the Disposable Implementation
 ***************************************************************************/
namespace Almdal.SharedPipes {
	public class IDisposableImpl : IDisposable {
		private bool _disposed = false;
		#region Destructor
		~IDisposableImpl() {
			Dispose(false);
		}
		#endregion

		#region IDisposable Members
		public void Dispose() {
			Dispose(true);

			GC.SuppressFinalize(this);
		}
		#endregion

		protected void Dispose(bool disposeManagedResources) {
			// process only if mananged and unmanaged resources have
			// not been disposed of.
			if (!_disposed) {
				if (disposeManagedResources) {
					// dispose managed resources
					DisposeManagedResources();
				}
				// dispose unmanaged resources
				DisposeUnmanagedResources();
				_disposed = true;
			}
		}

		protected virtual void DisposeUnmanagedResources() { }

		protected virtual void DisposeManagedResources() { }
	}
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Tim Almdal
Canada Canada
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150624.2 | Last Updated 18 Sep 2006
Article Copyright 2006 by Tim Almdal
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid