Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Implement an Autoplay Handler

, 18 Sep 2006
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

| Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 18 Sep 2006
Article Copyright 2006 by Tim Almdal
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid