public Result OnStartup(UIControlledApplication a)
        {
            //Create Ribbon Panel add the UI button on start up
            RibbonPanel alignViewsPanel = ribbonPanel(a);

            //Register location updater with Revit.
            LocationUpdater updater = new LocationUpdater(a.ActiveAddInId);
            UpdaterRegistry.RegisterUpdater(updater, true);

            ElementCategoryFilter viewPortFilter = new ElementCategoryFilter(BuiltInCategory.OST_Viewports);
            ElementCategoryFilter viewFilter = new ElementCategoryFilter(BuiltInCategory.OST_Views);
            LogicalOrFilter filter = new LogicalOrFilter(viewPortFilter, viewFilter);

            //Parameter to send to the trigger.
            ElementClassFilter viewPort = new ElementClassFilter(typeof(Viewport));
            ElementId viewPortNumberId = new ElementId(BuiltInParameter.VIEWPORT_DETAIL_NUMBER);

            //Set trigger
            UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), viewPort, Element.GetChangeTypeParameter(viewPortNumberId));
            UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition());

            //add buttons to ribbon
            addVRCommandButtons(alignViewsPanel);
            pushButton_Setting(alignViewsPanel);

            return Result.Succeeded;
        }
 public Result OnShutdown(UIControlledApplication a)
 {
     LocationUpdater updater = new LocationUpdater(a.ActiveAddInId);
     UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId());
     return Result.Succeeded;
 }