Пример #1
0
        public void InitializeServicePanel(ServicesPanel servicesPanel)
        {
            DataView dView = (DataView)servicesPanel.ServiceGrid.DataSource;

            this.visibleServices = new ArrayList();
            foreach (DataRow row in dView.Table.Rows)
            {
                this.visibleServices.Add(row["ServiceControllerObject"]);
            }
        }
Пример #2
0
        private void menuItemServices_Click(object sender, System.EventArgs e)
        {
            var machineParms = QuickDialog2.DoQuickDialog("Services", "Machine Name", ".", "Pattern ^(Enable|EPX)", "");

            if (machineParms == null)
            {
                machineParms = new string[2];
            }
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            ServicesPanel newPanel = new ServicesPanel(this);


            newPanel.MainForm = this;


            TabPage x = new TabPage("Services");


            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

            x.Controls.Add(newPanel);


            this.tabControl1.TabPages.Add(x);


            ServiceMgrWorkUnit worker = new ServiceMgrWorkUnit(newPanel, newPanel);

            newPanel.Manager = worker;

            worker.InitalizeControl(null, machineParms[0], machineParms[1]);

            this.tabControl1.SelectedTab = x;
        }
Пример #3
0
        public Rvt.Result OnStartup(UIControlledApplication application)
        {
//         Schema = null;
            curApp        = this;
            uiApplication = application;
            ExtEvents     = new ExternalEventsContainer();

            try
            {
                // Add Panel to Add_Ins tab
                RibbonPanel panel = application.CreateRibbonPanel("BIM Bot");

                // Add Button to the BIM Bot panel
                PushButton pushButton = panel.AddItem(new PushButtonData("BIMBot", "About BIM Bot", Assembly.GetExecutingAssembly().Location, "Bimbot.AboutAddin")) as PushButton;
                SetImage(pushButton, Properties.Resources.BIMserver_BimBot);

                PluginToggleButtonResults = panel.AddItem(new PushButtonData("ToggleResults", "Hide Results", Assembly.GetExecutingAssembly().Location, "Bimbot.ToggleResults"));
                SetImage(PluginToggleButtonResults as PushButton, Properties.Resources.BIMserver_BimBot);
                PluginToggleButtonResults.ToolTip         = "Toggles the window results";
                PluginToggleButtonResults.LongDescription = "Showing or hiding the last responses of the BIM Bot services performed";

                PluginToggleButtonServices = panel.AddItem(new PushButtonData("ToggleServices", "Hide Services", Assembly.GetExecutingAssembly().Location, "Bimbot.ToggleServices"));
                SetImage(PluginToggleButtonServices as PushButton, Properties.Resources.BIMserver_BimBot);
                PluginToggleButtonServices.ToolTip         = "Toggles the window services";
                PluginToggleButtonServices.LongDescription = "Showing or hiding the BIM Bot services assigned to this Revit project";



                // Create The DockablePanels for showing the service results and services
                DockableResultPanel = new ResultsPanel(ExtEvents);
                application.RegisterDockablePane(OutputPaneId, "BIM Bot results", DockableResultPanel as IDockablePaneProvider);

                DockableServicesPanel = new ServicesPanel(ExtEvents);
                application.RegisterDockablePane(ServicePaneId, "BIM Bot services", DockableServicesPanel as IDockablePaneProvider);

                // Get the listbutton that manages the dockable views
                adWin.RibbonListButton listBut = (adWin.RibbonListButton)adWin.ComponentManager.Ribbon.Tabs.Where(t => t.Id.Equals("View")).SelectMany(t => t.Panels).
                                                 Where(p => p.Source.Id.Equals("manageviews_shr")).SelectMany(p => p.Source.Items).
                                                 Where(b => b.Id.Equals("HID_APPLICATION_ELEMENTS_RibbonListButton")).First();

                // Add the bimbot result view activation button
                ViewToggleButtonResults      = new adWin.RibbonToggleButton();
                ViewToggleButtonResults.Name = "Bimbot output";
//            ViewToggleButtonResults.Id = "ID_RESULT_BUTTON";
                ViewToggleButtonResults.IsEnabled        = false;
                ViewToggleButtonResults.ToolTip          = "Show the Bimbots output panel";
                ViewToggleButtonResults.PropertyChanged += new PropertyChangedEventHandler(toggleButtonResult_PropertyChanged);
                listBut.Items.Insert(listBut.Items.Count - 3, ViewToggleButtonResults);

                // Add the bimbot service view activation button
                ViewToggleButtonServices      = new adWin.RibbonToggleButton();
                ViewToggleButtonServices.Name = "Bimbot services";
//            ViewToggleButtonServices.Id = "ID_SERVICE_BUTTON";
                ViewToggleButtonServices.IsEnabled        = false;
                ViewToggleButtonServices.ToolTip          = "Show the Bimbots services panel";
                ViewToggleButtonServices.PropertyChanged += new PropertyChangedEventHandler(toggleButtonService_PropertyChanged);
                listBut.Items.Insert(listBut.Items.Count - 3, ViewToggleButtonServices);

                // Set the event handler to handle te view activation buttons
//            adWin.ComponentManager.UIElementActivated += new EventHandler<adWin.UIElementActivatedEventArgs>(ComponentManager_UIElementActivated);


                // Register events
                application.DockableFrameVisibilityChanged        += new EventHandler <DockableFrameVisibilityChangedEventArgs>(Application_DockableFrameVisibilityChanged);
                application.ControlledApplication.DocumentOpened  += new EventHandler <DocumentOpenedEventArgs>(Application_DocumentOpened);
                application.ControlledApplication.DocumentClosing += new EventHandler <DocumentClosingEventArgs>(Application_DocumentClosing);
                application.ViewActivated += new EventHandler <ViewActivatedEventArgs>(Application_ViewActivated);
            }
            catch (Exception)
            {
                return(Autodesk.Revit.UI.Result.Failed);
            }

            // Add view buttons for the Dockable panels in Revits UI
            return(Rvt.Result.Succeeded);
        }
