public GitOptionsPage(IWorkingEnvironment environment) : this() { Verify.Argument.IsNotNull(environment, nameof(environment)); _repositoryProvider = environment.GetRepositoryProvider <RepositoryProvider>(); ShowGitAccessorProviders(); }
public bool Execute() { string name = _txtName.Text.Trim(); string value = _txtValue.Text.Trim(); if (name.Length == 0) { NotificationService.NotifyInputError( _txtName, Resources.ErrInvalidParameterName, Resources.ErrParameterNameCannotBeEmpty); return(false); } try { using (this.ChangeCursor(Cursors.WaitCursor)) { if (_configFile == ConfigFile.Repository) { var p = _repository.Configuration.TryGetParameter(name); if (p != null) { p.Value = value; } else { _repository.Configuration.CreateParameter(name, value); } } else { var gitRepositoryProvider = _environment.GetRepositoryProvider <IGitRepositoryProvider>(); if (gitRepositoryProvider != null) { gitRepositoryProvider.GitAccessor.SetConfigValue.Invoke( new SetConfigValueParameters(name, value) { ConfigFile = _configFile, }); } } } } catch (GitException exc) { GitterApplication.MessageBoxService.Show( this, exc.Message, Resources.ErrFailedToSetParameter, MessageBoxButton.Close, MessageBoxIcon.Error); return(false); } return(true); }
public UserIdentificationDialog(IWorkingEnvironment environment, Repository repository) { Verify.Argument.IsNotNull(environment, nameof(environment)); _environment = environment; _repository = repository; _repositoryProvider = environment.GetRepositoryProvider <RepositoryProvider>(); InitializeComponent(); Text = Resources.StrUserIdentification; _lblUser.Text = Resources.StrUsername.AddColon(); _lblEmail.Text = Resources.StrEmail.AddColon(); _lblUseThisUserNameAndEmail.Text = Resources.StrsUseThisUserNameAndEmail.AddColon(); _radSetUserGlobally.Text = Resources.StrsForCurrentWindowsUser; _radSetUserForRepositoryOnly.Text = Resources.StrsForCurrentRepositoryOnly; if (repository != null) { var userName = repository.Configuration.TryGetParameter(GitConstants.UserNameParameter); if (userName != null) { _txtUsername.Text = _oldUserName = userName.Value; } else { _txtUsername.Text = Environment.UserName; } var userEmail = repository.Configuration.TryGetParameter(GitConstants.UserEmailParameter); if (userEmail != null) { _txtEmail.Text = _oldUserEmail = userEmail.Value; } else { _txtEmail.Text = string.Format("{0}@{1}", Environment.UserName, Environment.UserDomainName); } } else { _radSetUserForRepositoryOnly.Enabled = false; } GitterApplication.FontManager.InputFont.Apply(_txtUsername, _txtEmail); }
public UserIdentificationDialog(IWorkingEnvironment environment, Repository repository) { Verify.Argument.IsNotNull(environment, "environment"); _environment = environment; _repository = repository; _repositoryProvider = environment.GetRepositoryProvider<RepositoryProvider>(); InitializeComponent(); Text = Resources.StrUserIdentification; _lblUser.Text = Resources.StrUsername.AddColon(); _lblEmail.Text = Resources.StrEmail.AddColon(); _lblUseThisUserNameAndEmail.Text = Resources.StrsUseThisUserNameAndEmail.AddColon(); _radSetUserGlobally.Text = Resources.StrsForCurrentWindowsUser; _radSetUserForRepositoryOnly.Text = Resources.StrsForCurrentRepositoryOnly; if(repository != null) { var userName = repository.Configuration.TryGetParameter(GitConstants.UserNameParameter); if(userName != null) { _txtUsername.Text = _oldUserName = userName.Value; } else { _txtUsername.Text = Environment.UserName; } var userEmail = repository.Configuration.TryGetParameter(GitConstants.UserEmailParameter); if(userEmail != null) { _txtEmail.Text = _oldUserEmail = userEmail.Value; } else { _txtEmail.Text = string.Format("{0}@{1}", Environment.UserName, Environment.UserDomainName); } } else { _radSetUserForRepositoryOnly.Enabled = false; } GitterApplication.FontManager.InputFont.Apply(_txtUsername, _txtEmail); }