Exemplo n.º 1
0
        private async void APILogonHandler(Common.APIData logonResponse, string apiKey, string host)
        {
            if (logonResponse.status == "success")
            {
                if (rememberMeBox.Checked)
                {
                    Settings.Default.savedApiKey = apiKey;
                    Settings.Default.savedHost   = Common.baseUrl;
                    Settings.Default.rememberMe  = true;
                    Settings.Default.Save();
                }

                Settings.Default.currentApiKey = apiKey;
                Settings.Default.currentUser   = logonResponse.response;

                BeginInvoke((Action) delegate
                {
                    gt.HideSync(loginBtn, true, Animation.Scale);
                    statusLabel.Text = $"Welcome aboard, {logonResponse.response}!";
                    statusLabel.Left = (Width - statusLabel.Width) / 2;
                    gt.ShowSync(statusLabel, false, Animation.Transparent);
                    Height = Height - 55;
                });

                await Task.Delay(1500);

                BeginInvoke((Action) delegate
                {
                    gt.HideSync(statusLabel, false, Animation.Transparent);
                    statusLabel.Text = "Enhancing your experience...";
                    statusLabel.Left = (Width - statusLabel.Width) / 2;
                    gt.ShowSync(statusLabel, false, Animation.Transparent);
                });

                await Task.Delay(1000);

                BeginInvoke((Action) delegate
                {
                    var ssMain = new StarSyncMain(logonResponse.response);
                    ssMain.Show();
                    Hide();
                });
            }

            else
            {
                BeginInvoke((Action) delegate
                {
                    gt.HideSync(genericLoading, false, Animation.Scale);
                    statusLabel.Text = "Login failed!";
                    statusLabel.Left = (Width - statusLabel.Width) / 2;
                    gt.ShowSync(statusLabel, false, Animation.Transparent);
                    loginBtn.Enabled = true;
                });
            }
        }
Exemplo n.º 2
0
 public SyncSubForm(StarSyncMain referer_ssMain, string refererAction = null)
 {
     InitializeComponent();
     ssMain = referer_ssMain;
     action = refererAction;
 }