} // ограничение private async void Authorization(object sender, RoutedEventArgs e) { string login = Login.Text; string password = Password.Password; string badgeError = (string)Application.Current.Resources["NotifyErrorBadgeEN"]; string messageUC = (string)Application.Current.Resources["NotifyUncorrectCredentialsEN"]; string messageSE = (string)Application.Current.Resources["NotifyServerErrorEN"]; string messageEF = (string)Application.Current.Resources["NotifyEmptyFieldsEN"]; if (Properties.Settings.Default.DefaultLanguage.Equals(new CultureInfo("ru-RU"))) { badgeError = (string)Application.Current.Resources["NotifyErrorBadgeRU"]; messageUC = (string)Application.Current.Resources["NotifyUncorrectCredentialsRU"]; messageSE = (string)Application.Current.Resources["NotifyServerErrorRU"]; messageEF = (string)Application.Current.Resources["NotifyEmptyFieldsRU"]; } if (login != "" && password != "") { Loading(true); OperationsResponse response = await UserOperations.CheckAuthorization(login, password); Loading(false); switch (response) { case OperationsResponse.Ok: MainWindow mainWindow = new MainWindow(); // creating MainWindow // creating ViewModel for MainWindow MainWindowViewModel vm = new MainWindowViewModel(login); mainWindow.DataContext = vm; mainWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; mainWindow.Show(); Window.GetWindow(this)?.Close(); // close auth modal window break; case OperationsResponse.UserNotExists: Manager.CreateMessage() .Accent("DeepSkyBlue") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messageUC) .Dismiss().WithDelay(2500) .Queue(); break; case OperationsResponse.ServerError: Manager.CreateMessage() .Accent("#8b0000") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messageSE) .Dismiss().WithDelay(2500) .Queue(); break; } } else { Manager.CreateMessage() .Accent("DeepSkyBlue") .Animates(true) .AnimationInDuration(0.55) .AnimationOutDuration(0.55) .Background("#333") .HasBadge(badgeError) .HasMessage(messageEF) .Dismiss().WithDelay(2500) .Queue(); } } // функция авторизации