Exemple #1
0
        void AsyncCalculateStatus(CancelToken cancelToken)
        {
            Dictionary <string, LockStatusData> statusByPathCache = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                Dictionary <RepositorySpec, List <WorkspaceTreeNode> > lockCandidates =
                    new Dictionary <RepositorySpec, List <WorkspaceTreeNode> >();

                FillLockCandidates.ForTree(mWkInfo, lockCandidates);

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

                Dictionary <WorkspaceTreeNode, LockInfo> lockInfoByNode =
                    SearchLocks.GetLocksInfo(mWkInfo, lockCandidates);

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

                statusByPathCache = BuildStatusByNodeCache.
                                    ForLocks(mWkInfo.ClientPath, lockInfoByNode);
            },
                /*afterOperationDelegate*/ delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.LogException(
                        "LockStatusCache",
                        waiter.Exception);
                    return;
                }

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

                lock (mLock)
                {
                    mStatusByPathCache = statusByPathCache;
                }

                mRepaintProjectWindow();
            });
        }
        void AsyncCalculateStatus(CancelToken cancelToken)
        {
            Dictionary <string, AssetStatus> statusByPathCache = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                OutOfDateItems outOfDateItems =
                    OutOfDateUpdater.CalculateOutOfDateItems(
                        mWkInfo, new List <ErrorMessage>(),
                        OutOfDateCalculator.Options.IsIncomingChanges);

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

                statusByPathCache = BuildStatusByPathCache.
                                    ForOutOfDateItems(outOfDateItems, mWkInfo.ClientPath);
            },
                /*afterOperationDelegate*/ delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.LogException(
                        "RemoteStatusCache",
                        waiter.Exception);
                    return;
                }

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

                lock (mLock)
                {
                    mStatusByPathCache = statusByPathCache;
                }

                mRepaintProjectWindow();
            });
        }
Exemple #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);
            });
        }