- Crystal_Image_Toolkit-1_0_1.zip
- Attilan
- Crystal
- Crystal Toolkit Demos
- BorderSplitModeDemo
- ComicShowControllerDemo
- CrystalGradientPanelDemo
- CrystalPictureBoxDemo
- CrystalPictureShowDemo
- CrystalTrackBarDemo
- HeaderImageGridDemo
- PictureShowControllerDemo
- SimpleImageGridDemo
- TestAttilanTransparent
- WaitFormPictureShow
- ZoomImageGrid
- Crystal Toolkit
- Collectors
- Controllers
- CrystalToolkit.csproj
- CrystalToolkit.csproj.user
- Diagrams
- ClassDiagram1.cd
- FactoryDiagram.cd
- MVCDiagram.cd
- PictureControlDiagram.cd
- Display controls
- Interfaces
- Misc controls
- Model objects
- open_source_code
- Properties
- Resources
- collapsed.png
- CrystalTrackBar.bmp
- DefaultImage.bmp
- expanded.png
- folder.png
- Hand.cur
- imagegridicon.bmp
- OpenHand.cur
- pictureshowicon.png
- thumbDisabled.bmp
- thumbNormal.bmp
- thumbNormalHot.bmp
- thumbNormalWarm.bmp
- thumbToolstrip.bmp
- thumbToolstripDisabled.bmp
- thumbToolstripHot.bmp
- thumbToolstripWarm.bmp
- Tracker.cur
- StringResources.Designer.cs
- StringResources.resx
- Tool classes
- CrystalDemo.csproj
- CrystalDemo.sln
- release_notes.txt
|
#region gnu_license
/*
Crystal Controls - C# control library containing the following tools:
CrystalControl - base class
CrystalGradientControl - a control that can either have a gradient background or be totally transparent.
CrystalLabel - a homegrown label that can have a gradient or transparent background.
CrystalPanel - a panel that can have a gradient or transparent background.
CrystalTrackBar - a homegrown trackbar that can have a gradient or transparent background.
CrystalToolStripTrackBar - a host for CrystalTrackBar that allows it to work in a ToolStrip.
CrystalImageGridView - a control that hosts thumbnail images in a virtual grid.
CrystalImageGridModel - a data model that holds a collection of CrystalImageItems
to feed to CrystalImageGridView.
CrystalImageItem - a class that describes an Image file.
CrystalThumbnailer - provides thumbnailing methods for images.
CrystalCollector - a base class for a controller that links
CrystalImageGridView to the CrystalImageGridModel.
CrystalFileCollector - a controller that works on disk-based Image files.
CrystalDesignCollector - a controller that works in Visual Studio toolbox designer.
CrystalMemoryCollector - a controller that can be used to add images from memory.
CrystalMemoryZipCollector - a controller that accesses images in zip files by streaming them into memory.
CrystalZipCollector - a controller that accesses images in zip files by unpacking them.
CrystalRarCollector - a controller that accesses images in rar files by unpacking them.
CrystalPictureBox - a picture box control, derived from CrystalGradientControl.
CrystalPictureShow - a control for viewing images and processing slideshows.
CrystalComicShow - a control for viewing comic-book images in the CDisplay format.
Copyright (C) 2006, 2008 Richard Guion
Attilan Software Factory: http://www.attilan.com
Contact: richard@attilan.com
Version 1.0.0
This is a work in progress: USE AT YOUR OWN RISK! Interfaces/Methods may change!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#endregion
using System;
using System.ComponentModel;
namespace Attilan.Tools
{
/// <summary>
/// Helper class to call EventHandlers with a level of thread safety.
/// </summary>
public static class EventNotifier
{
/// <summary>
/// Updates a single event handler with thread safety.
/// </summary>
/// <param name="singleCast">EventHandler object.</param>
/// <param name="eventArgs">Event arguments to dispatch to the event handler.</param>
/// <param name="sender">Object sending the message.</param>
public static void UpdateSingleEventHandler(EventHandler singleCast,
EventArgs eventArgs, object sender)
{
if (singleCast == null)
{
return;
}
ISynchronizeInvoke syncInvoke =
singleCast.Target as ISynchronizeInvoke;
//try
//{
if ((syncInvoke != null) && (syncInvoke.InvokeRequired))
syncInvoke.Invoke(singleCast,
new object[] { sender, eventArgs });
else
singleCast(sender, eventArgs);
//}
//catch (Exception ex)
//{
// CrystalLogger.LogException("Exception in UpdateSingleEventHandler: {0}", ex);
//}
/*
if (singleCast.Target is Control)
{
Control targetControl = (Control)singleCast.Target;
if ((targetControl != null) && (targetControl.IsHandleCreated))
targetControl.Invoke(singleCast, new object[] { sender, eventArgs });
}
else
{
singleCast(sender, eventArgs);
}
*/
}
/// <summary>
/// Updates all delegates in the event handler's invocation list with a level of thread safety.
/// </summary>
/// <param name="masterHandler">Event Handler object containing an invocation list.</param>
/// <param name="args">Event arguments to dispatch.</param>
/// <param name="sender">Object sending the message.</param>
public static void UpdateSubscribers(EventHandler masterHandler, EventArgs args, object sender)
{
if (masterHandler != null)
{
// makes the method thread safe. I get a local copy of the event handler and make sure
// that even if somebody modifies the Event there won't be any trouble.
EventHandler handler = masterHandler;
foreach (EventHandler singleCast in handler.GetInvocationList())
{
UpdateSingleEventHandler(singleCast, args, sender);
}
}
}
}
}
|
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.
Richard has been working with Windows software since 1991. He has worked for Borland, Microsoft, Oracle, and various startup companies such as Livescribe. Currently he is developing projects in C#, Windows Forms, and Net Framework. Visit his blog Attilan (
www.attilan.com) to learn more about his tools, projects and discoveries.