/// <summary> /// Runs the application /// </summary> public int Run(IAsynchronousHostableProgram programToHost) { try { programToHost.ExitRequested += programToHost_ExitRequested; Task programStart = programToHost.StartAsync(); HandleExceptions(programStart); return(m_wpfApplication.Run()); } finally { //it is good practice to unsubscribe from events on objects that have longer lifetimes than the event handler programToHost.ExitRequested -= programToHost_ExitRequested; } }
/// <summary> /// Runs the application /// </summary> public int Run(IAsynchronousHostableProgram programToHost) { try { programToHost.ExitRequested += programToHost_ExitRequested; Task programStart = programToHost.StartAsync(); HandleExceptions(programStart); return m_wpfApplication.Run(); } finally { //it is good practice to unsubscribe from events on objects that have longer lifetimes than the event handler programToHost.ExitRequested -= programToHost_ExitRequested; } }