PageRenderTime 33ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/IZWebFileManager/FileManagerCommand.cs

http://izwebfilemanager.googlecode.com/
C# | 102 lines | 65 code | 15 blank | 22 comment | 5 complexity | 2802238b1cf19c7bababd2ef5c6250c3 MD5 | raw file
  1. // Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Text;
  19. using System.Web.UI;
  20. using System.Collections.ObjectModel;
  21. using System.ComponentModel;
  22. using System.Drawing.Design;
  23. using System.Diagnostics.CodeAnalysis;
  24. namespace IZ.WebFileManager
  25. {
  26. public sealed class FileManagerCommand : IStateManager
  27. {
  28. readonly StateBag bag = new StateBag ();
  29. //private FileManagerCommandTargets usage = FileManagerCommandTargets.All;
  30. //[DefaultValue(FileManagerCommandTargets.All)]
  31. //public FileManagerCommandTargets Usage
  32. //{
  33. // get { return usage; }
  34. // set { usage = value; }
  35. //}
  36. [DefaultValue ("")]
  37. public string Name {
  38. get { return bag ["Name"] == null ? String.Empty : (string) bag ["Name"]; }
  39. set { bag ["Name"] = value; }
  40. }
  41. [DefaultValue ("")]
  42. public string CommandName {
  43. get { return bag ["CommandName"] == null ? String.Empty : (string) bag ["CommandName"]; }
  44. set { bag ["CommandName"] = value; }
  45. }
  46. [DefaultValue ("")]
  47. public string CommandArgument {
  48. get { return bag ["CommandArgument"] == null ? String.Empty : (string) bag ["CommandArgument"]; }
  49. set { bag ["CommandArgument"] = value; }
  50. }
  51. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  52. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  53. [DefaultValue ("")]
  54. [UrlProperty]
  55. [Bindable (true)]
  56. public string SmallImageUrl {
  57. get { return bag ["SmallImageUrl"] == null ? String.Empty : (string) bag ["SmallImageUrl"]; }
  58. set { bag ["SmallImageUrl"] = value; }
  59. }
  60. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  61. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  62. [DefaultValue ("")]
  63. [UrlProperty]
  64. [Bindable (true)]
  65. public string LargeImageUrl {
  66. get { return bag ["LargeImageUrl"] == null ? String.Empty : (string) bag ["LargeImageUrl"]; }
  67. set { bag ["LargeImageUrl"] = value; }
  68. }
  69. internal void SetDirty () {
  70. bag.SetDirty (true);
  71. }
  72. #region IStateManager Members
  73. bool IStateManager.IsTrackingViewState {
  74. get { return ((IStateManager) bag).IsTrackingViewState; }
  75. }
  76. void IStateManager.LoadViewState (object state) {
  77. ((IStateManager) bag).LoadViewState (state);
  78. }
  79. object IStateManager.SaveViewState () {
  80. return ((IStateManager) bag).SaveViewState ();
  81. }
  82. void IStateManager.TrackViewState () {
  83. ((IStateManager) bag).TrackViewState ();
  84. }
  85. #endregion
  86. }
  87. }