public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { if (_subscribed) { _monitorOnIdling.SelectionChanged -= SelectionChangedEvent; App.UIContApp.Idling -= _monitorOnIdling.OnIdlingEvent; _subscribed = false; } else { if (_monitorOnIdling == null) { _monitorOnIdling = new MonitorOnIdling(); } _monitorOnIdling.SelectionChanged += SelectionChangedEvent; App.UIContApp.Idling += _monitorOnIdling.OnIdlingEvent; _subscribed = true; } Messaging.DebugMessage($"OnIdling Subscription Changed: Subscribed = {_subscribed}"); return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { foreach (var tab in ComponentManager.Ribbon.Tabs) { if (tab.Id == "Modify") { if (_subscribed) { // TODO - Figure out how to kill the event for real! tab.PropertyChanged -= TabPropertyChangedEvent; _subscribed = false; } else { tab.PropertyChanged += TabPropertyChangedEvent; _subscribed = true; } break; } } Messaging.DebugMessage($"OnPropertyChanged Subscription Changed: Subscribed = {_subscribed}"); return(Result.Succeeded); }
private static void SelectionChangedEvent(object sender, EventArgs e) { if (_monitorOnIdling.SelectedElementIds == null) { return; } List <ElementId> elementIds = new List <ElementId>(_monitorOnIdling.SelectedElementIds); Messaging.DebugMessage(_subscribed, elementIds, "Ken Goulding's - OnIdling", true); }
public static void FairApplicationInitialized(object sender, ApplicationInitializedEventArgs e) { RibbonTab fairTab = null; RibbonPanel fairPanel = null; RibbonItem fairButton = null; foreach (var tab in ComponentManager.Ribbon.Tabs) { if (tab.Id == Ribbon.RibbonTabName) { fairTab = tab; Messaging.DebugMessage($"Found Tab: {fairTab}"); foreach (var panel in tab.Panels) { if (panel.Source.Title == "FairPanel") { fairPanel = panel; Messaging.DebugMessage($"Found Panel: {fairPanel}"); foreach (var item in panel.Source.Items) { if (item.Id == "CustomCtrl_%CustomCtrl_%Selection Monitor%FairPanel%FairButtonItem") { fairButton = item; Messaging.DebugMessage($"Found Button: {fairButton}"); break; } } } } break; } } if (fairPanel != null && fairButton != null) { var position = RibbonUtilities.GetPositionBeforeButton("ID_REVIT_FILE_PRINT"); RibbonUtilities.PlaceButtonOnQuickAccess(position, fairButton); RibbonUtilities.RemovePanelFromTab(fairTab, fairPanel); RibbonUtilities.RemoveTabFromRibbon(fairTab); } }
private static void TabPropertyChangedEvent(object sender, PropertyChangedEventArgs e) { if (!(sender is RibbonTab)) { Messaging.DebugMessage("Expected Sender To Be A Ribbon Tab"); return; } if (!string.Equals(e.PropertyName, "Title", StringComparison.CurrentCultureIgnoreCase)) { return; } List <ElementId> elementIds = App.UIApp.ActiveUIDocument.Selection.GetElementIds().OrderBy(elementId => elementId.IntegerValue).ToList(); Messaging.DebugMessage(_subscribed, elementIds, "Vilo's - OnPropertyChanged", true); }
public bool IsCommandAvailable(UIApplication uiApp, CategorySet catSet) { var uidoc = uiApp.ActiveUIDocument; // If no Document... if (uidoc == null) { // Assert Button Is Disabled return(false); } // Raise the SelectionChangedEvent App.SelectedElementIds = App.UIApp.ActiveUIDocument.Selection.GetElementIds().OrderBy(elementId => elementId.IntegerValue).ToList(); Messaging.DebugMessage(true, App.SelectedElementIds, "Fair59 - Availability Class Name Workaround", true); // Assert Button Is Disabled return(false); }
public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements) { Messaging.DebugMessage("FairDummyCommand.Execute"); return(Result.Succeeded); }