Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public SettingsViewViewModel(
            ISourceControlConfigProvider configService,
            IFolderBrowserFactory folderBrowserFactory)
        {
            _configService        = configService;
            _folderBrowserFactory = folderBrowserFactory;
            _config = _configService.Create();

            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);
        }