public SettingsPanelViewModel(
            IConfigProvider <SourceControlSettings> configService,
            IFolderBrowserFactory folderBrowserFactory,
            IOpenFileDialog openFileDialog)
        {
            _configService        = configService;
            _folderBrowserFactory = folderBrowserFactory;
            _config = _configService.Create();

            _openFileDialog                 = openFileDialog;
            _openFileDialog.Filter          = "Executables (*.exe)|*.exe|All files (*.*)|*.*";
            _openFileDialog.Multiselect     = false;
            _openFileDialog.ReadOnlyChecked = true;
            _openFileDialog.CheckFileExists = true;

            UserName     = _config.UserName;
            EmailAddress = _config.EmailAddress;
            DefaultRepositoryLocation = _config.DefaultRepositoryLocation;
            CommandPromptLocation     = _config.CommandPromptLocation;

            _showDefaultRepoFolderPickerCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowDefaultRepoFolderPicker());
            _showCommandPromptExePickerCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowCommandPromptExePicker());
            _cancelSettingsChangesCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CancelSettingsChanges());
            _updateSettingsCommand    = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => UpdateSettings());
            _showGitIgnoreCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowGitIgnore(), _ => Provider != null);
            _showGitAttributesCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowGitAttributes(), _ => Provider != null);
        }
Beispiel #2
0
        public SourceControlViewViewModel(
            VBE vbe,
            RubberduckParserState state,
            ISinks sinks,
            ISourceControlProviderFactory providerFactory,
            IFolderBrowserFactory folderBrowserFactory,
            IConfigProvider <SourceControlSettings> configService,
            IEnumerable <IControlView> views,
            ICodePaneWrapperFactory wrapperFactory,
            IMessageBox messageBox)
        {
            _vbe                  = vbe;
            _state                = state;
            _sinks                = sinks;
            _providerFactory      = providerFactory;
            _folderBrowserFactory = folderBrowserFactory;

            _state.StateChanged += _state_StateChanged;

            _configService  = configService;
            _config         = _configService.Create();
            _wrapperFactory = wrapperFactory;
            _messageBox     = messageBox;

            _initRepoCommand            = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => InitRepo(), _ => _vbe.VBProjects.Count != 0);
            _openRepoCommand            = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => OpenRepo(), _ => _vbe.VBProjects.Count != 0);
            _cloneRepoCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowCloneRepoGrid(), _ => _vbe.VBProjects.Count != 0);
            _publishRepoCommand         = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowPublishRepoGrid(), _ => _vbe.VBProjects.Count != 0 && Provider != null);
            _refreshCommand             = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => Refresh());
            _dismissErrorMessageCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => DismissErrorMessage());
            _showFilePickerCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowFilePicker());
            _loginGridOkCommand         = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseLoginGrid(), text => !string.IsNullOrEmpty((string)text));
            _loginGridCancelCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseLoginGrid());

            _cloneRepoOkButtonCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloneRepo(), _ => !IsNotValidCloneRemotePath);
            _cloneRepoCancelButtonCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseCloneRepoGrid());

            _publishRepoOkButtonCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => PublishRepo(), _ => !IsNotValidPublishRemotePath);
            _publishRepoCancelButtonCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ClosePublishRepoGrid());

            _openCommandPromptCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => OpenCommandPrompt());

            _sinks.ComponentAdded   += ComponentAdded;
            _sinks.ComponentRemoved += ComponentRemoved;
            _sinks.ComponentRenamed += ComponentRenamed;
            _sinks.ProjectRemoved   += ProjectRemoved;

            TabItems = new ObservableCollection <IControlView>(views);
            SetTab(SourceControlTab.Changes);

            Status = RubberduckUI.Offline;

            ListenForErrors();

            _fileSystemWatcher = new FileSystemWatcher();
        }
