Ejemplo n.º 1
0
        public void Setup(Plugin plugin)
        {
            ToolBarButton       toolButton = null;
            ToolBarButtonPlugin toolPlugin = plugin.PluginBase as ToolBarButtonPlugin;

            if (toolPlugin.AssemblyName != string.Empty &&
                toolPlugin.AssemblyName != null &&
                toolPlugin.ClassName != string.Empty &&
                toolPlugin.ClassName != null)
            {
                string  assemblyPath = AssemblyToolkit.GetDll(toolPlugin.AssemblyName);
                Command cmd          = AssemblyToolkit.ActivateObject <Command>(assemblyPath, toolPlugin.ClassName);
                toolButton = new ToolBarButton(cmd);
            }
            else
            {
                toolButton = new ToolBarButton();
            }
            if (toolPlugin.Image != string.Empty && toolPlugin.Image != null)
            {
                string imagePath = CommonToolkit.GetResourceDirectory(toolPlugin.Image);
                toolButton.Image = CommonToolkit.GetResourceImage(imagePath);
            }
            toolButton.DisplayStyle = ToolBarToolkit.GetDisplayStyle(toolPlugin.DisplayStyle);
            toolButton.Text         = (toolPlugin.Label.Equals(string.Empty) || toolPlugin.Label.Equals(null)) ? "无" : toolPlugin.Label;

            ToolBarSingleton.MainToolbar.Add(toolButton);
        }
Ejemplo n.º 2
0
        public void SetupDockBar(Plugin plugin)
        {
            DockBarPlugin dockPlugin = plugin.PluginBase as DockBarPlugin;

            if (dockPlugin == null)
            {
                throw new NullReferenceException();
            }
            if (dockPlugin.AssemblyName != string.Empty && dockPlugin.AssemblyName != null &&
                dockPlugin.DockWindowClass != string.Empty && dockPlugin.DockWindowClass != null)
            {
                DockState  state        = GetDockState(dockPlugin.DockType);
                string     assemblyPath = AssemblyToolkit.GetDll(plugin.PluginBase.AssemblyName);
                ToolWindow window       = AssemblyToolkit.ActivateObject <ToolWindow>(assemblyPath, dockPlugin.DockWindowClass);
                window.Text = dockPlugin.Label;
                window.Show(DockPanelSingleton.MainDockPanel, state);
            }
        }
Ejemplo n.º 3
0
        public MenuItem GetMenuItem(MenuPlugin menuPlugin)
        {
            MenuItem item = null;

            if (menuPlugin.AssemblyName != string.Empty && menuPlugin.AssemblyName != null &&
                menuPlugin.ClassName != string.Empty && menuPlugin.ClassName != null)
            {
                string  assemblyPath = AssemblyToolkit.GetDll(menuPlugin.AssemblyName);
                Command cmd          = AssemblyToolkit.ActivateObject <Command>(assemblyPath, menuPlugin.ClassName);
                item = new MenuItem(cmd);
            }
            else
            {
                item = new MenuItem();
            }
            if (menuPlugin.Image != string.Empty && menuPlugin.Image != null)
            {
                string imagePath = CommonToolkit.GetResourceDirectory(menuPlugin.Image);
                item.Image = CommonToolkit.GetResourceImage(imagePath);
            }
            item.Text = (menuPlugin.Label.Equals(string.Empty) || menuPlugin.Label.Equals(null)) ? CommonToolkit.GetLastString(menuPlugin.Path) : menuPlugin.Label;
            return(item);
        }