private void Application_Startup(object sender, StartupEventArgs e) { if (!single.WaitOne(0, true)) { if (mutexShow.WaitOne(10000)) { Thread.Sleep(1000); mutexShow.ReleaseMutex(); } this.Shutdown(); return; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ShutdownMode = ShutdownMode.OnExplicitShutdown; var appId = 4159456; var authWindow = new AuthorizeWindow(appId); authWindow.ShowDialog(); if (authWindow.UserID <= 0) { Current.Shutdown(1488); } tokenID = authWindow.TokenID; userID = authWindow.UserID; Prepare(); }
void Authorize() { AuthorizeWindow authorize = new AuthorizeWindow(); if (authorize.ShowDialog() == true) { this.currentEmployeer = authorize.employees; MessageBox.Show( $"Добро пожаловать, {currentEmployeer.firstName} !" ); } else { MWindow_Closed(null, null); } }//Authorize
public void AuthorizeTwitter() { AuthorizeWindow window = new AuthorizeWindow(); AuthorizeWindowViewModel viewmodel = new AuthorizeWindowViewModel(this._mainWindowViewModel, Internal.ServiceType.Twitter); window.DataContext = viewmodel; window.Owner = this.Dialog; window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; window.ShowDialog(); if (String.IsNullOrEmpty(Settings.Settings.TwitterScreenName)) { this.TwitterScreenName = "Not Connected"; } else { this.TwitterScreenName = "@" + Settings.Settings.TwitterScreenName; } }
private async void Window_Loaded(object sender, RoutedEventArgs e) { if (await userManager.IsAuthorized()) { statisticManager = new StatisticManager(); currentLevel = statisticManager.GetLevels().First(); NewGame(); } else { AuthorizeWindow authorizeWindow = new AuthorizeWindow(); if (authorizeWindow.ShowDialog() == true) { statisticManager = new StatisticManager(); currentLevel = statisticManager.GetLevels().First(); NewGame(); } else { Close(); } } }