-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
49 lines (47 loc) · 1.5 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Backupr.Properties;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
namespace Backupr
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
ServicePointManager.DefaultConnectionLimit = 1000;
//FindServicePoint(new Uri(service)).ConnectionLimit = 50;
if (Settings.Default.OAuthToken == null)
{
var dlg = new AuthWindow();
if (dlg.ShowDialog() != true)
{
this.Shutdown();
return;
}
MainWindow = new MainWindow();
}
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
base.OnStartup(e);
}
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
if (MainWindow is MainWindow)
{
((MainWindow)MainWindow).AddError(e);
}
if (MessageBox.Show(e.Exception.Message+"\nDo you want to continue?", "Error", MessageBoxButton.YesNo, MessageBoxImage.Stop)!=MessageBoxResult.Yes)
{
Shutdown();
}
}
}
}