public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton) { this.toolBarButton = toolBarButton; this.toolBarButton.Click += toolBarButton_Click; this.action = action; this.action.EnabledChanged += new EventHandler <EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e); }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler <EventArgs> activated) { ButtonAction action = new ButtonAction(id, text, activated); actions.Add(action); return(action); }
public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton) { this.toolBarButton = toolBarButton; this.toolBarButton.Click += toolBarButton_Click; this.action = action; this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e); }
public MenuConnector(ButtonAction action, ImageMenuItem menuItem) { this.action = action; this.menuItem = menuItem; this.menuItem.Click += menuItem_Clicked; this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak((e) => this.action.EnabledChanged -= e); }
public MenuConnector(ButtonAction action, ButtonMenuItem menuItem) { this.action = action; this.menuItem = menuItem; this.menuItem.Click += HandleClick; this.menuItem.Validate += HandleValidate; }
public void GetSystemActions(GenerateActionArgs args, bool addStandardItems = false) { // map new commands/menus back to actions for backwards compatibility var commands = GetSystemCommands().ToArray(); foreach (var command in commands) { var currentCommand = command; var action = new ButtonAction { ID = currentCommand.ID, MenuText = currentCommand.MenuText, ToolBarText = currentCommand.ToolBarText, TooltipText = currentCommand.ToolTip, Accelerator = currentCommand.Shortcut, command = currentCommand }; currentCommand.Executed += (sender, e) => action.Activate(); action.EnabledChanged += (sender, e) => currentCommand.Enabled = action.Enabled; args.Actions.Add(action); } #if DESKTOP if (addStandardItems) { var menu = new MenuBar(Generator); CreateStandardMenu(menu.Items, commands); args.Menu.ExtractMenu(menu); } #endif }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler<EventArgs> activated, params Key[] accelerators) { ButtonAction action = new ButtonAction(id, text, activated); action.Accelerators = accelerators; actions.Add(action); return action; }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text) { ButtonAction action = new ButtonAction(id, text); actions.Add(action); return(action); }
public MenuConnector(ButtonAction action, ImageMenuItem menuItem) { this.action = action; this.menuItem = menuItem; this.menuItem.Click += HandleClick; this.menuItem.Validate += HandleValidate; }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler <EventArgs> activated, params Key[] accelerators) { ButtonAction action = new ButtonAction(id, text, activated); action.Accelerators = accelerators; actions.Add(action); return(action); }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated) { Icon icon = null; if (!string.IsNullOrEmpty(iconResource)) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource); ButtonAction action = new ButtonAction(id, text, icon, activated); actions.Add(action); return action; }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated, params Key[] accelerators) { Icon icon = null; if (iconResource != string.Empty) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource); ButtonAction action = new ButtonAction(id, text, icon, activated); action.Accelerators = accelerators; actions.Add(action); return action; }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler<EventArgs> activated) { #if WINRT throw new NotImplementedException("WinRT does not support Assembly.GetCallingAssembly"); #else Icon icon = null; if (!string.IsNullOrEmpty(iconResource)) icon = Icon.FromResource (Assembly.GetCallingAssembly (), iconResource); var action = new ButtonAction(id, text, icon, activated); actions.Add(action); return action; #endif }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated) { Icon icon = null; if (!string.IsNullOrEmpty(iconResource)) { icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource); } ButtonAction action = new ButtonAction(id, text, icon, activated); actions.Add(action); return(action); }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated, params Key[] accelerators) { Icon icon = null; if (iconResource != string.Empty) { icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource); } ButtonAction action = new ButtonAction(id, text, icon, activated); action.Accelerators = accelerators; actions.Add(action); return(action); }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, string iconResource, EventHandler <EventArgs> activated) { #if WINRT throw new NotImplementedException("WinRT does not support Assembly.GetCallingAssembly"); #else Icon icon = null; if (!string.IsNullOrEmpty(iconResource)) { icon = Icon.FromResource(Assembly.GetCallingAssembly(), iconResource); } var action = new ButtonAction(id, text, icon, activated); actions.Add(action); return(action); #endif }
void GenerateActions() { var actions = new GenerateActionArgs(this); Application.Instance.GetSystemActions(actions, true); var quitAction = new ButtonAction { Text = "Quit", Accelerator = Application.Instance.CommonModifier | Key.Q }; quitAction.Activated += (sender, e) => Application.Instance.Quit(); // add action to file sub-menu var file = actions.Menu.FindAddSubMenu("&File"); file.Actions.Add(quitAction); // generate menu this.Menu = actions.Menu.GenerateMenuBar(); }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text, EventHandler<EventArgs> activated) { ButtonAction action = new ButtonAction(id, text, activated); actions.Add(action); return action; }
public static ButtonAction AddButton(this ActionCollection actions, string id, string text) { ButtonAction action = new ButtonAction(id, text); actions.Add(action); return action; }