public HostSurface CreateNew(string name) { HostSurface hostSurface = CreateNewCore(name); hostSurface.PropertyGrid = propertyGrid; return(hostSurface); }
public void InitializeHost(HostSurface hostSurface) { if (hostSurface == null) return; Control control = hostSurface.View as Control; control.Parent = this; control.Dock = DockStyle.Fill; control.Visible = true; this.hostSurface = hostSurface; }
public static void Paste(HostSurface hostSurface) { IMenuCommandService ims = hostSurface.GetService(typeof(IMenuCommandService)) as IMenuCommandService; if(ims!=null) ims.GlobalInvoke(StandardCommands.Paste); }
public static void SelectAll(HostSurface hostSurface) { IMenuCommandService ims = hostSurface.GetService(typeof(IMenuCommandService)) as IMenuCommandService; ims.GlobalInvoke(StandardCommands.SelectAll); }
public static void Run(HostSurface hostSurface) { (hostSurface.Loader as CodeDomHostLoader).Run(); }
public CommandAction(Action<HostSurface> action, HostSurface hostSurface) { Action = action; HostSurface = hostSurface; }
private void SetupMenus(HostSurface hostSurface) { foreach (MenuItem mi in menuItems) mi.Dispose(); menuItems.Clear(); if (hostSurface == null) return; IEnumerable<Lazy<Action<HostSurface>, ICommandMetadataView>> commands = hostSurface.HostSurfaceFactory.GetCommands(); foreach (var command in commands) { bool found = false; MenuItem topMenu = null; foreach (MenuItem mi in this.mainMenu1.MenuItems) { if (mi.Text == command.Metadata.Category) { found = true; topMenu = mi; } } if(!found) { topMenu = new MenuItem(command.Metadata.Category); this.mainMenu1.MenuItems.Add(topMenu); menuItems.Add(topMenu); } MenuItem realItem = new MenuItem(command.Metadata.Name); topMenu.MenuItems.Add(realItem); menuItems.Add(realItem); realItem.Tag = new CommandAction(command.Value, hostSurface); realItem.Click += new EventHandler(realItem_Click); } }