示例#1
0
 public NewIncomingChangesUpdater(
     IPlasticTimerBuilder timerBuilder,
     PlasticGui.WorkspaceWindow.CheckIncomingChanges.IUpdateIncomingChanges updateIncomingChanges)
 {
     mTimerBuilder          = timerBuilder;
     mUpdateIncomingChanges = updateIncomingChanges;
 }
示例#2
0
 public static void ForWorkspace(
     WorkspaceInfo wkInfo,
     CancelToken cancelToken,
     PlasticGui.WorkspaceWindow.CheckIncomingChanges.IUpdateIncomingChanges updateIncomingChanges)
 {
     ForWorkspace(
         wkInfo,
         cancelToken,
         new CalculateIncomingChanges(),
         updateIncomingChanges);
 }
示例#3
0
        public static void ForWorkspace(
            WorkspaceInfo wkInfo,
            CancelToken cancelToken,
            PlasticGui.WorkspaceWindow.CheckIncomingChanges.ICalculateIncomingChanges calculateIncomingChanges,
            PlasticGui.WorkspaceWindow.CheckIncomingChanges.IUpdateIncomingChanges updateIncomingChanges)
        {
            bool           areNewChangesAvailable = false;
            RepositoryInfo repInfo           = null;
            BranchInfo     workingBranchInfo = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                if (wkInfo.IsDynamic)
                {
                    CmConnection.Get()
                    .GetWorkspaceHandler()
                    .WaitUntilDynamicWorkspaceIsMounted(
                        wkInfo, TimeSpan.FromSeconds(30));
                }

                workingBranchInfo = Plastic.API.GetWorkingBranch(wkInfo);

                if (cancelToken.IsCancelled())
                {
                    return;
                }

                if (workingBranchInfo == null)
                {
                    return;
                }

                repInfo = Plastic.API.GetRootRepositoryInfo(wkInfo.ClientPath);

                if (repInfo == null)
                {
                    return;
                }

                if (cancelToken.IsCancelled())
                {
                    return;
                }

                areNewChangesAvailable = calculateIncomingChanges.AreNewChangesAvailable(
                    wkInfo, workingBranchInfo);
            },
                /*afterOperationDelegate*/ delegate
            {
                if (cancelToken.IsCancelled())
                {
                    return;
                }

                if (waiter.Exception != null)
                {
                    updateIncomingChanges.Hide();
                    return;
                }

                if (!areNewChangesAvailable)
                {
                    updateIncomingChanges.Hide();
                    return;
                }

                updateIncomingChanges.Show(
                    mInfoText,
                    mActionText,
                    mToolTips,
                    PlasticGui.WorkspaceWindow.CheckIncomingChanges.Severity.Info,
                    PlasticGui.WorkspaceWindow.CheckIncomingChanges.Action.ShowIncomingChanges);
            });
        }