예제 #1
0
        public RepositoryTab(string git_repository_path)
        {
            git_repository_path_ = git_repository_path;

            InitializeComponent();

            UserControls.PendingTabViewModel pendingTabViewModel = (UserControls.PendingTabViewModel)PendingTab.DataContext;
            UserControls.StashTabViewModel   stashTabViewModel   = (UserControls.StashTabViewModel)StashTab.DataContext;
            UserControls.BranchTabViewModel  branchTabViewModel  = (UserControls.BranchTabViewModel)BranchTab.DataContext;
            UserControls.TagTabViewModel     tagTabViewModel     = (UserControls.TagTabViewModel)TagTab.DataContext;
            UserControls.RemoteTabViewModel  remoteTabViewModel  = (UserControls.RemoteTabViewModel)RemoteTab.DataContext;

            var viewModel = new ViewModels.RepositoryViewModel(git_repository_path,
                                                               this,
                                                               pendingTabViewModel,
                                                               stashTabViewModel,
                                                               branchTabViewModel,
                                                               tagTabViewModel,
                                                               remoteTabViewModel);

            DataContext = viewModel;

            pendingTabViewModel.SetGitRepository(viewModel);
            stashTabViewModel.SetGitRepository(viewModel);
            branchTabViewModel.SetGitRepository(viewModel);
            tagTabViewModel.SetGitRepository(viewModel);
            remoteTabViewModel.SetGitRepository(viewModel);

            IGitRepository gitRepository = viewModel;

            Plugin.PluginController.ConstructPluginToolbarButtons(toolBar, gitRepository);
        }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null)
            {
                return("");
            }
            RemoteTabViewModel remoteTabViewModel = (RemoteTabViewModel)values[0];
            RemoteInfo         selectedRemoteInfo = (RemoteInfo)values[1];

            if (selectedRemoteInfo == null)
            {
                return("");
            }
            string        cmd   = GitCommandCreator.GetRemoteDetail(selectedRemoteInfo.Name);
            List <string> lines = remoteTabViewModel.GitRepo.CreateGitRunner().Run(cmd);

            return(string.Join(Environment.NewLine, lines));
        }