Skip to content

Commit

Permalink
Fixed issue where dimension preferences would not be correctly intial…
Browse files Browse the repository at this point in the history
…ized until after the settings window was opened.
  • Loading branch information
Carson-McCombs committed Jul 25, 2024
1 parent 91b45b4 commit e672d24
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions CarsonsAddins/CarsonsAddinsApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,17 @@ public Result OnStartup(UIControlledApplication app)
}
RegisterComponentPushButtons(assembly, panel, pulldownButtonDictionary);
app.ControlledApplication.ApplicationInitialized += RegisterDockablePanes;
app.ControlledApplication.ApplicationInitialized += DummyLaunchDimensionSettingsWindow;
app.ViewActivated += CheckIfFocusingOnNewDocument;
return Result.Succeeded;
}


private void CheckIfFocusingOnNewDocument(object sender, ViewActivatedEventArgs e)
{
if (e.CurrentActiveView?.Document == null || e.CurrentActiveView?.Document == e.PreviousActiveView?.Document) return;

DimensionPreferences.Instance = DimensionPreferences.CreateFromPreferences(e.CurrentActiveView.Document);
}

public Result OnShutdown(UIControlledApplication app)
{
return Result.Succeeded;
Expand Down Expand Up @@ -143,15 +149,7 @@ private void RegisterComponentPushButtons(Assembly assembly, RibbonPanel panel,
}
}
}
/// <summary>
/// Registers all of the classes with a SettingsComponent that contain a DockablePane via reflection.
/// </summary>
private void DummyLaunchDimensionSettingsWindow(object sender, ApplicationInitializedEventArgs e)
{
//UIApplication uiapp = new UIApplication(sender as Autodesk.Revit.ApplicationServices.Application);
//new ShowWindow<DimensionTextWindow>().InitWindow(uiapp);
DimensionPreferences preferences = DimensionPreferences.CreateFromPreferences(ActiveUIDocument.Document);
}

/// <summary>
/// Registers all of the classes with a SettingsComponent that contain a DockablePane via reflection.
/// </summary>
Expand Down

0 comments on commit e672d24

Please sign in to comment.