IUpdater wont trigger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to make this parameter share the same value as the length and I can not get it to trigger or work I'm not sure what the problem is. Any help would be appreciated.
namespace iUpdater3._0
{
class RegRoomTracker : IExternalApplication
{
RoomTracker updater = null;
public Result OnStartup(UIControlledApplication uiapp)
{
AddInId addinId = uiapp.ActiveAddInId;
updater = new RoomTracker(addinId);
updater.RegisterUpdater();
updater.AddTrigger();
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication uiapp)
{
UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId());
return Result.Succeeded;
}
}
class RoomTracker : IUpdater
{
private UpdaterId updaterid;
internal RoomTracker(AddInId addinId)
{
updaterid = new UpdaterId(addinId, new Guid("5CCFA69E-03F3-46D6-875D-5BB6FEF59190"));
}
internal void RegisterUpdater()
{
if (!UpdaterRegistry.IsUpdaterRegistered(updaterid))
UpdaterRegistry.RegisterUpdater(this, true);
}
internal void AddTrigger()
{
UpdaterRegistry.AddTrigger(updaterid, new ElementCategoryFilter(BuiltInCategory.OST_Conduit), Element.GetChangeTypeElementAddition());
}
#region IUpdater Members
public void Execute(UpdaterData data)
{
Document doc = data.GetDocument();
FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Conduit);
foreach (Element element in collector)
{
Parameter length = element.LookupParameter("length");
Parameter ce_length = element.LookupParameter("_CE_LENGTH");
if (length != null && ce_length != null)
{
double double_length = length.AsDouble();
ce_length.Set(double_length);
}
}
}
public UpdaterId GetUpdaterId()
{
return updaterid;
}
public ChangePriority GetChangePriority()
{
return ChangePriority.Annotations;
}
public string GetUpdaterName()
{
return "SchemaUpdater";
}
public string GetAdditionalInformation()
{
return "";
}
}
}
#endregion