Ejemplo n.º 1
0
        private void SlowMethod()
        {
//			Thread.Sleep (5000);
//
//							if (mAnimation.HasEnded) {
//				activity.RunOnUiThread(() => Toast.MakeText(context, @"Animation End", ToastLength.Short).Show());
//							} else {
//				activity.RunOnUiThread(() =>Toast.MakeText(context, @"Animation NOT End", ToastLength.Short).Show());
//							}

            //user.username = @"Zvezdova957";
            //user.password = @"624590701";

            user.username = tvUsername.Text;
            user.password = tvPassword.Text;

            bool isAuth = false;

            if (true)
            {
                isAuth = onlineAuth(user.username, user.password);
            }
            else
            {
                isAuth = offlineAuth(user.username, user.password);
            }

            if (isAuth)
            {
                //Toast.MakeText(context, @"Authentificated", ToastLength.Short).Show())

                WriteInfo(@"Обновление внутренних данных", 2000);
                try {
                    Common.SetCurrentUser(user);
                    PharmacyManager.Refresh();
                    AttendanceManager.Refresh();
                    AttendancePhotoManager.Refresh();
                    AttendanceResultManager.Refresh();
                    SyncQueueManager.Refresh();
                } catch (Exception ex) {
                    Log.Error(@"Login", ex.Message);
                    WriteDanger(@"ОШИБКА! ВХОД НЕ ВЫПОЛНЕН", 3000);
                    return;
                }
                WriteSuccess(@"ВХОД ВЫПОЛНЕН УСПЕШНО", 3000);
                Dismiss();
                OnSuccessSignedIn(EventArgs.Empty);
//				MessageBox.Show();
            }
            else
            {
                activity.RunOnUiThread(() => Toast.MakeText(context, @"NOT Authentificated", ToastLength.Short).Show());
                WriteDanger(@"ОШИБКА! ВХОД НЕ ВЫПОЛНЕН", 3000);
//				activity.RunOnUiThread (() => bSignUp.Visibility = ViewStates.Visible);
//				MessageBox.Show(@"NOT Authentificated");
            }

            //RunOnUiThread (() => textview.Text = "Method Complete");
        }