void App_Exit(object sender, System.Windows.ExitEventArgs e) { if (StartupUri != null && StartupUri.ToString( ).Contains("Blend")) { return; } Messaging.Bus.Instance.Send(new Messaging.AppShutdownMessage( )); BootStrapper.DisposeWithCare( ); m_oSingletonChecker.DisposeWithCare( ); }
private void LoadStartupUri() { if (StartupUri.IsNullOrEmpty()) { return; } XamlElement rootElement = XamlParser.Parse(Granular.Compatibility.String.FromByteArray(EmbeddedResourceLoader.LoadResourceData(StartupUri))); XamlMember classDirective = rootElement.Directives.FirstOrDefault(directive => directive.Name == XamlLanguage.ClassDirective); Window window = Activator.CreateInstance(Type.GetType(String.Format("{0}, {1}", classDirective.GetSingleValue(), GetType().Assembly.GetName().Name))) as Window; if (window != null) { window.Show(); } }
async void App_Startup(object sender, System.Windows.StartupEventArgs e) { // this is a hack to let the any window w/ the word Blend in the name not go thru the startup nonsense. // this lets that different window be used as startup uri on app.xaml for quick "f5" runs out of blend. if (StartupUri != null && StartupUri.ToString( ).Contains("Blend")) { return; } bool bIsFirst = CheckForSingleton( ); HandleArguments(bIsFirst, e.Args); if (!bIsFirst) { this.Shutdown( ); } else { Messaging.Bus.Instance.Send(new Messaging.AppStartedMessage( )); Runner.RunAsync(async( ) => await Start( )); } }