Click here to Skip to main content
11,640,866 members (63,039 online)
Click here to Skip to main content
Add your own
alternative version

SVG Artiste - An SVG Editor

, 3 Aug 2010 CPOL 37.4K 7.5K 73
A Vector based tool to create and edit SVG images
SVGArtiste2_exe.zip
SvgArtiste.exe
SvgArtiste.vshost.exe.manifest
SVGLib.dll
Crom.Controls.dll
Draw.dll
SVGArtiste2_SampleSVGDrawings.zip
mercialago18.svg
SVGArtiste.svg
SVGArtiste2_src.zip
SVGLib
SVGLib.csproj.user
SVGLib.ndoc
SvgArtiste2.suo
Crom.Controls
Dock16x16.bmp
Internal
Docking
ControlCollections
Controls
DockButtons
Forms
Engine
Enums
EventArgs
Helpers
SharedHelpers
Properties
Public
Docking
Enums
EventArgs
Helpers
Renderers
TabbedDocument
Controls
Enums
Helpers
Renderers
Base
Draw
Command
Draw.csproj.user
RulerControl
Ruler.bmp
SvgArtiste2
Properties
Settings.settings
Resources
cancel.png
Ellipse.cur
exit.png
exit1.png
Line.cur
new.png
new_page.png
open.png
open1.png
pan.cur
pan_close.cur
Pencil.cur
Rectangle.cur
save.png
save_as.png
save_as1.png
Text.cur
SVGArtiste.csproj.user
Tools
Forms
UserControls
/***************************************************************************
 *   CopyRight (C) 2009 by Cristinel Mazarine                              *
 *   Author:   Cristinel Mazarine                                          *
 *   Contact:  cristinel@osec.ro                                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the Crom Free License as published by           *
 *   the SC Crom-Osec SRL; version 1 of the License                        *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   Crom Free License for more details.                                   *
 *                                                                         *
 *   You should have received a copy of the Crom Free License along with   *
 *   this program; if not, write to the contact@osec.ro                    *
 ***************************************************************************/

using System;

namespace Crom.Controls
{
   /// <summary>
   /// Implementation of disposable objects
   /// </summary>
   public abstract class Disposable : IDisposable
   {
      #region Fields

      private bool         _isDisposing            = false;
      private bool         _isDisposed             = false;

      #endregion Fields

      #region Instance

      /// <summary>
      /// Default constructor
      /// </summary>
      protected Disposable()
      {
      }

      /// <summary>
      /// Destructor
      /// </summary>
      ~Disposable()
      {
         DisposeInstance(false);
      }

      #endregion Instance

      #region Public section

      /// <summary>
      /// Event raised when disposing was initiated for current instance by call to IDisposable.Dispose
      /// </summary>
      public event EventHandler ExplicitDisposing;

      /// <summary>
      /// Event raised when disposing was initiated for current instance by GC
      /// </summary>
      public event EventHandler GCDisposing;

      /// <summary>
      /// Event raised after current instance is disposed
      /// </summary>
      public event EventHandler Disposed;

      /// <summary>
      /// Flag indicating that current instance is disposed
      /// </summary>
      public bool IsDisposed
      {
         get { return _isDisposed; }
         private set { _isDisposed = value; }
      }

      /// <summary>
      /// Dispose current instance
      /// </summary>
      public void Dispose()
      {
         DisposeInstance(true);
         GC.SuppressFinalize(this);
      }

      #endregion Public section

      #region Protected section

      /// <summary>
      /// Dispose the current instance
      /// </summary>
      /// <param name="fromIDisposableDispose">dispose was called from IDisposable.Dispose</param>
      protected abstract void Dispose(bool fromIDisposableDispose);

      /// <summary>
      /// Validate that current instance is not disposed
      /// </summary>
      /// <exception cref="ObjectDisposedException">exception thrown if the current instance is disposed</exception>
      protected void ValidateNotDisposed()
      {
         if (IsDisposed)
         {
            throw new ObjectDisposedException(GetType().Name);
         }
      }

      #endregion Protected section

      #region Private section

      /// <summary>
      /// Dispose current instance
      /// </summary>
      /// <param name="fromIDisposableDispose">dispose was called from IDisposable.Dispose</param>
      private void DisposeInstance(bool fromIDisposableDispose)
      {
         if (_isDisposing)
         {
            return;
         }

         if (IsDisposed == false)
         {
            _isDisposing = true;

            EventHandler disposingHandler = ExplicitDisposing;
            if (fromIDisposableDispose == false)
            {
               disposingHandler = GCDisposing;
            }

            try
            {
               if (disposingHandler != null)
               {
                  disposingHandler(this, EventArgs.Empty);
               }

               Dispose(fromIDisposableDispose);
            }
            finally
            {
               IsDisposed   = true;
               _isDisposing = false;

               EventHandler disposedHandler = Disposed;
               if (disposedHandler != null)
               {
                  disposedHandler(this, EventArgs.Empty);
               }
            }
         }
      }

      #endregion Private section
   }
}

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

Ajay Britto
Engineer
Singapore Singapore
He is a Microsoft technology enthusiast, who wish to create applications which others find useful.He loves making small tools and getting involved in architecting bigger systems.

He is currently working as a professional developer in a software development firm in .Net technologies.

He likes reading technical blogs, contributing to opensource and most importantly, enjoying life.

His ambition is to be an impressive software maker.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150731.1 | Last Updated 3 Aug 2010
Article Copyright 2010 by Ajay Britto
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid