object Create(ToolBarButtonMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var item = (IToolBarButton)md.ToolBarItem; var md2 = (IToolBarButtonMetadata)md.Metadata; var cmdHolder = item as ICommandHolder; var cmd = cmdHolder != null ? cmdHolder.Command : new RelayCommand(a => item.Execute(ctx), a => item.IsEnabled(ctx)); string header = ResourceHelper.GetString(item, md2.Header); string icon = md2.Icon; string toolTip = ResourceHelper.GetString(item, md2.ToolTip); header = item.GetHeader(ctx) ?? header; toolTip = item.GetToolTip(ctx) ?? toolTip; var imgRef = item.GetIcon(ctx) ?? ImageReferenceHelper.GetImageReference(item, icon) ?? default(ImageReference); var toggleButtonCmd = item as IToolBarToggleButton; Debug.Assert(md2.IsToggleButton == (toggleButtonCmd != null), "Implement IToolBarToggleButton if IsToggleButton is true"); if (toggleButtonCmd != null) { return(CreateToggleButton(toggleButtonCmd.GetBinding(ctx), cmd, commandTarget, header, toolTip, imgRef)); } return(new ToolBarButtonVM(cmd, commandTarget, header, toolTip, imgRef)); }
public override void Execute(IToolBarItemContext context) { Parallel.Invoke(() => { new Myform(CurrentThemeService.Theme.IsDark).Show(); }); }
public Binding GetBinding(IToolBarItemContext context) { Debug.Assert(appWindow != null && appWindow.MainWindow != null); return new Binding("IsFullScreen") { Source = appWindow.MainWindow, }; }
public Binding GetBinding(IToolBarItemContext context) { Debug.Assert(appWindow != null && appWindow.MainWindow != null); return(new Binding(nameof(appWindow.MainWindow.IsFullScreen)) { Source = appWindow.MainWindow, }); }
public override object GetUIObject(IToolBarItemContext context, IInputElement commandTarget) { if (menu == null) { menu = menuManager.CreateMenu(new Guid(MenuConstants.APP_MENU_GUID), commandTarget); } return(menu); }
public override bool IsVisible(IToolBarItemContext context) { Debug.Assert(appWindow != null && appWindow.MainWindow != null); if (!initd) { appWindow.MainWindow.IsFullScreenChanged += (s, e) => appWindow.RefreshToolBar(); initd = true; } return appWindow.MainWindow.IsFullScreen; }
public override void Execute(IToolBarItemContext context) { var res = messageBoxManager.ShowIgnorableMessage(new Guid("FC8FC68F-4285-4CDF-BEC0-FF6498EEC4AA"), dnSpy_AsmEditor_Resources.AskClearUndoHistory, MsgBoxButton.Yes | MsgBoxButton.No); if (res == null || res == MsgBoxButton.Yes) { undoCommandManager.Value.Clear(); } }
public override bool IsVisible(IToolBarItemContext context) { Debug.Assert(appWindow != null && appWindow.MainWindow != null); if (!initd) { appWindow.MainWindow.IsFullScreenChanged += (s, e) => appWindow.RefreshToolBar(); initd = true; } return(appWindow.MainWindow.IsFullScreen); }
object?Create(ToolBarItemMD md, IToolBarItemContext ctx, IInputElement?commandTarget) { if (md is ToolBarButtonMD mdButton) { return(Create(mdButton, ctx, commandTarget)); } if (md is ToolBarObjectMD mdObj) { return(Create(mdObj, ctx, commandTarget)); } Debug.Fail("Unknown TB MD"); return(null); }
object Create(ToolBarItemMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var mdButton = md as ToolBarButtonMD; if (mdButton != null) { return(Create(mdButton, ctx, commandTarget)); } var mdObj = md as ToolBarObjectMD; if (mdObj != null) { return(Create(mdObj, ctx, commandTarget)); } Debug.Fail("Unknown TB MD"); return(null); }
object Create(ToolBarButtonMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var item = (IToolBarButton)md.ToolBarItem; var md2 = (IToolBarButtonMetadata)md.Metadata; var cmdHolder = item as ICommandHolder; var cmd = cmdHolder != null ? cmdHolder.Command : new RelayCommand(a => item.Execute(ctx), a => item.IsEnabled(ctx)); string header = ResourceHelper.GetString(item, md2.Header); string icon = md2.Icon; string toolTip = ResourceHelper.GetString(item, md2.ToolTip); var item2 = item as IToolBarButton2; if (item2 != null) { header = item2.GetHeader(ctx) ?? header; icon = item2.GetIcon(ctx) ?? icon; toolTip = item2.GetToolTip(ctx) ?? toolTip; } BitmapSource imageSource = null; if (!string.IsNullOrEmpty(icon)) { imageSource = imageManager.GetImage(item.GetType().Assembly, icon, BackgroundType.ToolBar); } var toggleButtonCmd = item as IToolBarToggleButton; Debug.Assert(md2.IsToggleButton == (toggleButtonCmd != null), "Implement IToolBarToggleButton if IsToggleButton is true"); if (toggleButtonCmd != null) { return(CreateToggleButton(toggleButtonCmd.GetBinding(ctx), cmd, commandTarget, header, toolTip, imageSource)); } return(new ToolBarButtonVM(cmd, commandTarget, header, toolTip, imageSource)); }
public override void Execute(IToolBarItemContext context) => debugger.Value.DebugProgram(pauseAtEntryPoint: false);
public override void Execute(IToolBarItemContext context) => debugger.Value.StepOut();
public override bool IsEnabled(IToolBarItemContext context) => debugger.Value.CanShowNextStatement;
public virtual string GetHeader(IToolBarItemContext context) { return null; }
public virtual bool IsEnabled(IToolBarItemContext context) { return true; }
public override void Execute(IToolBarItemContext context) => MsgBox.Instance.Show("Command #1");
object Create(ToolBarButtonMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var item = (IToolBarButton)md.ToolBarItem; var md2 = (IToolBarButtonMetadata)md.Metadata; var cmdHolder = item as ICommandHolder; var cmd = cmdHolder != null ? cmdHolder.Command : new RelayCommand(a => item.Execute(ctx), a => item.IsEnabled(ctx)); string header = ResourceHelper.GetString(item, md2.Header); string icon = md2.Icon; string toolTip = ResourceHelper.GetString(item, md2.ToolTip); var item2 = item as IToolBarButton2; if (item2 != null) { header = item2.GetHeader(ctx) ?? header; icon = item2.GetIcon(ctx) ?? icon; toolTip = item2.GetToolTip(ctx) ?? toolTip; } BitmapSource imageSource = null; if (!string.IsNullOrEmpty(icon)) imageSource = imageManager.GetImage(item.GetType().Assembly, icon, BackgroundType.ToolBar); var toggleButtonCmd = item as IToolBarToggleButton; Debug.Assert(md2.IsToggleButton == (toggleButtonCmd != null), "Implement IToolBarToggleButton if IsToggleButton is true"); if (toggleButtonCmd != null) return CreateToggleButton(toggleButtonCmd.GetBinding(ctx), cmd, commandTarget, header, toolTip, imageSource); return new ToolBarButtonVM(cmd, commandTarget, header, toolTip, imageSource); }
public override void Execute(IToolBarItemContext context) { dnSpy.Shared.App.MsgBox.Instance.Show("Command #1"); }
public bool IsVisible(IToolBarItemContext context) { return true; }
public override string GetToolTip(IToolBarItemContext context) => string.Format(dnSpy_Resources.SearchAssembliesToolBarToolTip, dnSpy_Resources.ShortCutKeyCtrlShiftK);
public override bool IsEnabled(IToolBarItemContext context) { return realCommand.CanExecute(context); }
public override void Execute(IToolBarItemContext context) { realCommand.Execute(context); }
object Create(ToolBarObjectMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var item = (IToolBarObject)md.ToolBarItem; return item.GetUIObject(ctx, commandTarget); }
public override void Execute(IToolBarItemContext context) => debugger.Value.Continue();
public override bool IsEnabled(IToolBarItemContext context) { return undoCommandManager.Value.CanUndo || undoCommandManager.Value.CanRedo; }
public override bool IsEnabled(IToolBarItemContext context) => debugger.Value.CanBreakAll;
public override void Execute(IToolBarItemContext context) { var res = messageBoxManager.ShowIgnorableMessage(new Guid("FC8FC68F-4285-4CDF-BEC0-FF6498EEC4AA"), dnSpy_AsmEditor_Resources.AskClearUndoHistory, MsgBoxButton.Yes | MsgBoxButton.No); if (res == null || res == MsgBoxButton.Yes) undoCommandManager.Value.Clear(); }
/// <inheritdoc/> public override bool IsEnabled(IToolBarItemContext context) => Command.CanExecute(context);
public override void Execute(IToolBarItemContext context) { }
public override object GetUIObject(IToolBarItemContext context, IInputElement commandTarget) => comboBox;
public override object GetUIObject(IToolBarItemContext context, IInputElement commandTarget) { if (menu == null) menu = menuManager.CreateMenu(new Guid(MenuConstants.APP_MENU_GUID), commandTarget); return menu; }
public virtual string GetToolTip(IToolBarItemContext context) { return null; }
public override void Execute(IToolBarItemContext context) => debugger.Value.StopDebugging();
public override void Execute(IToolBarItemContext context) => debugger.Value.ShowNextStatement();
public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarStopDebuggingToolTip, dnSpy_Debugger_Resources.ShortCutKeyShiftF5);
public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarShowNextStatementToolTip, dnSpy_Debugger_Resources.ShortCutAltAsterisk);
public abstract object GetUIObject(IToolBarItemContext context, IInputElement commandTarget);
public override bool IsVisible(IToolBarItemContext context) => !initd || !debugger.Value.IsDebugging;
/// <inheritdoc/> public abstract object GetUIObject(IToolBarItemContext context, IInputElement commandTarget);
public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarDebugAssemblyToolTip, dnSpy_Debugger_Resources.ShortCutKeyF5);
public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Resources.OpenToolBarToolTip, dnSpy_Resources.ShortCutKeyCtrlO);
public override void Execute(IToolBarItemContext context) => debugger.Value.BreakAll();
public override object GetUIObject(IToolBarItemContext context, IInputElement?commandTarget) => comboBox;
public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarBreakAllToolTip, dnSpy_Debugger_Resources.ShortCutKeyCtrlAltBreak);
object Create(ToolBarItemMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var mdButton = md as ToolBarButtonMD; if (mdButton != null) return Create(mdButton, ctx, commandTarget); var mdObj = md as ToolBarObjectMD; if (mdObj != null) return Create(mdObj, ctx, commandTarget); Debug.Fail("Unknown TB MD"); return null; }
public override bool IsEnabled(IToolBarItemContext context) => debugger.Value.CanStopDebugging;
/// <inheritdoc/> public abstract void Execute(IToolBarItemContext context);
/// <inheritdoc/> public virtual bool IsEnabled(IToolBarItemContext context) => true;
/// <inheritdoc/> public virtual bool IsVisible(IToolBarItemContext context) => true;
object Create(ToolBarObjectMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var item = (IToolBarObject)md.ToolBarItem; return(item.GetUIObject(ctx, commandTarget)); }
/// <inheritdoc/> public virtual string GetHeader(IToolBarItemContext context) => null;
/// <inheritdoc/> public bool IsVisible(IToolBarItemContext context) => true;
/// <inheritdoc/> public virtual ImageReference? GetIcon(IToolBarItemContext context) => null;
/// <inheritdoc/> public virtual string GetToolTip(IToolBarItemContext context) => null;
public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_AsmEditor_Resources.RedoToolBarToolTip, dnSpy_AsmEditor_Resources.ShortCutKeyCtrlY);
object Create(ToolBarButtonMD md, IToolBarItemContext ctx, IInputElement commandTarget) { var item = (IToolBarButton)md.ToolBarItem; var md2 = (IToolBarButtonMetadata)md.Metadata; var cmdHolder = item as ICommandHolder; var cmd = cmdHolder != null ? cmdHolder.Command : new RelayCommand(a => item.Execute(ctx), a => item.IsEnabled(ctx)); string header = ResourceHelper.GetString(item, md2.Header); string icon = md2.Icon; string toolTip = ResourceHelper.GetString(item, md2.ToolTip); header = item.GetHeader(ctx) ?? header; toolTip = item.GetToolTip(ctx) ?? toolTip; var imgRef = item.GetIcon(ctx) ?? ImageReferenceHelper.GetImageReference(item, icon) ?? default(ImageReference); var toggleButtonCmd = item as IToolBarToggleButton; Debug.Assert(md2.IsToggleButton == (toggleButtonCmd != null), "Implement IToolBarToggleButton if IsToggleButton is true"); if (toggleButtonCmd != null) return CreateToggleButton(toggleButtonCmd.GetBinding(ctx), cmd, commandTarget, header, toolTip, imgRef); return new ToolBarButtonVM(cmd, commandTarget, header, toolTip, imgRef); }