Beispiel #3
0
        public SourceControlViewViewModel(
            VBE vbe,
            RubberduckParserState state,
            ISourceControlProviderFactory providerFactory,
            IFolderBrowserFactory folderBrowserFactory,
            ISourceControlConfigProvider configService,
            [Named("changesView")] IControlView changesView,
            [Named("branchesView")] IControlView branchesView,
            [Named("unsyncedCommitsView")] IControlView unsyncedCommitsView,
            [Named("settingsView")] IControlView settingsView,
            ICodePaneWrapperFactory wrapperFactory,
            IMessageBox messageBox)
        {
            _vbe                  = vbe;
            _state                = state;
            _providerFactory      = providerFactory;
            _folderBrowserFactory = folderBrowserFactory;

            _state.StateChanged += _state_StateChanged;

            _configService  = configService;
            _config         = _configService.Create();
            _wrapperFactory = wrapperFactory;
            _messageBox     = messageBox;

            _initRepoCommand            = new DelegateCommand(_ => InitRepo());
            _openRepoCommand            = new DelegateCommand(_ => OpenRepo());
            _cloneRepoCommand           = new DelegateCommand(_ => ShowCloneRepoGrid());
            _publishRepoCommand         = new DelegateCommand(_ => ShowPublishRepoGrid());
            _refreshCommand             = new DelegateCommand(_ => Refresh());
            _dismissErrorMessageCommand = new DelegateCommand(_ => DismissErrorMessage());
            _showFilePickerCommand      = new DelegateCommand(_ => ShowFilePicker());
            _loginGridOkCommand         = new DelegateCommand(_ => CloseLoginGrid(), text => !string.IsNullOrEmpty((string)text));
            _loginGridCancelCommand     = new DelegateCommand(_ => CloseLoginGrid());

            _cloneRepoOkButtonCommand     = new DelegateCommand(_ => CloneRepo(), _ => !IsNotValidCloneRemotePath);
            _cloneRepoCancelButtonCommand = new DelegateCommand(_ => CloseCloneRepoGrid());

            _publishRepoOkButtonCommand     = new DelegateCommand(_ => PublishRepo(), _ => !IsNotValidPublishRemotePath);
            _publishRepoCancelButtonCommand = new DelegateCommand(_ => ClosePublishRepoGrid());

            TabItems = new ObservableCollection <IControlView>
            {
                changesView,
                branchesView,
                unsyncedCommitsView,
                settingsView
            };
            SetTab(SourceControlTab.Changes);

            Status = RubberduckUI.Offline;

            ListenForErrors();

            _fileSystemWatcher = new FileSystemWatcher();
        }
        public SettingsPresenter(ISettingsView view, IConfigurationService<SourceControlConfiguration> configService, IFolderBrowserFactory folderBrowserFactory)
        {
            _configurationService = configService;
            _folderBrowserFactory = folderBrowserFactory;

            _view = view;

            _view.BrowseDefaultRepositoryLocation += OnBrowseDefaultRepositoryLocation;
            _view.Cancel += OnCancel;
            _view.EditIgnoreFile += OnEditIgnoreFile;
            _view.EditAttributesFile += OnEditAttributesFile;
            _view.Save += OnSave;
        }
        public SettingsPresenter(ISettingsView view, IConfigurationService <SourceControlConfiguration> configService, IFolderBrowserFactory folderBrowserFactory)
        {
            _configurationService = configService;
            _folderBrowserFactory = folderBrowserFactory;

            _view = view;

            _view.BrowseDefaultRepositoryLocation += OnBrowseDefaultRepositoryLocation;
            _view.Cancel             += OnCancel;
            _view.EditIgnoreFile     += OnEditIgnoreFile;
            _view.EditAttributesFile += OnEditAttributesFile;
            _view.Save += OnSave;
        }
        public SourceControlViewViewModel(
            IVBE vbe,
            RubberduckParserState state,
            ISourceControlProviderFactory providerFactory,
            IFolderBrowserFactory folderBrowserFactory,
            IConfigProvider <SourceControlSettings> configService,
            IEnumerable <IControlView> views,
            IMessageBox messageBox,
            IEnvironmentProvider environment)
        {
            _vbe                  = vbe;
            _state                = state;
            _providerFactory      = providerFactory;
            _folderBrowserFactory = folderBrowserFactory;

            _configService = configService;
            _config        = _configService.Create();
            _messageBox    = messageBox;
            _environment   = environment;

            InitRepoCommand            = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => InitRepo(), _ => _vbe.VBProjects.Count != 0);
            OpenRepoCommand            = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => OpenRepo(), _ => _vbe.VBProjects.Count != 0);
            CloneRepoCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowCloneRepoGrid(), _ => _vbe.VBProjects.Count != 0);
            PublishRepoCommand         = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowPublishRepoGrid(), _ => _vbe.VBProjects.Count != 0 && Provider != null);
            RefreshCommand             = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => Refresh());
            DismissErrorMessageCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => DismissErrorMessage());
            ShowFilePickerCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowFilePicker());
            LoginGridOkCommand         = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseLoginGrid(), text => !string.IsNullOrEmpty((string)text));
            LoginGridCancelCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseLoginGrid());

            CloneRepoOkButtonCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloneRepo(), _ => !IsNotValidCloneRemotePath);
            CloneRepoCancelButtonCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseCloneRepoGrid());

            PublishRepoOkButtonCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => PublishRepo(), _ => !IsNotValidPublishRemotePath);
            PublishRepoCancelButtonCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ClosePublishRepoGrid());

            OpenCommandPromptCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => OpenCommandPrompt());

            AddComponentEventHandlers();

            TabItems = new ObservableCollection <IControlView>(views);
            SetTab(SourceControlTab.Changes);

            Status = RubberduckUI.Offline;

            ListenForErrors();

            _fileSystemWatcher = new FileSystemWatcher();
        }
        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 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 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 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);
        }
