当前位置: 首页>>代码示例>>C#>>正文


C# UIControlledApplication.CreateRibbonTab方法代码示例

本文整理汇总了C#中UIControlledApplication.CreateRibbonTab方法的典型用法代码示例。如果您正苦于以下问题:C# UIControlledApplication.CreateRibbonTab方法的具体用法?C# UIControlledApplication.CreateRibbonTab怎么用?C# UIControlledApplication.CreateRibbonTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIControlledApplication的用法示例。


在下文中一共展示了UIControlledApplication.CreateRibbonTab方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddRibbonPanel

        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            String tabName = "Grimshaw";
            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Grimshaw Architects");

            // Get dll assembly path
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            #region Curve Total Length Button
            PushButtonData buttonData = new PushButtonData("cmdCurveTotalLength",
               "Total Length", thisAssemblyPath, "GrimshawRibbon.CurveTotalLength");
            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
            pushButton.ToolTip = "Select Multiple Lines to Obtain Total Length";
            // Add image icon to
            Uri uriImage = new Uri(@"D:\Stuff\RevitVisualStudio\CurveTotalLength\CurveTotalLength\bin\Debug\CurveTotalLength.png");
            BitmapImage largeImage = new BitmapImage(uriImage);
            pushButton.LargeImage = largeImage;
            #endregion // Curve Total Length Button

            #region Workset 3d View, Upper Case Views on Sheet and Delete Reference Planes Buttons
            // Create two push buttons
            // Project Management Commands
            PushButtonData pushButton1 = new PushButtonData("cmdWorkset3dView", "Make 3D View/Workset", thisAssemblyPath, "GrimshawRibbon.Workset3dView");
            pushButton1.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\Workset3dView\Workset3dView\bin\Debug\favicon.png"));
            pushButton1.ToolTip = "Create one 3D View per workset with all elemets on that workset isolated.";

            PushButtonData pushButton2 = new PushButtonData("cmdUpperCaseViewsOnSheets", "UpperCase Sheet Views", thisAssemblyPath, "GrimshawRibbon.UpperCaseViewsOnSheets");
            pushButton2.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\UpperCaseViewsOnSheets\UpperCaseViewsOnSheets\bin\Debug\UpperCaseViewsOnSheets.png"));
            pushButton2.ToolTip = "Rename all Views in the Project to 'uppercase' if its on a Sheet and 'lowercase' if its not on a Sheet.";

            PushButtonData pushButton3 = new PushButtonData("cmdDeleteReferencePlanes", "Delete Reference Planes", thisAssemblyPath, "GrimshawRibbon.DeleteReferencePlanes");
            pushButton3.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\DeleteReferencePlanes\DeleteReferencePlanes\bin\Debug\deleteReferencePlanes.png"));
            pushButton3.ToolTip = "Delete all unnamed reference planes in the project.";

            // Add the buttons to the panel
            List<RibbonItem> projectButtons = new List<RibbonItem>();
            projectButtons.AddRange(ribbonPanel.AddStackedItems(pushButton1, pushButton2, pushButton3));
            #endregion // Workset 3d View, Upper Case Views on Sheet and Delete Reference Planes Buttons

            #region Prevent Deletion Button
            PushButtonData preventDelButtonData = new PushButtonData("cmdPreventDeletion",
               "Prevent Deletion", thisAssemblyPath, "GrimshawRibbon.PreventDeletion");
            PushButton preventDelButton = ribbonPanel.AddItem(preventDelButtonData) as PushButton;
            preventDelButton.ToolTip = "Prevent elements from being deleted.";
            // Add image icon to
            Uri preventDelImage = new Uri(@"D:\Stuff\RevitVisualStudio\PreventDeletion\PreventDeletion\bin\Debug\preventDeletion.png");
            BitmapImage preventDellargeImage = new BitmapImage(preventDelImage);
            preventDelButton.LargeImage = preventDellargeImage;
            #endregion // Prevent Deletion Button
        }
开发者ID:mjkkirschner,项目名称:GrimshawTools,代码行数:54,代码来源:App.cs

