Пример #1
0
        private async Task <bool> CheckAutomaticLogin()
        {
            window_LoggedIn = new WindowLoggingIn();
            window_LoggedIn.Show();

            //return;
            await Task.Delay(1000);

            bool goodLogin = await CheckLogin(Properties.Settings.Default.UserEmail, Properties.Settings.Default.UserPassword);

            if (goodLogin)
            {
                await CompleteLogin();

                return(true);
            }
            else
            {
                window_LoggedIn.Close();
                Show();

                Properties.Settings.Default.UserEmail    = string.Empty;
                Properties.Settings.Default.UserPassword = string.Empty;
                Properties.Settings.Default.UserRemember = false;
                Properties.Settings.Default.Save();

                return(false);
            }
        }
Пример #2
0
        private async Task CompleteLogin()
        {
            if (window_LoggedIn == null)
            {
                Hide();

                window_LoggedIn = new WindowLoggingIn();
                window_LoggedIn.Show();
            }

            AppGlobal.User.Shows      = (await AppGlobal.Db.UserShowListAsync()).ListData;
            AppGlobal.User.Categories = (await AppGlobal.Db.UserCategoryListAsync()).ListData;

            window_LoggedIn.Close();

            Window Main = new WindowMain();

            Main.Show();
            Application.Current.MainWindow = Main;

            Close();
        }