void SelectLog(int tmpIndex) { var vm = OutputManager.SelectLog(tmpIndex); Debug.Assert(vm != null); if (vm == null) { return; } vm.FocusedElement?.Focus(); // Must use Loaded prio or the normal text editor could get focus Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => { if (OutputManager.SelectedOutputBufferVM == vm) { vm.FocusedElement?.Focus(); } })); }
OutputContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, Lazy <IOutputManagerInternal> outputVM) { this.outputControl = new OutputControl(); this.vmOutput = outputVM; themeManager.ThemeChanged += ThemeManager_ThemeChanged; wpfCommandManager.Add(CommandConstants.GUID_OUTPUT_CONTROL, outputControl); var cmds = wpfCommandManager.GetCommands(CommandConstants.GUID_OUTPUT_CONTROL); cmds.Add(ApplicationCommands.Save, (s, e) => OutputManager.SaveText(), (s, e) => e.CanExecute = OutputManager.CanSaveText); cmds.Add(OutputCommands.CopyCommand, (s, e) => OutputManager.Copy(), (s, e) => e.CanExecute = OutputManager.CanCopy); cmds.Add(OutputCommands.CopyCommand, ModifierKeys.Control, Key.C); cmds.Add(OutputCommands.ClearAllCommand, (s, e) => OutputManager.ClearAll(), (s, e) => e.CanExecute = OutputManager.CanClearAll); cmds.Add(OutputCommands.ClearAllCommand, ModifierKeys.Control, Key.L); cmds.Add(OutputCommands.ToggleWordWrapCommand, (s, e) => OutputManager.WordWrap = !OutputManager.WordWrap, (s, e) => e.CanExecute = true); cmds.Add(OutputCommands.ToggleShowLineNumbersCommand, (s, e) => OutputManager.ShowLineNumbers = !OutputManager.ShowLineNumbers, (s, e) => e.CanExecute = true); cmds.Add(OutputCommands.ToggleShowTimestampsCommand, (s, e) => OutputManager.ShowTimestamps = !OutputManager.ShowTimestamps, (s, e) => e.CanExecute = true); for (int i = 0; i < OutputCommands.SelectLogWindowCommands.Length; i++) { int tmpIndex = i; cmds.Add(OutputCommands.SelectLogWindowCommands[i], (s, e) => SelectLog(tmpIndex), (s, e) => e.CanExecute = OutputManager.CanSelectLog(tmpIndex)); } outputControl.PreviewKeyDown += OutputControl_PreviewKeyDown; }
void ThemeManager_ThemeChanged(object sender, ThemeChangedEventArgs e) => OutputManager.RefreshThemeFields();
public NotPresentOutputWriter(OutputManager outputManager, Guid guid) { this.outputManager = outputManager; this.guid = guid; }