示例2: OnStartup

        /// <summary>
        /// Startup
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
            // Version
            if (!application.ControlledApplication.VersionName.Contains(RevitVersion))
                {
                    using (TaskDialog td = new TaskDialog("Cannot Continue"))
                    {
                        td.TitleAutoPrefix = false;
                        td.MainInstruction = "Incompatible Revit Version";
                        td.MainContent = "This Add-In was built for Revit "+ RevitVersion + ", please contact CASE for assistance.";
                        td.Show();
                    }
                    return Result.Cancelled;
                }

                // Master Tab
                const string c_tabName = "CASE";

                try
                {
                    // Create the Tab
                    application.CreateRibbonTab(c_tabName);
                }
                catch { }

            string m_issuetracker = "Case.IssueTracker.dll";
            // Tab
            RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Case Issue Tracker");

                // Button Data
                PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
                                                                                                 "Issue Tracker",
                                                                                                 Path.Combine(_path, "Case.IssueTracker.Revit.dll"),
                                                                                                 "Case.IssueTracker.Revit.Entry.CmdMain")) as PushButton;

                // Images and Tooltip
                if (m_pushButton != null)
                {
                    m_pushButton.Image = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon16x16.png", m_issuetracker);
                    m_pushButton.LargeImage = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon32x32.png", m_issuetracker);
                    m_pushButton.ToolTip = "Case Issue Manager";
                }

            }
            catch (Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
                return Result.Failed;
            }

            return Result.Succeeded;
        }
开发者ID:WeConnect,项目名称:issue-tracker,代码行数:59,代码来源:AppMain.cs

示例3: OnStartup

        //Built in startup command for Revit
        public Result OnStartup(UIControlledApplication a)
        {
            //the name of the new tab to be created
            string tabName = "TLC";
            //method to create the tab
            a.CreateRibbonTab(tabName);
            //method to create a new panel
            RibbonPanel panel1 = a.CreateRibbonPanel(tabName, "TLC View Creator");

            //Buttons go in this area
            CreateView(panel1);
            //return succeeded
            return Result.Succeeded;
        }
开发者ID:jailbirdj,项目名称:create-views-,代码行数:15,代码来源:App.cs

示例4: OnStartup

        //Built in startup command for Revit
        public Result OnStartup(UIControlledApplication a)
        {
            //the name of the new tab to be created
            string tabName = "RTC 2014";
            //method to create the tab
            a.CreateRibbonTab(tabName);
            //method to create a new panel
            RibbonPanel panel1 = a.CreateRibbonPanel(tabName, "Programming");

            //Buttons go in this area
            PullDown(panel1);
            updateDoor(panel1);
            //return succeeded
            return Result.Succeeded;
        }
开发者ID:Gytaco,项目名称:RevitAPI,代码行数:16,代码来源:App.cs

示例5: AddButtons

        //Add UI buttons
        public void AddButtons(UIControlledApplication a)
        {
            //Create a add to SOM Tools ribbon tab
            try
            {
                a.CreateRibbonTab("SOM Tools");
            }
            catch (Exception)
            {

            }

            //create a ribbon panel
            RibbonPanel panel = a.CreateRibbonPanel("SOM Tools", "Views on Sheets");

            addVRCommandButtons(panel);
        }
开发者ID:dannysbentley,项目名称:viewport-renamer,代码行数:18,代码来源:App.cs

示例6: AddRibbonPanel

        /// <summary>
        /// Add the Ribbon Item and Panel
        /// </summary>
        /// <param name="a"></param>
        /// <remarks></remarks>
        public void AddRibbonPanel(UIControlledApplication a)
        {
            try
            {
                // First Create the Tab
                a.CreateRibbonTab("Case Design Inc.");
            }
            catch
            {
                // Might already exist...
            }

            // Tools
            AddButton("Panel",
                      "Tool_Name",
                      "Text",
                      "?_16.png",
                      "?_32.png",
                      m_Path + "\\?.dll",
                      "?.cmd",
                      "Description");
        }
开发者ID:dangwalsh,项目名称:CompareProperties,代码行数:27,代码来源:app.cs