Пример #4
0
        /// <summary>
        /// Load state, or, start with a fresh new panel.
        /// </summary>
        private void LoadSavedPanels()
        {
            string saveFile = Application.StartupPath + "\\KexplorerStateSave.xml";

            if (!File.Exists(saveFile))
            {
                this.AddNewPanel();
            }
            else
            {
                XmlDocument savedDoc = new XmlDocument();
                savedDoc.Load(saveFile);


                XmlNodeList panels = savedDoc.SelectNodes("/KexplorerState/KexplorerTab");

                if (panels.Count == 0)
                {
                    this.AddNewPanel();
                }
                else
                {
                    TabPage selectedPage = null;
                    foreach (XmlNode panel in panels)
                    {
                        XmlNode nameNode = panel.SelectSingleNode("TabName");

                        XmlNode servicesNode = panel.SelectSingleNode("ServicesTab");

                        XmlNode ftpSiteNode = panel.SelectSingleNode("FtpTab");

                        if (servicesNode != null)
                        {
                            XmlNodeList visibleServices = panel.SelectNodes("Service");
                            ArrayList   serviceNames    = new ArrayList();
                            foreach (XmlNode serviceNode in visibleServices)
                            {
                                serviceNames.Add(serviceNode.InnerText);
                            }


                            TabPage x = new TabPage(nameNode.InnerText);


                            if (panel.SelectSingleNode("Selected") != null)
                            {
                                selectedPage = x;
                            }
                            ServicesPanel servicesPanel = new ServicesPanel(this);

                            ServiceMgrWorkUnit worker = new ServiceMgrWorkUnit(servicesPanel, servicesPanel);
                            servicesPanel.Manager = worker;

                            servicesPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            this.tabControl1.TabPages.Add(x);

                            x.Controls.Add(servicesPanel);
                            worker.InitalizeControl(serviceNames, null, null);
                        }
                        else if (ftpSiteNode != null)
                        {
                            //
                            // TODO: Add any constructor code after InitializeComponent call
                            //
                            var hostNode         = ftpSiteNode.SelectSingleNode("Host");
                            var userNameNode     = ftpSiteNode.SelectSingleNode("UserName");
                            var pwdNode          = ftpSiteNode.SelectSingleNode("Pwd");
                            var targetFolderNode = ftpSiteNode.SelectSingleNode("TargetFolder");
                            var typeNode         = ftpSiteNode.SelectSingleNode("Type");

                            KexplorerPanel newPanel = new KexplorerPanel(this
                                                                         , new FtpSite(
                                                                             hostNode.InnerText
                                                                             , userNameNode.InnerText
                                                                             , pwdNode.InnerText
                                                                             , targetFolderNode.InnerText
                                                                             , typeNode.InnerText

                                                                             ));


                            newPanel.MainForm = this;


                            TabPage y = new TabPage(nameNode.InnerText);


                            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            y.Controls.Add(newPanel);


                            this.tabControl1.TabPages.Add(y);
                        }
                        else
                        {
                            XmlNode currentFolderNode = panel.SelectSingleNode("CurrentFolder");

                            XmlNodeList driveNodes = panel.SelectNodes("Drive");
                            ArrayList   drives     = new ArrayList();
                            foreach (XmlNode node in driveNodes)
                            {
                                drives.Add(node.InnerText);
                            }

                            KexplorerPanel newPanel = new KexplorerPanel(this, currentFolderNode.InnerText, drives);


                            newPanel.MainForm = this;


                            TabPage x = new TabPage(nameNode.InnerText);


                            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            x.Controls.Add(newPanel);


                            this.tabControl1.TabPages.Add(x);

                            if (panel.SelectSingleNode("Selected") != null)
                            {
                                selectedPage = x;
                                newPanel.InitializeOnce();
                            }
                        }
                    }

                    if (selectedPage != null)
                    {
                        this.tabControl1.SelectedTab = selectedPage;
                    }
                }
            }
        }