private async Task Application_StartupAsync() { // This frees up the Ctrl-I input binding for italics AvalonEditCommands.IndentSelection.InputGestures.Clear(); AppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Local = new SQLiteStorage(); await Local.Initialize(); string username = Local.GetUsername().Result; Cloud = new GoogleDriveStorage(username); if (String.IsNullOrWhiteSpace(username)) { App.Current.Dispatcher.Invoke(() => ShowLoginDialog(true)); } else { if (!Cloud.IsInternetConnected() || await Cloud.Connect()) { App.Current.Dispatcher.Invoke(() => ShowMainWindow()); } else { App.Current.Dispatcher.Invoke(() => ShowLoginDialog(false, "Timeout attempting to login. Please try again.")); } } }