コード例 #1
0
        /// <summary>
        /// The OnStartup
        /// </summary>
        /// <param name="uicapp">The uicapp<see cref="UIControlledApplication"/></param>
        /// <returns>The <see cref="Result"/></returns>
        public Result OnStartup(UIControlledApplication uicapp)
        {
            Instance          = this;
            ModelHandler      = new ModelRequestHandler();
            ModelEvent        = ExternalEvent.Create(ModelHandler);
            HistoryHandler    = new HistoryRequestHandler();
            HistoryEvent      = ExternalEvent.Create(HistoryHandler);
            DiscussionHandler = new DiscussionRequestHandler();
            DiscussionEvent   = ExternalEvent.Create(DiscussionHandler);

            PaletteUtilities.RegisterPalette(uicapp);

            _uicapp = uicapp;

            // 获取程序集 dll 的路径
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            /************************************创建选项卡 ***********************************************/
            string      tabName     = "Manh Hoang";
            MyRibbonTab myRibbonTab = new MyRibbonTab();

            myRibbonTab.Add(uicapp, tabName);
            MyButton button = new MyButton();

            //********************Create panel*******************

            MyRibbonPanel panel             = new MyRibbonPanel();
            RibbonPanel   rbAuth            = panel.Add(uicapp, tabName, "Authentification");
            RibbonPanel   rbVerification    = panel.Add(uicapp, tabName, "Verification");
            RibbonPanel   rbDatabase        = panel.Add(uicapp, tabName, "Database");
            RibbonPanel   ribbonPanel       = panel.Add(uicapp, tabName, "Update Data");
            RibbonPanel   rib_panelProprety = panel.Add(uicapp, tabName, "history Palette");

            rbDatabase.Visible        = false;
            ribbonPanel.Visible       = false;
            rib_panelProprety.Visible = false;

            PushButtonData login = new PushButtonData("Connecter", "Login", thisAssemblyPath, "ProjectManagement.CmdRevit.CmdLogin")
            {
                AvailabilityClassName = "ProjectManagement.AvailabilityButtonLogin"
            };

            _button = rbAuth.AddItem(login);

            rbAuth.AddSeparator();

            PushButtonData logout = new PushButtonData("Logout", "Logout", thisAssemblyPath, "ProjectManagement.CmdRevit.CmdLogout")
            {
                AvailabilityClassName = "ProjectManagement.AvailabilityButtonLogout"
            };

            rbAuth.AddItem(logout);

            uicapp.ViewActivated += new EventHandler <ViewActivatedEventArgs>(onViewActivated); //for panel proprety
            uicapp.ControlledApplication.DocumentOpened  += OnDocumentOpened;
            uicapp.ControlledApplication.DocumentCreated += OnDocumentCreated;
            uicapp.ControlledApplication.DocumentClosing += OnDocumentClosing;
            uicapp.ControlledApplication.DocumentClosed  += OnDocumentClosed;
            uicapp.ControlledApplication.DocumentSaved   += OnDocumentSave;
            uicapp.ControlledApplication.DocumentSynchronizedWithCentral += OnDocumentSynchronized;
            uicapp.ControlledApplication.DocumentChanged += OnDocumentChanged;

            return(Result.Succeeded);
        }
コード例 #2
0
ファイル: App.cs プロジェクト: tamsweet/BIM4PM-AddinRevit
        public Result OnStartup(UIControlledApplication uicapp)
        {
            Instance = this;

            ModelHandler      = new ModelRequestHandler();
            ModelEvent        = ExternalEvent.Create(ModelHandler);
            HistoryHandler    = new HistoryRequestHandler();
            HistoryEvent      = ExternalEvent.Create(HistoryHandler);
            DiscussionHandler = new DiscussionRequestHandler();
            DiscussionEvent   = ExternalEvent.Create(DiscussionHandler);

            //Register panel
            PaletteUtilities.RegisterPalette(uicapp);

            _uicapp = uicapp;

            // Obtenir le chemin du dll assembly
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            // Créer des onglets
            string nomOnglet = "Manh Hoang";
            Onglet onglet    = new Onglet();

            onglet.Ajouter(uicapp, nomOnglet);
            Bouton button = new Bouton();

            //********************Create panel*******************
            Ruban       panneau           = new Ruban();
            RibbonPanel rbAuth            = panneau.Ajouter(uicapp, nomOnglet, "Authentification");
            RibbonPanel rbVerification    = panneau.Ajouter(uicapp, nomOnglet, "Verification");
            RibbonPanel rbDatabase        = panneau.Ajouter(uicapp, nomOnglet, "Database");
            RibbonPanel ribbonPanel       = panneau.Ajouter(uicapp, nomOnglet, "Update Data");
            RibbonPanel rib_panelProprety = panneau.Ajouter(uicapp, nomOnglet, "Palette d'historiques");

            rbDatabase.Visible        = false;
            ribbonPanel.Visible       = false;
            rib_panelProprety.Visible = false;


            PushButtonData login = new PushButtonData("Connecter", "Login", thisAssemblyPath, "BIM4PM.UI.CmdRevit.CmdLogin");

            login.AvailabilityClassName = "BIM4PM.UI.AvailabilityButtonLogin";
            _button = rbAuth.AddItem(login);

            rbAuth.AddSeparator();

            PushButtonData logout = new PushButtonData("Logout", "Logout", thisAssemblyPath, "BIM4PM.UI.CmdRevit.CmdLogout");

            logout.AvailabilityClassName = "BIM4PM.UI.AvailabilityButtonLogout";
            rbAuth.AddItem(logout);

            PushButtonData Test = new PushButtonData("Test", "Test", thisAssemblyPath, "BIM4PM.UI.CmdRevit.CmdGetData");

            rbAuth.AddItem(Test);


            uicapp.ViewActivated += new EventHandler <ViewActivatedEventArgs>(onViewActivated); //for panel proprety
            uicapp.ControlledApplication.DocumentOpened  += OnDocumentOpened;
            uicapp.ControlledApplication.DocumentCreated += OnDocumentCreated;
            uicapp.ControlledApplication.DocumentClosing += OnDocumentClosing;
            uicapp.ControlledApplication.DocumentClosed  += OnDocumentClosed;
            uicapp.ControlledApplication.DocumentSaved   += OnDocumentSave;
            uicapp.ControlledApplication.DocumentSynchronizedWithCentral += OnDocumentSynchronized;
            uicapp.ControlledApplication.DocumentChanged += OnDocumentChanged;

            return(Result.Succeeded);
        }