public DirectoryChangedEventArgs(Uri path, IDisplayInterfaceControl control) {
			Path = path;
			Control = control;
			
			DisplayPath = CommonUtil.FileSystem.DisplayPath(path);
			ShortPath = CommonUtil.FileSystem.ShortPath(path);
		}
		public static void LoadFile(Uri path, IDisplayInterfaceControl control) {
			if(FileSystem.HandlesDirectory(path)) LoadDirectory(path, control, true);
			
			FileSystem.LoadFile(path);
		}
		public static void PasteButtonClicked(IDisplayInterfaceControl control, IFileOperationProgress progress) {
			ClipboardHandler handler = PrimaryClipboardHandler;
			if(handler == null) return;
			handler.RequestPaths(delegate(object sender, EventArgs e) {
				ClipboardData data = handler.PastePaths();
				if(data.Paths.Count > 0) {
					switch(data.Operation) {
						case ClipboardOperationType.Copy:
							FileSystem.CopyAsync(data.Paths.ToArray(), (from uri in data.Paths select FileSystem.CopyOperationDestination(uri, control.CurrentLocation)).ToArray(), progress);
							break;
						
						case ClipboardOperationType.Cut:
							break;
					}
				}
			});
		}
		public static void CopyButtonClicked(IDisplayInterfaceControl control) {
			ClipboardHandler handler = PrimaryClipboardHandler;
			if(handler == null) return;
			IEnumerable<XeFileInfo> files = control.SelectedFiles;
			if(files.Count() > 0) handler.ExposePaths(new ClipboardData(from file in files select file.FullPath, ClipboardOperationType.Copy));
		}
		public static void RefreshButtonClicked(IDisplayInterfaceControl control) {
			LoadDirectory(control.CurrentLocation, control, false);
		}
		public static void ComputerButtonClicked(IDisplayInterfaceControl control) {
			LoadDirectory("about:computer", control);
		}
		public TabOpenedEventArgs(IDisplayInterfaceControl control) {
			Control = control;
		}
		private static void LoadDirectory(Uri path, IDisplayInterfaceControl control, bool handleHistory) {
			Thread thread = new Thread(delegate() {
				XeFileInfo[] files = FileSystem.DirectoryListing(ref path);
				if(files == null || path == null) return;
				if(handleHistory) {
					if(control.CurrentLocation != null) control.HistoryBack.Push(control.CurrentLocation);
					control.CurrentLocation = path;
				}
				control.SetContent(files, path);
			});
			thread.Start();
		}
		public static bool HasParentDirectory(IDisplayInterfaceControl control) {
			return FileSystem.ParentDirectoryFor(control.CurrentLocation) != null;
		}
		public static void ForwardButtonClicked(IDisplayInterfaceControl control) {
			if(control.CurrentLocation == null || control.HistoryForward.Count == 0) return;
			control.HistoryBack.Push(control.CurrentLocation);
			control.CurrentLocation = control.HistoryForward.Pop();
			LoadDirectory(control.CurrentLocation, control, false);
		}
		public static bool HasForwardHistory(IDisplayInterfaceControl control) {
			return control.HistoryForward.Count != 0;
		}
		public static bool HasBackHistory(IDisplayInterfaceControl control) {
			return control.HistoryBack.Count != 0;
		}
			public FileSystemUpdateEventArgs(IDisplayInterfaceControl control) {
				Control = control;
			}
		public static void LoadDirectory(string text, IDisplayInterfaceControl control) {
			if(text == "/") text = "file:///";
			Uri path = new Uri(text);
			LoadDirectory(path, control);
		}
		public static void ParentButtonClicked(IDisplayInterfaceControl control) {
			Uri path = FileSystem.ParentDirectoryFor(control.CurrentLocation);
			if(path == null) return;
			LoadDirectory(path, control);
		}
		public static void LoadDirectory(Uri path, IDisplayInterfaceControl control) {
			LoadDirectory(path, control, true);
		}
		public static void HomeButtonClicked(IDisplayInterfaceControl control) {
			try {
				LoadDirectory((Uri)SettingsUtil.MainSettings["home"].data, control);
			}
			catch(Exception ex) { Console.WriteLine(ex); }
		}
		public static void TabChanged(IDisplayInterfaceControl control) {
			NotifyDirectoryChanged(control, new DirectoryChangedEventArgs(control.CurrentLocation, control));
		}
		protected void OnDirectoryChanged(object sender, DirectoryChangedEventArgs e) {
			((TabLabel)nb.GetTabLabel((Widget)e.Control)).TextLabel.Text = e.ShortPath;
			locationBar.Text = e.DisplayPath;
			
			SetActionStates();
			IDisplayInterfaceControl[] controls = new IDisplayInterfaceControl[nb.NPages];
			for(int i = 0; i < nb.NPages; ++i) { controls[i] = (IDisplayInterfaceControl)nb.GetNthPage(i); }
			CommonUtil.FileSystem.UpdateWatchList(controls);
		}