static ToolStripItem BuildMove(TrackedMove move, Action accept) { var menu = new SplitButton($"{move.Name} ({move.Extension})", accept); menu.AddRange( new MenuButton("Accept move", accept), new MenuButton("Open diff tool", () => DiffToolLauncher.Launch(move)), BuildShowInExplorer(move.Temp)); return(menu); }
public static void Launch(TrackedMove move) { var process = move.Process; if (process != null) { if (!process.HasExited) { if (SetForegroundWindow(process.MainWindowHandle)) { return; } } } if (move.CanKill) { process?.Kill(); } process?.Dispose(); move.Process = null; ProcessStartInfo startInfo = new(move.Exe !, move.Arguments !) { UseShellExecute = true }; try { process = Process.Start(startInfo); if (process != null) { move.Process = process; return; } var message = $@"Failed to launch diff tool. {move.Exe} {move.Arguments}"; Log.Error(message); } catch (Exception exception) { var message = $@"Failed to launch diff tool. {move.Exe} {move.Arguments}"; Log.Error(exception, message); } } }
static ToolStripItem BuildMove(TrackedMove move, Action accept, Action discard) { var menu = new ToolStripDropDownButton($"{move.Name} ({move.Extension})"); menu.DropDownDirection = ToolStripDropDownDirection.Left; menu.DropDownItems.Add(new MenuButton("Accept move", accept)); menu.DropDownItems.Add(new MenuButton("Discard", discard)); if (move.Exe != null) { menu.DropDownItems.Add(new MenuButton("Open diff tool", () => DiffToolLauncher.Launch(move))); } menu.DropDownItems.Add(BuildShowInExplorer(move.Temp)); return(menu); }
public static void Launch(TrackedMove move) { var startInfo = new ProcessStartInfo(move.Exe, move.Arguments) { UseShellExecute = true }; using var process = Process.Start(startInfo); if (process != null) { move.AddProcess(process.Id, process.StartTime); return; } var message = $@"Failed to launch diff tool. {move.Exe} {move.Arguments}"; Log.Error(message); }
public static void Launch(TrackedMove move) { var process = move.Process; if (process is { HasExited : false })