public void RefreshView() { _config = _configurationService.LoadConfiguration(); _view.UserName = _config.UserName; _view.EmailAddress = _config.EmailAddress; _view.DefaultRepositoryLocation = _config.DefaultRepositoryLocation; }
public void Initialize() { _config = new SourceControlConfiguration(Name, Email, RepoLocation, new List<Repository>()); _configService = new Mock<IConfigurationService<SourceControlConfiguration>>(); _configService.Setup(s => s.LoadConfiguration()).Returns(_config); _folderBrowser = new Mock<IFolderBrowser>(); _folderBrowserFactory = new Mock<IFolderBrowserFactory>(); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny<string>())).Returns(_folderBrowser.Object); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny<string>(), false)).Returns(_folderBrowser.Object); }
private void OnSave(object sender, EventArgs e) { if (_config == null) { _config = _configurationService.LoadConfiguration(); } _config.EmailAddress = _view.EmailAddress; _config.UserName = _view.UserName; _config.DefaultRepositoryLocation = _view.DefaultRepositoryLocation; _configurationService.SaveConfiguration(_config); }
public SourceControlPresenter( VBE vbe, AddIn addin, IConfigurationService<SourceControlConfiguration> configService, ISourceControlView view, IChangesPresenter changesPresenter, IBranchesPresenter branchesPresenter, ISettingsPresenter settingsPresenter, IUnsyncedCommitsPresenter unsyncedPresenter, IFolderBrowserFactory folderBrowserFactory, ISourceControlProviderFactory providerFactory, IFailedMessageView failedMessageView, ILoginView loginView ) : base(vbe, addin, view) { _configService = configService; _config = _configService.LoadConfiguration(); _changesPresenter = changesPresenter; _changesPresenter.ActionFailed += OnActionFailed; _branchesPresenter = branchesPresenter; _branchesPresenter.ActionFailed += OnActionFailed; _settingsPresenter = settingsPresenter; _settingsPresenter.ActionFailed += OnActionFailed; _unsyncedPresenter = unsyncedPresenter; _unsyncedPresenter.ActionFailed += OnActionFailed; _folderBrowserFactory = folderBrowserFactory; _providerFactory = providerFactory; _branchesPresenter.BranchChanged += _branchesPresenter_BranchChanged; _loginView = loginView; _loginView.Confirm += _loginView_Confirm; _failedMessageView = failedMessageView; _failedMessageView.DismissSecondaryPanel += DismissSecondaryPanel; _view = view; _view.SecondaryPanel = _failedMessageView; _view.RefreshData += OnRefreshChildren; _view.OpenWorkingDirectory += OnOpenWorkingDirectory; _view.InitializeNewRepository += OnInitNewRepository; }
public void Initialize() { _view = new Mock<ISettingsView>(); _view.SetupProperty(v => v.UserName, string.Empty); _view.SetupProperty(v => v.EmailAddress, string.Empty); _view.SetupProperty(v => v.DefaultRepositoryLocation, string.Empty); _config = new SourceControlConfiguration(Name, Email, RepoLocation, new List<Repository>()); _configService = new Mock<IConfigurationService<SourceControlConfiguration>>(); _configService.Setup(s => s.LoadConfiguration()).Returns(_config); _folderBrowser = new Mock<IFolderBrowser>(); _folderBrowserFactory = new Mock<IFolderBrowserFactory>(); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny<string>())).Returns(_folderBrowser.Object); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny<string>(), false)).Returns(_folderBrowser.Object); }
public SettingsViewViewModel( IConfigurationService<SourceControlConfiguration> configService, IFolderBrowserFactory folderBrowserFactory) { _configService = configService; _folderBrowserFactory = folderBrowserFactory; _config = _configService.LoadConfiguration(); UserName = _config.UserName; EmailAddress = _config.EmailAddress; DefaultRepositoryLocation = _config.DefaultRepositoryLocation; _showFilePickerCommand = new DelegateCommand(_ => ShowFilePicker()); _cancelSettingsChangesCommand = new DelegateCommand(_ => CancelSettingsChanges()); _updateSettingsCommand = new DelegateCommand(_ => UpdateSettings()); _showGitIgnoreCommand = new DelegateCommand(_ => ShowGitIgnore(), _ => Provider != null); _showGitAttributesCommand = new DelegateCommand(_ => ShowGitAttributes(), _ => Provider != null); }
public void Save() { var repo = new Repository ( "SourceControlTest", @"C:\Users\Christopher\Documents\SourceControlTest", @"https://github.com/ckuhn203/SourceControlTest.git" ); var config = new SourceControlConfiguration( "Chris McClellan", "*****@*****.**", @"C:\users\christopher\documents\", new List<Repository>() {repo} ); var service = new SourceControlConfigurationService(); service.SaveConfiguration(config); }