本文整理汇总了C#中UIControlledApplication类的典型用法代码示例。如果您正苦于以下问题:C# UIControlledApplication类的具体用法?C# UIControlledApplication怎么用?C# UIControlledApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIControlledApplication类属于命名空间,在下文中一共展示了UIControlledApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnShutdown
public Result OnShutdown(UIControlledApplication application)
{
//save actual user settings
//Properties.Settings.Default.Save();
return Result.Succeeded;
}
示例2: AddRibbonPanel
/// <summary>
/// Add ribbon panel
/// </summary>
/// <param name="a"></param>
private void AddRibbonPanel(UIControlledApplication a)
{
Autodesk.Revit.UI.RibbonPanel rvtRibbonPanel = a.CreateRibbonPanel("Archilizer FEI");
PulldownButtonData data = new PulldownButtonData("Options", "Family Editor" + Environment.NewLine + "Interface");
BitmapSource img32 = new BitmapImage (new Uri (@largeIcon));
BitmapSource img16 = new BitmapImage (new Uri (@smallIcon));
//RibbonItem item = rvtRibbonPanel.AddItem(data);
//PushButton optionsBtn = item as PushButton;
//ContextualHelp ch = new ContextualHelp(ContextualHelpType.Url, "file:///C:/Users/adicted/AppData/Roaming/Autodesk/Revit/Addins/2015/Family Editor Interface _ AutoCAD _ Autodesk App Store.html");
ContextualHelp ch = new ContextualHelp(ContextualHelpType.Url, @helpFile);
PushButton familyEI = rvtRibbonPanel.AddItem(new PushButtonData("Family Editor", "Family Editor" + Environment.NewLine + "Interface", path,
"FamilyEditorInterface.Command")) as PushButton;
familyEI.Image = img16;
familyEI.LargeImage = img32;
familyEI.ToolTip = Message;
familyEI.SetContextualHelp(ch);
//optionsBtn.AddPushButton(new PushButtonData("Automatic Dimensions", "AutoDim", path,
// "AutomaticDimensions.AutoDim"));
//optionsBtn.AddPushButton(new PushButtonData("CAD|BIM", "CAD|BIM", path,
// "BimpowAddIn.BimToCad"));
}
示例3: OnStartup
public Result OnStartup(UIControlledApplication application)
{
// get the executing assembly
System.Reflection.Assembly dotNetAssembly =
System.Reflection.Assembly.GetExecutingAssembly();
// create the push button data for our command
PushButtonData pbdWallOpeningArea = new PushButtonData(
"ADNP_WALL_OPENING_AREA", "Wall Opening Area",
dotNetAssembly.Location,
"ADNPlugin.Revit.WallOpeningArea.ADNPCommand");
pbdWallOpeningArea.LargeImage =
LoadPNGImageFromResource(
"ADNPlugin.Revit.WallOpeningArea.icon32.png");
pbdWallOpeningArea.LongDescription =
"This plugin can be used to calculate the sum of openings " +
"on a wall that are smaller than a specified value.";
// get PIOTM panel
RibbonPanel piotmPanel = GetPIOTMPanel(application);
// finally add the item
piotmPanel.AddItem(pbdWallOpeningArea);
return Result.Succeeded;
}
示例4: OnStartup
/// <summary>
/// Create UI on StartUp
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnStartup(UIControlledApplication application)
{
RibbonPanel grevitPanel = application.CreateRibbonPanel("Grevit");
PushButton commandButton = grevitPanel.AddItem(new PushButtonData("GrevitCommand", "Grevit", path, "Grevit.Revit.GrevitCommand")) as PushButton;
commandButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
Properties.Resources.paper_airplane.GetHbitmap(),
IntPtr.Zero,
System.Windows.Int32Rect.Empty,
BitmapSizeOptions.FromWidthAndHeight(32, 32));
commandButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "http://grevit.net/"));
PushButton parameterButton = grevitPanel.AddItem(new PushButtonData("ParameterNames", "Parameter names", path, "Grevit.Revit.ParameterNames")) as PushButton;
parameterButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
Properties.Resources.tag_hash.GetHbitmap(),
IntPtr.Zero,
System.Windows.Int32Rect.Empty,
BitmapSizeOptions.FromWidthAndHeight(32, 32));
parameterButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "http://grevit.net/"));
PushButton skpButton = grevitPanel.AddItem(new PushButtonData("ImportSketchUp", "Import SketchUp", path, "Grevit.Revit.ImportSketchUp")) as PushButton;
skpButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
Properties.Resources.Skp.GetHbitmap(),
IntPtr.Zero,
System.Windows.Int32Rect.Empty,
BitmapSizeOptions.FromWidthAndHeight(32, 32));
skpButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "http://grevit.net/"));
return Result.Succeeded;
}
示例5: OnStartup
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
{
try
{
//TAF load english_us TODO add a way to localize
res = Resource_en_us.ResourceManager;
// Create new ribbon panel
RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); //MDJ todo - move hard-coded strings out to resource files
//Create a push button in the ribbon panel
PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo",
res.GetString("App_Name"), m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton;
System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32;
BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
dynamoIcon.GetHbitmap(),
IntPtr.Zero,
System.Windows.Int32Rect.Empty,
System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
pushButton.LargeImage = bitmapSource;
pushButton.Image = bitmapSource;
// MDJ = element level events and dyanmic model update
// MDJ 6-8-12 trying to get new dynamo to watch for user created ref points and re-run definition when they are moved
IdlePromise.RegisterIdle(application);
updater = new DynamoUpdater(application.ActiveAddInId, application.ControlledApplication);
if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId())) UpdaterRegistry.RegisterUpdater(updater);
ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager));
ElementClassFilter familyFilter = new ElementClassFilter(typeof(FamilyInstance));
ElementCategoryFilter refPointFilter = new ElementCategoryFilter(BuiltInCategory.OST_ReferencePoints);
ElementClassFilter modelCurveFilter = new ElementClassFilter(typeof(CurveElement));
ElementClassFilter sunFilter = new ElementClassFilter(typeof(SunAndShadowSettings));
IList<ElementFilter> filterList = new List<ElementFilter>();
filterList.Add(SpatialFieldFilter);
filterList.Add(familyFilter);
filterList.Add(modelCurveFilter);
filterList.Add(refPointFilter);
filterList.Add(sunFilter);
ElementFilter filter = new LogicalOrFilter(filterList);
UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeAny());
UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion());
UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition());
return Result.Succeeded;
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
return Result.Failed;
}
}
示例6: OnStartup
public Result OnStartup(UIControlledApplication a)
{
a.Idling += OnIdling;
Uri uri = new Uri(serviceUrl);
serviceHost =
new ServiceHost(typeof(RevitExternalService), uri);
try
{
serviceHost.AddServiceEndpoint(typeof (IRevitExternalService),
new NetNamedPipeBinding(),
"RevitExternalService");
//ServiceMetadataBehavior smb =
// new ServiceMetadataBehavior();
//smb.HttpGetEnabled = true;
//serviceHost.Description.Behaviors.Add(smb);
serviceHost.Open();
}
catch (Exception ex)
{
a.ControlledApplication
.WriteJournalComment(string.Format("{0}.\r\n{1}",
Resources.CouldNotStartWCFService,
ex.ToString()),
true);
}
return Result.Succeeded;
}
示例7: OnStartup
/// <summary>
/// Startup
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnStartup(UIControlledApplication application)
{
RvtWindow = null; // no dialog needed yet; the command will bring it
This = this; // static access to this application instance
return Result.Succeeded;
}
示例8: OnShutdown
public Result OnShutdown(UIControlledApplication application)
{
application.ControlledApplication.DocumentClosed -= OnDocumentClosed;
application.ControlledApplication.DocumentOpened -= OnDocumentOpened;
return Result.Succeeded;
}
示例9: OnStartup
public Result OnStartup(UIControlledApplication application)
{
ThisApp = this;
var elementCategoryFilter = new ElementCategoryFilter(BuiltInCategory.OST_GenericAnnotation);
_updaterModified = new UpdaterModified(application.ActiveAddInId);
if (!UpdaterRegistry.IsUpdaterRegistered(_updaterModified.GetUpdaterId()))
{
UpdaterRegistry.RegisterUpdater(_updaterModified);
UpdaterRegistry.AddTrigger(_updaterModified.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeAny());
}
_updaterAdded = new UpdaterAdded(application.ActiveAddInId);
if (!UpdaterRegistry.IsUpdaterRegistered(_updaterAdded.GetUpdaterId()))
{
UpdaterRegistry.RegisterUpdater(_updaterAdded);
UpdaterRegistry.AddTrigger(_updaterAdded.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeElementAddition());
}
_paneId = new DockablePaneId(Guid.NewGuid());
_handler = new RequestHandler();
_exEvent = ExternalEvent.Create(_handler);
_sheetNoteModel = new ViewModel();
_mainPage = new MainPage { Resources = {["ViewModel"] = _sheetNoteModel } };
application.RegisterDockablePane(_paneId, "Sheet Note Manager", (IDockablePaneProvider)_mainPage);
application.ControlledApplication.DocumentClosed += new EventHandler<DocumentClosedEventArgs>(OnDocumentClosed);
application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(OnDocumentOpened);
return Result.Succeeded;
}
示例10: OnShutdown
public Result OnShutdown(UIControlledApplication application)
{
DynamoUpdater updater = new DynamoUpdater(application.ActiveAddInId);
UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId());
return Result.Succeeded;
}
示例11: OnShutdown
/// <summary>
/// Implementation of Shutdown for the external application.
/// </summary>
/// <param name="application">The Revit application.</param>
/// <returns>The result (typically Succeeded).</returns>
public Result OnShutdown(UIControlledApplication application)
{
// Clean up
m_ifcCommandBinding.Executed -= OnIFCExport;
return Result.Succeeded;
}
示例12: OnStartup
/// <summary>
/// Startup
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnStartup(UIControlledApplication application)
{
try
{
// Tab
RibbonPanel panel = application.CreateRibbonPanel("BCFier");
// Button Data
PushButton pushButton = panel.AddItem(new PushButtonData("BCFier",
"BCFier " + Assembly.GetExecutingAssembly().GetName().Version,
Path.Combine(_path, "Bcfier.Revit.dll"),
"Bcfier.Revit.Entry.CmdMain")) as PushButton;
// Images and Tooltip
if (pushButton != null)
{
pushButton.Image = LoadPngImgSource("Bcfier.Assets.BCFierIcon16x16.png", Path.Combine(_path, "Bcfier.dll"));
pushButton.LargeImage = LoadPngImgSource("Bcfier.Assets.BCFierIcon32x32.png", Path.Combine(_path, "Bcfier.dll"));
pushButton.ToolTip = "BCFier";
}
}
catch (Exception ex1)
{
MessageBox.Show("exception: " + ex1);
return Result.Failed;
}
return Result.Succeeded;
}
示例13: OnStartup
public Result OnStartup(UIControlledApplication application)
{
var rootPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\\Autodesk\\Revit\\Addins\\2011\\BIMXchangeAdmin.bundle";
const string str = "CDWKS.RevitAddon.Indexer2011.dll";
var ribbonPanel = application.CreateRibbonPanel("BIMXchange Admin");
#region Content Indexer
var pushButtonDataIndexer = new PushButtonData("Content Indexer", "Content Indexer", string.Format("{0}\\{1}", rootPath, str),
"CDWKS.RevitAddon.Indexer2011.IndexerCommand");
var ribbonItemIndexer = ribbonPanel.AddItem(pushButtonDataIndexer);
var pushButtonIndexer = ribbonItemIndexer as PushButton;
pushButtonIndexer.LargeImage = (new BitmapImage(new Uri(string.Format("{0}\\Library_32.png", rootPath))));
#endregion
#region Content TreeCreator
var pushButtonDataTreeCreator = new PushButtonData("Library Tree", "Library Tree", string.Format("{0}\\{1}", rootPath, str),
"CDWKS.RevitAddon.Indexer2011.TreeViewCreator");
var ribbonItemTreeCreator = ribbonPanel.AddItem(pushButtonDataTreeCreator);
var pushButtonTreeCreator = ribbonItemTreeCreator as PushButton;
pushButtonTreeCreator.LargeImage = (new BitmapImage(new Uri(string.Format("{0}\\Library_32.png", rootPath))));
#endregion
return Result.Succeeded;
}
示例14: CreateRibbonPanel
void CreateRibbonPanel(
UIControlledApplication a)
{
Assembly exe = Assembly.GetExecutingAssembly();
string path = exe.Location;
string className = GetType().FullName.Replace(
"App", "Command" );
RibbonPanel p = a.CreateRibbonPanel(
"DirectShape OBJ Loader" );
PushButtonData d = new PushButtonData(
"DirectObjLoader_Command",
"DirectShape\r\nOBJ Loader",
path, "DirectObjLoader.Command" );
d.ToolTip = "Load a WaveFront OBJ model mesh "
+ "into a DirectShape Revit element";
d.Image = NewBitmapImage( exe,
"ImgDirectObjLoader16.png" );
d.LargeImage = NewBitmapImage( exe,
"ImgDirectObjLoader32.png" );
d.LongDescription = d.ToolTip;
d.SetContextualHelp( new ContextualHelp(
ContextualHelpType.Url,
Command.TroubleshootingUrl ) );
p.AddItem( d );
}
示例15: OnStartup
public Result OnStartup(
UIControlledApplication a)
{
CreateRibbonPanel( a );
return Result.Succeeded;
}