예제 #1
0
        public HostSurface CreateNew(string name)
        {
            HostSurface hostSurface = CreateNewCore(name);

            hostSurface.PropertyGrid = propertyGrid;
            return(hostSurface);
        }
예제 #2
0
        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;
        }
예제 #3
0
        public static void Paste(HostSurface hostSurface)
        {
            IMenuCommandService ims = hostSurface.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
	    if(ims!=null)
	            ims.GlobalInvoke(StandardCommands.Paste);
        }
예제 #4
0
 public static void SelectAll(HostSurface hostSurface)
 {
     IMenuCommandService ims = hostSurface.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
     ims.GlobalInvoke(StandardCommands.SelectAll);
 }
예제 #5
0
 public static void Run(HostSurface hostSurface)
 {
     (hostSurface.Loader as CodeDomHostLoader).Run();
 }
예제 #6
0
 public CommandAction(Action<HostSurface> action, HostSurface hostSurface)
 {
     Action = action;
     HostSurface = hostSurface;
 }
예제 #7
0
 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);
     }
 }