PageRenderTime 213ms CodeModel.GetById 98ms app.highlight 5ms RepoModel.GetById 109ms app.codeStats 0ms

/IZWebFileManager/SpecialFolder.cs

http://izwebfilemanager.googlecode.com/
C# | 94 lines | 65 code | 14 blank | 15 comment | 4 complexity | e1076cfba36b14c00a749c3e5a928477 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
17using System;
18using System.Collections.Generic;
19using System.Text;
20using System.Web.UI;
21using System.Collections;
22using System.Web.UI.WebControls;
23using System.Collections.ObjectModel;
24using System.ComponentModel;
25using System.Diagnostics.CodeAnalysis;
26using System.Drawing.Design;
27
28namespace IZ.WebFileManager
29{
30	public sealed class SpecialFolder : IStateManager
31	{
32		readonly StateBag bag = new StateBag ();
33
34		[DefaultValue ("")]
35		public string DirectoryPath {
36			get { return bag ["DirectoryPath"] == null ? String.Empty : (string) bag ["DirectoryPath"]; }
37			set { bag ["DirectoryPath"] = value; }
38		}
39
40		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
41		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
42		[DefaultValue ("")]
43		[UrlProperty]
44		[Bindable (true)]
45		public string SmallImageUrl {
46			get { return bag ["SmallIconUrl"] == null ? String.Empty : (string) bag ["SmallIconUrl"]; }
47			set { bag ["SmallIconUrl"] = value; }
48		}
49
50		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
51		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
52		[DefaultValue ("")]
53		[UrlProperty]
54		[Bindable (true)]
55		public string LargeImageUrl {
56			get { return bag ["LargeIconUrl"] == null ? String.Empty : (string) bag ["LargeIconUrl"]; }
57			set { bag ["LargeIconUrl"] = value; }
58		}
59
60		[DefaultValue ("Root Folder")]
61		public string Text {
62			get { return bag ["Text"] == null ? "Root Folder" : (string) bag ["Text"]; }
63			set { bag ["Text"] = value; }
64		}
65
66		public override string ToString () {
67			return DirectoryPath;
68		}
69
70		#region IStateManager Members
71
72		bool IStateManager.IsTrackingViewState {
73			get { return ((IStateManager) bag).IsTrackingViewState; }
74		}
75
76		void IStateManager.LoadViewState (object state) {
77			((IStateManager) bag).LoadViewState (state);
78		}
79
80		object IStateManager.SaveViewState () {
81			return ((IStateManager) bag).SaveViewState ();
82		}
83
84		void IStateManager.TrackViewState () {
85			((IStateManager) bag).TrackViewState ();
86		}
87
88		#endregion
89
90		internal void SetDirty () {
91			bag.SetDirty (true);
92		}
93	}
94}