private async void ToolStripButtonClicked(object sender, EventArgs e) { ToolStripButton button = (ToolStripButton)sender; string path = button.Tag.ToString(); Directory directory = await BrickExplorer.GetDirectory(path); DirectoryAction?.Invoke(this, directory, ActionType.OPEN); }
private void Tree_MouseDown(object sender, MouseEventArgs e) { TreeViewHitTestInfo info = tree.HitTest(e.Location); if (info != null && info.Node != null) { if (e.Button == MouseButtons.Left) { DirectoryAction?.Invoke(this, (Directory)info.Node.Tag, ActionType.OPEN); } } }
private void Invoke(ListViewItem item, ActionType actionType) { if (item != null && item.Tag != null) { if (item.Tag is Directory) { DirectoryAction?.Invoke(this, (Directory)item.Tag, actionType); } else if (item.Tag is File) { FileAction?.Invoke(this, (File)item.Tag, actionType); } } }
private void CopyInner(string sourcePath, string destPath, string[][] ignoredPaths) { if (!Provider.DirectoryExists(destPath)) { DirectoryAction?.Invoke(sourcePath, destPath); } var ignoredSubPaths = ignoredPaths .Where(x => x.Length > 1) .Select(x => x.Skip(1).ToArray()) .ToArray(); foreach (var path in Provider.GetDirectories(sourcePath)) { var path_name = Path.GetFileName(path) ?? string.Empty; var isIgnored = ignoredPaths.Select(x => x[0]) .Any(x => string.Equals(path_name, x, StringComparison.OrdinalIgnoreCase)); if (isIgnored) { continue; } var destSubPath = Path.Combine(destPath, path_name); CopyInner(path, destSubPath, ignoredSubPaths.ToArray()); } var errorList = new List <Exception>(); foreach (var file in Provider.GetFiles(sourcePath)) { var file_name = Path.GetFileName(file); var destFile = Path.Combine(destPath, file_name); try { FileAction?.Invoke(file, destFile); } catch (Exception error) { errorList.Add(error); } } if (errorList.Any()) { throw new AggregateException(errorList); } }
private void InvokeContextMenu(ActionType actionType) { switch ((EntryType)contextMenuStrip.Tag) { case EntryType.FILE: { FileAction?.Invoke(this, SelectedFile, actionType); break; } case EntryType.DIRECTORY: { DirectoryAction?.Invoke(this, SelectedDirectory, actionType); break; } } }
public void ExecForDirectory(string par1) { DirectoryAction.Invoke(par1, Parameter); }
private void UploadDirectoryToolStripMenuItem_Click(object sender, System.EventArgs e) { DirectoryAction?.Invoke(this, null, ActionType.UPLOAD_DIRECTORY); }
private void NewDirectoryToolStripMenuItem_Click(object sender, System.EventArgs e) { DirectoryAction?.Invoke(this, null, ActionType.CREATE_DIRECTORY); }