コード例 #1
0
        /// <summary>
        /// Logins the user into the current mod repository.
        /// </summary>
        /// <param name="p_vmlViewModel">The view model that provides the data and operations for this view.</param>
        /// <returns><c>true</c> if the user was successfully logged in;
        /// <c>false</c> otherwise</returns>
        protected bool LoginUser()
        {
            var strMessage       = $"You must log into the {ModManager.ModRepository.Name} website.";
            var strCancelWarning = $"If you do not login {CommonData.ModManagerName} will close.";

            _error = _credentialsExpired ? "You need to authorize NMM to access your Nexus Mods profile." : _error;

            AuthenticationFormViewModel = new AuthenticationFormViewModel(ModManager.EnvironmentInfo, ModManager.ModRepository, ModManager.GameMode.ModeTheme, strMessage, _error, strCancelWarning);

            LoginForm = new AuthenticationForm(AuthenticationFormViewModel, this);
            LoginForm.Authenticating += LoginForm_Authenticating;
            LoginForm.ShowDialog();

            switch (Status)
            {
            case TaskStatus.Complete:
                return(true);

            case TaskStatus.Incomplete:
                OverallMessage = "You are not logged in.";
                break;
            }

            return(false);
        }
コード例 #2
0
 /// <summary>
 /// A simple constructor the initializes the object with the given values.
 /// </summary>
 /// <param name="viewModel">The view model that provides the data and operations for this view.</param>
 /// <param name="loginTask"></param>
 public AuthenticationForm(AuthenticationFormViewModel viewModel, AuthenticationFormTask loginTask)
 {
     InitializeComponent();
     FormClosed += LoginForm_FormClosed;
     _loginTask  = loginTask;
     ViewModel   = viewModel;
     _ssoManager = new SsoManager();
     _ssoManager.ApiKeyReceived          += (_, args) => Invoke((Action <string>)OnApiKeyReceived, args.ApiKey);
     _ssoManager.AuthenticationCancelled += OnAuthenticationCancelled;
 }
コード例 #3
0
 public ManualApiKeyEntryForm(AuthenticationFormViewModel viewModel)
 {
     InitializeComponent();
     _viewModel = viewModel;
 }