Skip to content

Instantly share code, notes, and snippets.

@acormier
Created December 22, 2016 12:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acormier/18225b2eae37d934b78933707d2e5897 to your computer and use it in GitHub Desktop.
Save acormier/18225b2eae37d934b78933707d2e5897 to your computer and use it in GitHub Desktop.
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
if (mode == RunMode.Scripted)
return RunScripted(doc);
if( m_container==null )
{
// Create SettingsService early so we know the trace level right at the start
var settings_service = new SettingsService();
InternalTrace.Initialize("nunit-gui_%p.log", (InternalTraceLevel)settings_service.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default));
// Add Standard Services to ServiceManager
ServiceManager.Services.AddService(settings_service);
ServiceManager.Services.AddService(new DomainManager());
ServiceManager.Services.AddService(new RecentFilesService());
ServiceManager.Services.AddService(new ProjectService());
ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher()));
ServiceManager.Services.AddService(new AddinRegistry());
ServiceManager.Services.AddService(new AddinManager());
ServiceManager.Services.AddService(new TestAgency());
// Initialize Services
ServiceManager.Services.InitializeServices();
// Rhino does not work well with multiple AppDomains.
Services.TestLoader.Events.ProjectLoaded += (o, s) => { Services.TestLoader.TestProject.DomainUsage = DomainUsage.None; };
// Create container in order to allow ambient properties
// to be shared across all top-level forms.
m_container = new AppContainer();
var ambient = new AmbientProperties();
m_container.Services.AddService(typeof(AmbientProperties), ambient);
}
var gui_options = new GuiOptions(new string[0]);
var form = new NUnitForm(gui_options);
m_container.Add(form);
form.ShowDialog(RhinoWindows.RhinoWinApp.MainWindow);
m_container.Remove(form);
return Result.Success;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment