123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #region --------------- Copyright Dresser Wayne Pignone -------------
- /*
- * $Log: /Wrk/WayneLibraries/Wrk/StateEngine/Description/ImageDescriptionAttribute.cs $
- *
- * 4 08-03-10 15:02 Mattias.larsson
- * Changed parameter to GetDefaultImageFileName().
- *
- * 3 08-03-07 10:01 Mattias.larsson
- * Added StateMachineDefaultMainImage.
- *
- * 2 07-03-29 9:10 Mattias.larsson
- */
- #endregion
- using System;
- namespace Wayne.Lib.StateEngine
- {
- /// <summary>
- /// Adds a document image describing this state.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
- public sealed class ImageDescriptionAttribute : Attribute
- {
- #region Fields
- private string imageFileName;
- private string description;
- #endregion
- #region Construction
- /// <summary>
- /// Description of an image with its default file name and no description.
- /// </summary>
- public ImageDescriptionAttribute()
- {
- this.description = "";
- this.imageFileName = "";
- }
- /// <summary>
- /// Description of an image with its default file name.
- /// </summary>
- /// <param name="imageFileName">The file name of the image.
- /// Keep null or empty to use default state image filename.</param>
- public ImageDescriptionAttribute(string imageFileName)
- {
- this.imageFileName = imageFileName;
- this.description = "";
- }
- /// <summary>
- /// Description of an image given a file name.
- /// </summary>
- /// <param name="imageFileName">The file name of the image.
- /// Keep null or empty to use default state image filename.</param>
- /// <param name="description">A descriptive text for the image.</param>
- public ImageDescriptionAttribute(string imageFileName, string description)
- {
- this.imageFileName = imageFileName;
- this.description = description;
- }
- #endregion
- #region Properties
- /// <summary>
- /// The file name of the image.
- /// </summary>
- public string ImageFileName
- {
- get { return imageFileName; }
- }
- /// <summary>
- /// A descriptive text for the image.
- /// </summary>
- public string Description
- {
- get { return description; }
- }
- /// <summary>
- /// Gets the default filename (including relative path and extension) given a state.
- /// </summary>
- /// <param name="factoryName"></param>
- /// <returns></returns>
- public static string GetDefaultImageFileName(string factoryName)
- {
- return string.Concat(factoryName, DefaultImageFileExtension);
- }
- /// <summary>
- /// The default image filename extension.
- /// </summary>
- /// <returns></returns>
- public static string DefaultImageFileExtension
- {
- get { return ".png"; }
- }
- /// <summary>
- /// The default filename of the main image of the StateMachine.
- /// </summary>
- /// <returns></returns>
- public static string StateMachineDefaultMainImage
- {
- get { return string.Concat("MainStates", DefaultImageFileExtension); }
- }
- #endregion
- }
- }
|