void OnDelete(object sender, MenuEventArgs e) { var lines = History.Update(null); if (lines.Length == _menu.Items.Count) { e.Ignore = true; } else { e.Restart = true; _menu.Selected = -1; ResetItems(lines); } }
private static void CopyHandle(object sender, MenuEventArgs args) { IPanel activePanel = Far.Api.Panel; string sourceDir = activePanel.CurrentDirectory; string destDir = Far.Api.Panel2.CurrentDirectory; foreach (var file in activePanel.SelectedFiles) { string sourceFullName = Path.Combine(sourceDir, file.Name); _queue.Add(new FileOperationParams(sourceFullName, destDir, file.Name, FileOperationType.Copy)); } Task.Factory.StartNew(WorkerThreadProc); }
void OnToggle(object sender, MenuEventArgs e) { Breakpoint bp = _menu.SelectedData as Breakpoint; if (bp == null) { e.Ignore = true; return; } if (bp.Enabled) A.DisableBreakpoint(bp); else A.InvokeCode("Enable-PSBreakpoint -Breakpoint $args[0]", bp); }
void OnEdit(object sender, MenuEventArgs e) { Breakpoint bp = _menu.SelectedData as Breakpoint; if (bp == null || string.IsNullOrEmpty(bp.Script)) { e.Ignore = true; return; } _toStop = true; IEditor editor = _editor; LineBreakpoint lbp = bp as LineBreakpoint; // the target script is opened now if (editor != null && Kit.Equals(editor.FileName, bp.Script)) { // it is a line breakpoint, go to line if (lbp != null) { editor.GoToLine(lbp.Line - 1); return; } return; } editor = Far.Api.CreateEditor(); editor.FileName = bp.Script; if (lbp != null) editor.GoToLine(lbp.Line - 1); editor.Open(); }
void OnDisableAll(object sender, MenuEventArgs e) { if (_breakpoints.Count > 0) A.DisableBreakpoint(_breakpoints); else e.Ignore = true; }
void OnDeleteAll(object sender, MenuEventArgs e) { if (_breakpoints.Count > 0) A.RemoveBreakpoint(_breakpoints); else e.Ignore = true; }
void OnDelete(object sender, MenuEventArgs e) { Breakpoint bp = _menu.SelectedData as Breakpoint; if (bp == null) { e.Ignore = true; return; } A.RemoveBreakpoint(bp); }