PageRenderTime 190ms CodeModel.GetById 90ms app.highlight 10ms RepoModel.GetById 88ms app.codeStats 0ms

/IZWebFileManager/HandlersAndEventArgs.cs

http://izwebfilemanager.googlecode.com/
C# | 255 lines | 157 code | 63 blank | 35 comment | 4 complexity | 7f38b8481eb0e0941142cac11a54e0a3 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.ComponentModel;
 21using System.IO;
 22using System.Web;
 23using System.Web.UI.WebControls;
 24using System.Collections.ObjectModel;
 25
 26namespace IZ.WebFileManager
 27{
 28	//public delegate void RenameCancelEventHandler(object sender, RenameCancelEventArgs e);
 29	//public class RenameCancelEventArgs : FileManagerCancelEventArgs
 30	//{
 31	//    internal RenameCancelEventArgs() { }
 32	//}
 33
 34	//public delegate void RenameEventHandler(object sender, RenameEventArgs e);
 35	//public class RenameEventArgs : EventArgs
 36	//{
 37	//    internal RenameEventArgs() { }
 38	//}
 39
 40	//public delegate void ExecuteCommandEventHandler(object sender, ExecuteCommandEventArgs e);
 41	public class ExecuteCommandEventArgs : CommandEventArgs
 42	{
 43		internal ExecuteCommandEventArgs (string commandName, object argument) : base (commandName, argument) { }
 44
 45		private string clientScript = "";
 46
 47		public string ClientScript {
 48			get { return clientScript == null ? String.Empty : clientScript; }
 49			set { clientScript = value; }
 50		}
 51
 52		private Collection<FileManagerItemInfo> items = new Collection<FileManagerItemInfo> ();
 53
 54		public Collection<FileManagerItemInfo> Items {
 55			get { return items; }
 56		}
 57
 58	}
 59
 60	//public delegate void RenameCancelEventHandler(object sender, RenameCancelEventArgs e);
 61	public class RenameCancelEventArgs : FileManagerCancelEventArgs
 62	{
 63		internal RenameCancelEventArgs () { }
 64
 65		private FileManagerItemInfo fileManagerItem;
 66
 67		public FileManagerItemInfo FileManagerItem {
 68			get { return fileManagerItem; }
 69			internal set { fileManagerItem = value; }
 70		}
 71
 72		private string newName;
 73
 74		public string NewName {
 75			get { return newName; }
 76			set { newName = value; }
 77		}
 78
 79	}
 80
 81	//public delegate void RenameEventHandler(object sender, RenameEventArgs e);
 82	public class RenameEventArgs : EventArgs
 83	{
 84		internal RenameEventArgs () { }
 85
 86		private FileManagerItemInfo fileManagerItem;
 87
 88		public FileManagerItemInfo FileManagerItem {
 89			get { return fileManagerItem; }
 90			internal set { fileManagerItem = value; }
 91		}
 92
 93	}
 94
 95
 96	//public delegate void NewFolderCancelEventHandler(object sender, NewFolderCancelEventArgs e);
 97	public class NewFolderCancelEventArgs : FileManagerCancelEventArgs
 98	{
 99		internal NewFolderCancelEventArgs () { }
100
101		private FileManagerItemInfo destDir;
102
103		public FileManagerItemInfo DestinationDirectory {
104			get { return destDir; }
105			internal set { destDir = value; }
106		}
107	}
108
109	//public delegate void NewFolderEventHandler(object sender, NewFolderEventArgs e);
110	public class NewFolderEventArgs : EventArgs
111	{
112		internal NewFolderEventArgs () { }
113
114		private FileManagerItemInfo newFolder;
115
116		public FileManagerItemInfo NewFolder {
117			get { return newFolder; }
118			internal set { newFolder = value; }
119		}
120
121
122	}
123
124	//public delegate void NewDocumentEventHandler(object sender, NewDocumentEventArgs e);
125	public class NewDocumentEventArgs : EventArgs
126	{
127		internal NewDocumentEventArgs () { }
128		private NewDocumentTemplate template;
129
130		public NewDocumentTemplate Template {
131			get { return template; }
132			internal set { template = value; }
133		}
134
135		private FileManagerItemInfo newDocument;
136
137		public FileManagerItemInfo NewDocument {
138			get { return newDocument; }
139			internal set { newDocument = value; }
140		}
141
142
143	}
144
145	//public delegate void NewDocumentCancelEventHandler(object sender, NewDocumentCancelEventArgs e);
146	public class NewDocumentCancelEventArgs : FileManagerCancelEventArgs
147	{
148
149		internal NewDocumentCancelEventArgs () { }
150		private NewDocumentTemplate template;
151
152		public NewDocumentTemplate Template {
153			get { return template; }
154			internal set { template = value; }
155		}
156
157		private FileManagerItemInfo destDir;
158
159		public FileManagerItemInfo DestinationDirectory {
160			get { return destDir; }
161			internal set { destDir = value; }
162		}
163	}
164
165	public enum SelectedItemsAction { Move, Copy, Delete }
166
167	public class SelectedItemsActionCancelEventArgs : FileManagerCancelEventArgs
168	{
169		private SelectedItemsAction _action;
170		public SelectedItemsAction Action {
171			get { return _action; }
172		}
173
174		internal SelectedItemsActionCancelEventArgs (SelectedItemsAction action) {
175			_action = action;
176		}
177
178		private Collection<FileManagerItemInfo> items = new Collection<FileManagerItemInfo> ();
179
180		public Collection<FileManagerItemInfo> SelectedItems {
181			get { return items; }
182			//internal set { items = value; }
183		}
184		private FileManagerItemInfo destDir;
185
186		public FileManagerItemInfo DestinationDirectory {
187			get { return destDir; }
188			internal set { destDir = value; }
189		}
190
191	}
192	public class SelectedItemsActionEventArgs : EventArgs
193	{
194		internal SelectedItemsActionEventArgs () { }
195	}
196	//public delegate void UploadFileCancelEventHandler(object sender, UploadFileCancelEventArgs e);
197	public class UploadFileCancelEventArgs : FileManagerCancelEventArgs
198	{
199
200		internal UploadFileCancelEventArgs () { }
201
202		private FileManagerItemInfo destDir;
203
204		public FileManagerItemInfo DestinationDirectory {
205			get { return destDir; }
206			internal set { destDir = value; }
207		}
208
209		private HttpPostedFile postedFile;
210
211		public HttpPostedFile PostedFile {
212			get { return postedFile; }
213			internal set { postedFile = value; }
214		}
215
216		private string saveName;
217
218		public string SaveName {
219			get { return (saveName == null || saveName.Length == 0) ? Path.GetFileName (PostedFile.FileName) : saveName; }
220			set { saveName = value; }
221		}
222
223	}
224
225	//public delegate void UploadFileEventHandler(object sender, UploadFileEventArgs e);
226	public class UploadFileEventArgs : EventArgs
227	{
228
229		internal UploadFileEventArgs () { }
230
231		private FileManagerItemInfo uploadedFile;
232
233		public FileManagerItemInfo UploadedFile {
234			get { return uploadedFile; }
235			internal set { uploadedFile = value; }
236		}
237	}
238
239	public class DownloadFileCancelEventArgs : CancelEventArgs
240	{
241		public FileManagerItemInfo DownloadFile { get; internal set; }
242	}
243
244	public class FileManagerCancelEventArgs : CancelEventArgs
245	{
246		private string clientMessage;
247
248		public string ClientMessage {
249			get { return clientMessage; }
250			set { clientMessage = value; }
251		}
252
253	}
254
255}