protected override void OnStartup(StartupEventArgs e) { ShutdownMode = ShutdownMode.OnExplicitShutdown; var locationToCheck = FileLocation; if (!locationToCheck.Exists) { new CreatingDefaultConfigurationFileWindow().ShowDialog(); using (var stream = GetDefaultAppConfigurationStream()) using (var output = locationToCheck.OpenWrite()) { stream.CopyTo(output); } } var exception = AppConfigurationSettings.Load(locationToCheck.FullName); if (exception != null) { MessageBox.Show( exception.ToString(), "Exception while loading app configuration settings"); Shutdown(); return; } MainWindow = new MainWindow(); base.OnStartup(e); }
public static Exception Load(string file) { try { Instance = new AppConfigurationSettings(file); return(null); } catch (Exception e) { return(e); } }