示例7: CreateRibbonPanel

 /// <summary>
 /// Create the Panel
 /// </summary>
 /// <param name="uiapp"></param>
 public void CreateRibbonPanel(UIControlledApplication uiapp)
 {
     try
     {
         // Create a custom ribbon tab
         uiapp.CreateRibbonTab("Case Design Inc.");
     }
     catch
     {
         // Might Already Exist
     }
     // Tools
     AddButton(
         "Free Tools",
         "ViewCreator",
         "View\nCreator",
         m_Path + "\\Case.ViewCreator.16.png",
         m_Path + "\\Case.ViewCreator.32.png",
         m_Path + "\\Case.ViewCreator.dll",
         "Case.ViewCreator.cmd",
         "Create New Views");
 }
开发者ID:WeConnect,项目名称:case-apps,代码行数:26,代码来源:app.cs

示例8: AddRibbonPanel

        // define a method that will create our tab and button
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            String tabName = "Grimshaw";
            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Tools");

            // Get dll assembly path
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            // create push button for CurveTotalLength
            PushButtonData b1Data = new PushButtonData(
                "cmdCurveTotalLength", 
                "Total" + System.Environment.NewLine + "  Length  ", 
                thisAssemblyPath,
                "TotalLength.CurveTotalLength");

            PushButton pb1 = ribbonPanel.AddItem(b1Data) as PushButton;
            pb1.ToolTip = "Select Multiple Lines to Obtain Total Length";
            BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/GrimshawRibbon;component/Resources/totalLength.png"));
            pb1.LargeImage = pb1Image;
        }
开发者ID:ksobon,项目名称:archi-lab.net,代码行数:25,代码来源:App.cs

示例9: OnStartup

        public Result OnStartup(UIControlledApplication application)
        {
            // add new ribbon panel
            application.CreateRibbonTab("Národní BIM knihovna");
            _panel = application.CreateRibbonPanel("Národní BIM knihovna", "Nástroje");
            _panel.Enabled = true;

            //get assembly of this class to set the right path to other objects in this assembly
            var assembly = Assembly.GetAssembly(this.GetType());
            var assemblyPath = assembly.Location;
            var dirPath = Path.GetDirectoryName(assemblyPath);

            //-----------------------------BUTTONS FOR COMMANDS ----------------------------
            var btnSettings = _panel.AddItem(new PushButtonData(
                "GetObject",
                "Vyhledávání",
                assemblyPath,
                "BimLibraryAddin.AddIns.ProductSearchAddIn"
                )) as PushButton;
            btnSettings.LargeImage = new BitmapImage(new Uri("pack://application:,,,/BimLibraryAddin;component/Icons/logo.ico"));
            btnSettings.AvailabilityClassName = "BimLibraryAddin.AddIns.DocumentAvailability";
            btnSettings.ToolTip = "Vyhledávání objektů v národní BIM knihovně";
            btnSettings.LongDescription =
            @"Vyhledané objekty je možné importovat do aktuálního projektu a okamžitě použít.";

            application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(ControlledApplication_DocumentOpened);
            application.ControlledApplication.DocumentCreated += new EventHandler<DocumentCreatedEventArgs>(ControlledApplication_DocumentCreating);
            application.ControlledApplication.DocumentClosing += new EventHandler<DocumentClosingEventArgs>(ControlledApplication_DocumentClosing);
            application.ControlledApplication.DocumentOpening += new EventHandler<DocumentOpeningEventArgs>(ControlledApplication_DocumentOpening);
            //application.ControlledApplication.DocumentChanged += new EventHandler<DocumentChangedEventArgs>();

            //register failures
            Failures.RegisterFailures();

            return Result.Succeeded;
        }
开发者ID:martin1cerny,项目名称:BIM-Library-CZ-Revit,代码行数:36,代码来源:AddInApplication.cs

