PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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. using System;
  17. using System.Collections.Generic;
  18. using System.Text;
  19. using System.ComponentModel;
  20. using System.IO;
  21. using System.Web;
  22. using System.Web.UI.WebControls;
  23. using System.Collections.ObjectModel;
  24. namespace IZ.WebFileManager
  25. {
  26. //public delegate void RenameCancelEventHandler(object sender, RenameCancelEventArgs e);
  27. //public class RenameCancelEventArgs : FileManagerCancelEventArgs
  28. //{
  29. // internal RenameCancelEventArgs() { }
  30. //}
  31. //public delegate void RenameEventHandler(object sender, RenameEventArgs e);
  32. //public class RenameEventArgs : EventArgs
  33. //{
  34. // internal RenameEventArgs() { }
  35. //}
  36. //public delegate void ExecuteCommandEventHandler(object sender, ExecuteCommandEventArgs e);
  37. public class ExecuteCommandEventArgs : CommandEventArgs
  38. {
  39. internal ExecuteCommandEventArgs (string commandName, object argument) : base (commandName, argument) { }
  40. private string clientScript = "";
  41. public string ClientScript {
  42. get { return clientScript == null ? String.Empty : clientScript; }
  43. set { clientScript = value; }
  44. }
  45. private Collection<FileManagerItemInfo> items = new Collection<FileManagerItemInfo> ();
  46. public Collection<FileManagerItemInfo> Items {
  47. get { return items; }
  48. }
  49. }
  50. //public delegate void RenameCancelEventHandler(object sender, RenameCancelEventArgs e);
  51. public class RenameCancelEventArgs : FileManagerCancelEventArgs
  52. {
  53. internal RenameCancelEventArgs () { }
  54. private FileManagerItemInfo fileManagerItem;
  55. public FileManagerItemInfo FileManagerItem {
  56. get { return fileManagerItem; }
  57. internal set { fileManagerItem = value; }
  58. }
  59. private string newName;
  60. public string NewName {
  61. get { return newName; }
  62. set { newName = value; }
  63. }
  64. }
  65. //public delegate void RenameEventHandler(object sender, RenameEventArgs e);
  66. public class RenameEventArgs : EventArgs
  67. {
  68. internal RenameEventArgs () { }
  69. private FileManagerItemInfo fileManagerItem;
  70. public FileManagerItemInfo FileManagerItem {
  71. get { return fileManagerItem; }
  72. internal set { fileManagerItem = value; }
  73. }
  74. }
  75. //public delegate void NewFolderCancelEventHandler(object sender, NewFolderCancelEventArgs e);
  76. public class NewFolderCancelEventArgs : FileManagerCancelEventArgs
  77. {
  78. internal NewFolderCancelEventArgs () { }
  79. private FileManagerItemInfo destDir;
  80. public FileManagerItemInfo DestinationDirectory {
  81. get { return destDir; }
  82. internal set { destDir = value; }
  83. }
  84. }
  85. //public delegate void NewFolderEventHandler(object sender, NewFolderEventArgs e);
  86. public class NewFolderEventArgs : EventArgs
  87. {
  88. internal NewFolderEventArgs () { }
  89. private FileManagerItemInfo newFolder;
  90. public FileManagerItemInfo NewFolder {
  91. get { return newFolder; }
  92. internal set { newFolder = value; }
  93. }
  94. }
  95. //public delegate void NewDocumentEventHandler(object sender, NewDocumentEventArgs e);
  96. public class NewDocumentEventArgs : EventArgs
  97. {
  98. internal NewDocumentEventArgs () { }
  99. private NewDocumentTemplate template;
  100. public NewDocumentTemplate Template {
  101. get { return template; }
  102. internal set { template = value; }
  103. }
  104. private FileManagerItemInfo newDocument;
  105. public FileManagerItemInfo NewDocument {
  106. get { return newDocument; }
  107. internal set { newDocument = value; }
  108. }
  109. }
  110. //public delegate void NewDocumentCancelEventHandler(object sender, NewDocumentCancelEventArgs e);
  111. public class NewDocumentCancelEventArgs : FileManagerCancelEventArgs
  112. {
  113. internal NewDocumentCancelEventArgs () { }
  114. private NewDocumentTemplate template;
  115. public NewDocumentTemplate Template {
  116. get { return template; }
  117. internal set { template = value; }
  118. }
  119. private FileManagerItemInfo destDir;
  120. public FileManagerItemInfo DestinationDirectory {
  121. get { return destDir; }
  122. internal set { destDir = value; }
  123. }
  124. }
  125. public enum SelectedItemsAction { Move, Copy, Delete }
  126. public class SelectedItemsActionCancelEventArgs : FileManagerCancelEventArgs
  127. {
  128. private SelectedItemsAction _action;
  129. public SelectedItemsAction Action {
  130. get { return _action; }
  131. }
  132. internal SelectedItemsActionCancelEventArgs (SelectedItemsAction action) {
  133. _action = action;
  134. }
  135. private Collection<FileManagerItemInfo> items = new Collection<FileManagerItemInfo> ();
  136. public Collection<FileManagerItemInfo> SelectedItems {
  137. get { return items; }
  138. //internal set { items = value; }
  139. }
  140. private FileManagerItemInfo destDir;
  141. public FileManagerItemInfo DestinationDirectory {
  142. get { return destDir; }
  143. internal set { destDir = value; }
  144. }
  145. }
  146. public class SelectedItemsActionEventArgs : EventArgs
  147. {
  148. internal SelectedItemsActionEventArgs () { }
  149. }
  150. //public delegate void UploadFileCancelEventHandler(object sender, UploadFileCancelEventArgs e);
  151. public class UploadFileCancelEventArgs : FileManagerCancelEventArgs
  152. {
  153. internal UploadFileCancelEventArgs () { }
  154. private FileManagerItemInfo destDir;
  155. public FileManagerItemInfo DestinationDirectory {
  156. get { return destDir; }
  157. internal set { destDir = value; }
  158. }
  159. private HttpPostedFile postedFile;
  160. public HttpPostedFile PostedFile {
  161. get { return postedFile; }
  162. internal set { postedFile = value; }
  163. }
  164. private string saveName;
  165. public string SaveName {
  166. get { return (saveName == null || saveName.Length == 0) ? Path.GetFileName (PostedFile.FileName) : saveName; }
  167. set { saveName = value; }
  168. }
  169. }
  170. //public delegate void UploadFileEventHandler(object sender, UploadFileEventArgs e);
  171. public class UploadFileEventArgs : EventArgs
  172. {
  173. internal UploadFileEventArgs () { }
  174. private FileManagerItemInfo uploadedFile;
  175. public FileManagerItemInfo UploadedFile {
  176. get { return uploadedFile; }
  177. internal set { uploadedFile = value; }
  178. }
  179. }
  180. public class DownloadFileCancelEventArgs : CancelEventArgs
  181. {
  182. public FileManagerItemInfo DownloadFile { get; internal set; }
  183. }
  184. public class FileManagerCancelEventArgs : CancelEventArgs
  185. {
  186. private string clientMessage;
  187. public string ClientMessage {
  188. get { return clientMessage; }
  189. set { clientMessage = value; }
  190. }
  191. }
  192. }