Beispiel #11
0
        public SourceControlViewViewModel(
            VBE vbe,
            ISourceControlProviderFactory providerFactory,
            IFolderBrowserFactory folderBrowserFactory,
            IConfigurationService <SourceControlConfiguration> configService,
            [Named("changesView")] IControlView changesView,
            [Named("branchesView")] IControlView branchesView,
            [Named("unsyncedCommitsView")] IControlView unsyncedCommitsView,
            [Named("settingsView")] IControlView settingsView,
            ICodePaneWrapperFactory wrapperFactory)
        {
            _vbe                  = vbe;
            _providerFactory      = providerFactory;
            _folderBrowserFactory = folderBrowserFactory;

            _configService  = configService;
            _config         = _configService.LoadConfiguration();
            _wrapperFactory = wrapperFactory;

            _initRepoCommand            = new DelegateCommand(_ => InitRepo());
            _openRepoCommand            = new DelegateCommand(_ => OpenRepo());
            _cloneRepoCommand           = new DelegateCommand(_ => ShowCloneRepoGrid());
            _refreshCommand             = new DelegateCommand(_ => Refresh());
            _dismissErrorMessageCommand = new DelegateCommand(_ => DismissErrorMessage());
            _showFilePickerCommand      = new DelegateCommand(_ => ShowFilePicker());
            _closeLoginGridCommand      = new DelegateCommand(_ => CloseLoginGrid());

            _cloneRepoOkButtonCommand     = new DelegateCommand(_ => CloneRepo(), _ => !IsNotValidRemotePath);
            _cloneRepoCancelButtonCommand = new DelegateCommand(_ => CloseCloneRepoGrid());

            TabItems = new ObservableCollection <IControlView>
            {
                changesView,
                branchesView,
                unsyncedCommitsView,
                settingsView
            };
            Status = RubberduckUI.Offline;

            ListenForErrors();
        }
Beispiel #12
0
 public ExportAllCommand(IVBE vbe, IFolderBrowserFactory folderBrowserFactory) : base(LogManager.GetCurrentClassLogger())
 {
     _vbe     = vbe;
     _factory = folderBrowserFactory;
 }
Beispiel #13
0
 public FileCollector(IFolderBrowserFactory folderBrowserFactory)
 {
     this.folderBrowserFactory = folderBrowserFactory;
     files = new List <string>();
 }