コード例 #1
1
        public void Start(ServiceManager serviceManager)
        {
            // Create Addins Windows
            // Get the WindowManager service
            WindowManager windowManager = (WindowManager)serviceManager.GetService(typeof(WindowManager));
            attributeListControl = new AttributeListControl();
            // Create a docked window to host an AttributeListControl
            attributeListWindow = windowManager.CreateDockedWindow("Aveva.AttributeBrowser.AttributeList", "Attributes", attributeListControl, DockedPosition.Right);
            attributeListWindow.Width = 200;
            // Docked windows created at addin start should ensure their layout is saved between sessions.
            attributeListWindow.SaveLayout = true;

            // Create and register addins commands
            // Get the CommandManager
            CommandManager commandManager = (CommandManager)serviceManager.GetService(typeof(CommandManager));
            ShowAttributeBrowserCommand showCommand = new ShowAttributeBrowserCommand(attributeListWindow);
            commandManager.Commands.Add(showCommand);

            // Add event handler for current element changed event.
            CurrentElement.CurrentElementChanged += new CurrentElementChangedEventHandler(CurrentElement_CurrentElementChanged);

            // Get the ResourceManager service.
            ResourceManager resourceManager = (ResourceManager)serviceManager.GetService(typeof(ResourceManager));
            resourceManager.LoadResourceFile("AttributeBrowserAddin");

            // Add a new panel to contain the project name.
            StatusBar statusBar = windowManager.StatusBar;
            StatusBarTextPanel projectNamePanel = statusBar.Panels.AddTextPanel("Aveva.ProjectName", "Project : " + Project.CurrentProject.Name);
            projectNamePanel.SizingMode = PanelSizingMode.Automatic;
            // Get the panel image from the addins resource file.
            projectNamePanel.Image = resourceManager.GetImage("ID_PROJECT_ICON");

            // Load a UIC file for the AttributeBrowser.
            CommandBarManager commandBarManager = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));
            commandBarManager.AddUICustomizationFile("AttributeBrowser.uic", "AttributeBrowser");
        }
コード例 #2
0
        public void Start(ServiceManager serviceManager)
        {
            // Create Addins Windows
            // Get the WindowManager service
            WindowManager windowManager = (WindowManager)serviceManager.GetService(typeof(WindowManager));

            attributeListControl = new AttributeListControl();
            // Create a docked window to host an AttributeListControl
            attributeListWindow       = windowManager.CreateDockedWindow("Aveva.AttributeBrowser.AttributeList", "Attributes", attributeListControl, DockedPosition.Right);
            attributeListWindow.Width = 200;
            // Docked windows created at addin start should ensure their layout is saved between sessions.
            attributeListWindow.SaveLayout = true;

            // Create and register addins commands
            // Get the CommandManager
            CommandManager commandManager           = (CommandManager)serviceManager.GetService(typeof(CommandManager));
            ShowAttributeBrowserCommand showCommand = new ShowAttributeBrowserCommand(attributeListWindow);

            commandManager.Commands.Add(showCommand);

            // Add event handler for current element changed event.
            CurrentElement.CurrentElementChanged += new CurrentElementChangedEventHandler(CurrentElement_CurrentElementChanged);

            // Get the ResourceManager service.
            ResourceManager resourceManager = (ResourceManager)serviceManager.GetService(typeof(ResourceManager));

            resourceManager.LoadResourceFile("AttributeBrowserAddin");

            // Add a new panel to contain the project name.
            StatusBar          statusBar        = windowManager.StatusBar;
            StatusBarTextPanel projectNamePanel = statusBar.Panels.AddTextPanel("Aveva.ProjectName", "Project : " + Project.CurrentProject.Name);

            projectNamePanel.SizingMode = PanelSizingMode.Automatic;
            // Get the panel image from the addins resource file.
            projectNamePanel.Image = resourceManager.GetImage("ID_PROJECT_ICON");

            // Load a UIC file for the AttributeBrowser.
            CommandBarManager commandBarManager = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));

            commandBarManager.AddUICustomizationFile("AttributeBrowser.uic", "AttributeBrowser");
        }