Exemplo n.º 1
0
        private void SingleSignOn_SSOFinished(object sender, SSOEventArgs e)
        {
            // The SSOFinished event handler is called from another thread, therefore Invoke is required:
            this.tabPageNexusMods.Invoke(new Action(() => {
                if (e.success)
                {
                    NexusMods.User.APIKey = e.APIKey;
                    MsgBox.Popup("Success", "You are now logged in with your NexusMods account.", MessageBoxIcon.Information);
                    UpdateNMProfile();
                }
                else
                {
                    if (e.Exception != null)
                    {
                        if (e.Exception is PlatformNotSupportedException)
                        {
                            MsgBox.Show("Failed", "** WebSockets are not supported on Windows 7 and older. **\nBut you can still enter the API key manually to login. Please follow the instructions on the GitHub wiki.", MessageBoxIcon.Error);
                        }
                        else
                        {
                            MsgBox.Show("Failed", $"{e.Exception.GetType()}: {e.Exception.Message}", MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MsgBox.Popup("Failed", "Something went wrong.", MessageBoxIcon.Error);
                    }

                    APIKeyTextboxEnabled = true;
                    RefreshNMUI();
                }
            }));
        }
Exemplo n.º 2
0
 private void SSO_Update(object sender, SSOEventArgs e)
 {
     if (null == _owp)
     {
         return;
     }
     _owp.OutputString(e.Source + ": " + e.Message);
 }