示例10: OnStartup

        public Result OnStartup(UIControlledApplication application)
        {
            address = new Uri(addr + application.ControlledApplication.VersionNumber);
            uicApp = application;


            _app = this;
            serverActive = Properties.Settings.Default.defaultServerOn;
            // Create the button
            try
            {
                BitmapSource bms;
                PushButtonData lyrebirdButton;
                //StartServer();
                if (disableButton)
                {
                    bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_On.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                    lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird Server\nDisabled", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                    {
                        LargeImage = bms,
                        ToolTip = "The Lyrebird Server is currently disabled in this session of Revit.  This is most likely because you have more than one session of Revit and the server can only run in one.",
                    };
                    Properties.Settings.Default.enableServer = false;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    if (serverActive)
                    {
                        bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_On.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                        lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird\nServer On", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                        {
                            LargeImage = bms,
                            ToolTip = "The Lyrebird Server currently on and will accept requests for data and can create objects.  Push button to toggle the server off.",
                        };
                        StartServer();
                        //ServiceOn();
                    }
                    else
                    {
                        bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Off.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                        lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird\nServer Off", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                        {
                            LargeImage = bms,
                            ToolTip = "The Lyrebird Server is currently off and will not accept requests for data or create objects.  Push button to toggle the server on.",
                        };
                    }
                    Properties.Settings.Default.enableServer = true;
                    Properties.Settings.Default.Save();
                }

                // Settings button
                BitmapSource setBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Settings.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData settingsButtonData = new PushButtonData("Lyrebird Settings", "Lyrebird Settings", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.SettingsCmd")
                {
                    LargeImage = setBMS,
                    ToolTip = "Lyrebird Server settings.",
                };

                // Selection button
                BitmapSource selBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Select.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData selectionButtonData = new PushButtonData("Select Run", "Select Run", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.SelectRunElementsCmd")
                {
                    LargeImage = selBMS,
                    ToolTip = "Select elements created from Lyrebird",
                };

                // Selection button
                BitmapSource delBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_RemoveData.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData removeButtonData = new PushButtonData("Remove Data", "Remove Data", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.RemoveDataCmd")
                {
                    LargeImage = delBMS,
                    ToolTip = "Remove Lyrebird data from selected elements",
                };

                // Create the tab if necessary
                const string tabName = "LMN";
                Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon;
                Autodesk.Windows.RibbonTab tab = null;
                foreach (Autodesk.Windows.RibbonTab t in ribbon.Tabs)
                {
                    if (t.Id == tabName)
                    {
                        tab = t;
                    }
                }
                if (tab == null)
                {
                    application.CreateRibbonTab(tabName);
                }

                bool found = false;
                List<RibbonPanel> panels = application.GetRibbonPanels(tabName);
                RibbonPanel panel = null;
                foreach (RibbonPanel rp in panels)
                {
                    if (rp.Name == "Utilities")
                    {
                        panel = rp;
                        found = true;
//.........这里部分代码省略.........
开发者ID:samuto,项目名称:Lyrebird,代码行数:101,代码来源:App.cs

示例11: AddRibbonSampler

    /// <summary>
    /// Create our own ribbon panel with verious buttons 
    /// for our exercise. We re-use commands defined in the
    /// Revit Intro Labs here. Cf. Section 3.8 (pp 46) of 
    /// the Developers Guide. 
    /// </summary>
    public void AddRibbonSampler(UIControlledApplication app)
    {
      // (1) create a ribbon tab and ribbon panel 

      app.CreateRibbonTab("Ribbon Sampler");

      RibbonPanel panel = app.CreateRibbonPanel("Ribbon Sampler", "Ribbon Sampler");

      // Below are samplers of ribbon items. Uncomment 
      // functions of your interest to see how it looks like 

      // (2.1) add a simple push button for Hello World 

      AddPushButton(panel);

      // (2.2) add split buttons for "Command Data", "DB Element" and "Element Filtering" 

      AddSplitButton(panel);

      // (2.3) add pulldown buttons for "Command Data", "DB Element" and "Element Filtering" 

      AddPulldownButton(panel);

      // (2.4) add radio/toggle buttons for "Command Data", "DB Element" and "Element Filtering" 
      // we put it on the slide-out below. 
      //AddRadioButton(panel);
      //panel.AddSeparator();

      // (2.5) add text box - TBD: this is used with the conjunction with event. Probably too complex for day one training. 
      //  for now, without event. 
      // we put it on the slide-out below. 
      //AddTextBox(panel);
      //panel.AddSeparator();

      // (2.6) combo box - TBD: this is used with the conjunction with event. Probably too complex for day one training. 
      // For now, without event. show two groups: Element Bascis (3 push buttons) and Modification/Creation (2 push button)  

      AddComboBox(panel);

      // (2.7) stacked items - 1. hello world push button, 2. pulldown element bscis (command data, DB element, element filtering) 
      // 3. pulldown modification/creation(element modification, model creation). 

      AddStackedButtons_Complex(panel);

      // (2.8) slide out - if you don't have enough space, you can add additional space below the panel. 
      // anything which comes after this will be on the slide out. 

      panel.AddSlideOut();

      // (2.4) radio button - what it is 

      AddRadioButton(panel);

      // (2.5) text box - what it is 

      AddTextBox(panel);
    }
开发者ID:vnoves,项目名称:RevitTrainingMaterial,代码行数:63,代码来源:1_Ribbon.cs

示例12: OnStartup

   /// 实现OnStartup
   public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
   {
      // 在OnStartup函数里创建一个Ribbon文本框
      application.CreateRibbonTab("CustomTag");
      RibbonPanel panel = application.CreateRibbonPanel("CustomTag", "CustomPanel");
      TextBox textBox = panel.AddItem(new TextBoxData("CustomTextBox")) as TextBox;

      return Autodesk.Revit.UI.Result.Succeeded;
   }
开发者ID:revitdevelopers,项目名称:revitapitutorialbook,代码行数:10,代码来源:CodeSnippets.cs

示例13: OnStartup

    /// <summary>
    /// Startup
    /// </summary>
    /// <param name="application"></param>
    /// <returns></returns>
    public Result OnStartup(UIControlledApplication application)
    {

      try
      {

        // Version
          if (!application.ControlledApplication.VersionName.Contains("2014") && !application.ControlledApplication.VersionName.Contains("2015"))
          {
              using (TaskDialog td = new TaskDialog("Cannot Continue"))
              {
                  td.TitleAutoPrefix = false;
                  td.MainInstruction = "Incompatible Revit Version";
                  td.MainContent = "This Add-In was built for Revit 2014 and 2015, please contact CASE for assistance.";
                  td.Show();
              }
              return Result.Cancelled;
          }

        // Master Tab 
        const string c_tabName = "CASE";

        try
        {
          // Create the Tab
          application.CreateRibbonTab(c_tabName);
        }
        catch { }

        // Assembly Paths
        string m_issuetracker = Path.Combine(ProgramFilesx86(), "CASE", "ARUP Issue Tracker", "ARUP.IssueTracker.dll");

        // Check that File Exists
        if (!File.Exists(m_issuetracker))
        {
          using (TaskDialog td = new TaskDialog("Cannot Continue"))
          {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "Required Issue Tracker Library Not Found";
            td.MainContent = m_issuetracker;
            td.Show();
          }
          return Result.Cancelled;
        }
        
        // Load Assemblies
        Assembly.LoadFrom(m_issuetracker);

        // Tab
        RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Arup Issue Tracker");

        // Button Data
        PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
                                                                     "Issue Tracker", 
                                                                     Path.Combine(_path, "ARUP.IssueTracker.Revit.dll"),
                                                                     "ARUP.IssueTracker.Revit.Entry.CmdMain")) as PushButton;

        // Images and Tooltip
        if (m_pushButton != null)
        {
          m_pushButton.Image = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon16x16.png", m_issuetracker);
          m_pushButton.LargeImage = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon32x32.png", m_issuetracker);
          m_pushButton.ToolTip = "Arup Issue Manager";
        }
      }
      catch (Exception ex1)
      {
        MessageBox.Show("exception: " + ex1);
        return Result.Failed;
      }

      return Result.Succeeded;
    }
开发者ID:ArupAus,项目名称:issue-tracker,代码行数:78,代码来源:AppMain.cs

示例14: ribbonPanel

        public RibbonPanel ribbonPanel(UIControlledApplication a)
        {
            RibbonPanel ribbonPanel = null;

            //Create add-in to the SOM tool ribbon tab
            try
            {
                a.CreateRibbonTab("SOM Tools");
            }
            catch (Exception)
            { }
            //Create Ribbon Panel
            try
            {
                RibbonPanel alignViewsPanel = a.CreateRibbonPanel("SOM Tools", "Sheet Layout");

            }

            catch (Exception)
            { }

            List<RibbonPanel> alignViewpanels = a.GetRibbonPanels("SOM Tools");
            foreach (RibbonPanel panel in alignViewpanels)
            {
                if (panel.Name == "Sheet Layout")
                {
                    ribbonPanel = panel;
                }
            }
            return ribbonPanel;
        }
开发者ID:dannysbentley,项目名称:alignviewtosheetcell,代码行数:31,代码来源:App.cs

示例15: catch

        Result IExternalApplication.OnStartup(UIControlledApplication application)
        {
            //set static PluginHost
            _Host = this;

            //Parse settings
            try
            {
                string path = Utilities.AssemblyDirectory;

                string file = Path.Combine(path, "Settings.revithost");
                _Settings = SettingsIO.LoadSettings(file);
            }
            catch (Exception e)
            {

            }
            // Create New Ribbon Tab -
            try
            {
                application.CreateRibbonTab(_Settings.HostPanel_ID);
            }
            catch (Exception e)
            {

            }
            ///Create a Tab Ribon Panel for each PluginFolder.
            try
            {
                foreach (KeyValuePair<string, string> value in _Settings._Disciplines)
                {
                    Autodesk.Revit.UI.RibbonPanel _panel = application.CreateRibbonPanel(_Settings.HostPanel_ID, value.Key);
                    RevitCore.UI._PluginPanels.Add(value.Key, _panel);
                }
            }
            catch (Exception e)
            {

            }

            ///Load individual plungins
            try
            {
                foreach (KeyValuePair<string, string> value in _Settings._Disciplines)
                {
                    //Load Assembly
                    List<Assembly> plugInAssemblies = new List<Assembly>();
                    try
                    {
                        plugInAssemblies.AddRange(Utilities.LoadPlugInAssemblies(value.Value));
                    }
                    catch (LoadPluginException e)
                    {
                        MessageBox.Show(e.Message, "Error Loading Plugins",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    if (plugInAssemblies != null)
                    {
                        //Find Plugin Info and create Button to exicute the command.
                        IList<IRevitCoreInfo> plugInInfo = Utilities.GetPlugIns<IRevitCoreInfo>(plugInAssemblies);
                        IList<RequestHandler> handlers = Utilities.GetPluginClass<RequestHandler>(plugInAssemblies);
                        Dictionary<Guid, RequestHandler> _Handlers;
                        _Handlers = new Dictionary<Guid, RequestHandler>();
                        if (handlers != null)
                        {
                            foreach (RequestHandler handle in handlers)
                            {
                                _Handlers.Add(handle.ID, handle);
                            }
                        }

                        IList<RevitCoreBaseDialogWindow> windows = Utilities.GetPluginClass<RevitCoreBaseDialogWindow>(plugInAssemblies);
                        Dictionary<Guid, RevitCoreBaseDialogWindow> _Windows;
                        _Windows = new Dictionary<Guid, RevitCoreBaseDialogWindow>();
                        if (_Windows != null)
                        {
                            foreach (RevitCoreBaseDialogWindow window in windows)
                            {
                                _Windows.Add(window.ID, window);
                            }
                        }
                        foreach (IRevitCoreInfo info in plugInInfo)
                        {
                            if (info.IsWindowed)
                            {
                                ///Link Handler and Window
                                RevitCoreWindowedCommand winCMD = (RevitCoreWindowedCommand)info;
                                Guid? handlderID = Utilities.stringGuid(winCMD.Requesthandler);
                                Guid? windowID = Utilities.stringGuid(winCMD.DialogWindow);
                                if (handlderID != null)
                                {
                                    RequestHandler theHandle = _Handlers[handlderID.Value];
                                    RevitCoreBaseDialogWindow theWIndow = _Windows[windowID.Value];
                                    RevitCore.UI.AddWindowedCommand(theHandle, theWIndow);
                                    PushButtonData _ButtonData = new PushButtonData(winCMD.Name, winCMD.Text, winCMD.AssemblyName, winCMD.ClassName);
                                    PushButton _PushButton = RevitCore.UI.GetDisciplinePanel(value.Key).AddItem(_ButtonData) as PushButton;
                                    _PushButton.ToolTip = winCMD.ToolTip;
                                }
                                ///Build Button
//.........这里部分代码省略.........
开发者ID:somchicago,项目名称:RevitHost,代码行数:101,代码来源:PluginHost.cs


注:本文中的UIControlledApplication.CreateRibbonTab方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。