本文整理汇总了C#中UIControlledApplication.GetRibbonPanels方法的典型用法代码示例。如果您正苦于以下问题:C# UIControlledApplication.GetRibbonPanels方法的具体用法?C# UIControlledApplication.GetRibbonPanels怎么用?C# UIControlledApplication.GetRibbonPanels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIControlledApplication
的用法示例。
在下文中一共展示了UIControlledApplication.GetRibbonPanels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPIOTMPanel
/// <summary>
/// Get the default PIOTM panel
/// </summary>
/// <param name="application">Revit application</param>
/// <returns></returns>
private static RibbonPanel GetPIOTMPanel(
UIControlledApplication application)
{
IList<RibbonPanel> panels = application.GetRibbonPanels();
foreach (RibbonPanel pnl in panels)
if (pnl.Name == PIOTM_PANEL_NAME)
return pnl;
return application.CreateRibbonPanel(PIOTM_PANEL_NAME);
}
示例2: 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;
//.........这里部分代码省略.........
示例3: 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;
}
示例4: OnShutdown
/// <summary>
/// Implement this method to implement the external application which should be called when
/// Revit is about to exit, Any documents must have been closed before this method is called.
/// </summary>
/// <param name="application">An object that is passed to the external application
/// which contains the controlled application.</param>
/// <returns>Return the status of the external application.
/// A result of Succeeded means that the external application successfully shutdown.
/// Cancelled can be used to signify that the user cancelled the external operation at
/// some point.
/// If Failed is returned then the Revit user should be warned of the failure of the external
/// application to shut down correctly.</returns>
public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application)
{
//remove events
List<RibbonPanel> myPanels = application.GetRibbonPanels();
Autodesk.Revit.UI.ComboBox comboboxLevel = (Autodesk.Revit.UI.ComboBox)(myPanels[0].GetItems()[2]);
application.ControlledApplication.DocumentCreated -= new EventHandler<
Autodesk.Revit.DB.Events.DocumentCreatedEventArgs>(DocumentCreated);
Autodesk.Revit.UI.TextBox textBox = myPanels[0].GetItems()[5] as Autodesk.Revit.UI.TextBox;
textBox.EnterPressed -= new EventHandler<
Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(SetTextBoxValue);
return Autodesk.Revit.UI.Result.Succeeded;
}