Пример #1
0
        public async Task <bool> Refresh()
        {
            DateTime start = DateTime.Now;

            AddLog("Refreshing Directory: " + Directory);
            repository_tab_.EnterLoadingScreen();

            if (RefreshBranch() == false)
            {// invalid repository
                repository_tab_.LeaveLoadingScreen();
                repository_tab_.EnterFailedScreen();
                git_ = null;
                return(false);
            }

            DirectoryTree.ReloadTreeView();

            Task <List <string> > git_porcelain_result = git_.GetGitStatusPorcelainAllAsync();
            Task <int>            stashTabResult       = _stashTabViewModel.RefreshAndGetStashCount();
            Task branchTabResult = _branchTabViewModel.Refresh();
            Task tagTabResult    = _tagTabViewModel.Refresh();
            Task remoteTabResult = _remoteTabViewModel.Refresh();

            _pendingTabViewModel.RefreshPending(await git_porcelain_result);

            int stashListCount = await stashTabResult;

            if (stashListCount > 0)
            {
                StashTabHeader = $"Stash [{stashListCount}]";
            }
            else
            {
                StashTabHeader = "Stash";
            }
            NotifyPropertyChanged("StashTabHeader");
            await branchTabResult;
            await remoteTabResult;
            await tagTabResult;

            AddLog("Refreshed");

            repository_tab_.LeaveLoadingScreen();

            if (System.Diagnostics.Debugger.IsAttached)
            {
                TimeSpan elapsed = DateTime.Now - start;
                AddLog($"Refresh elapsed: {elapsed.TotalMilliseconds}");
            }

            return(true);
        }