Ejemplo n.º 1
0
        void FillBranches(WorkspaceInfo wkInfo, string query, List <RepObjectInfo> branchesToSelect)
        {
            if (mIsRefreshing)
            {
                return;
            }

            mIsRefreshing = true;

            int defaultRow = TableViewOperations.
                             GetFirstSelectedRow(mBranchesListView);

            ((IProgressControls)mProgressControls).ShowProgress(
                PlasticLocalization.GetString(
                    PlasticLocalization.Name.LoadingBranches));

            ViewQueryResult queryResult = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                queryResult = new ViewQueryResult(
                    PlasticGui.Plastic.API.FindQuery(wkInfo, query));
            },
                /*afterOperationDelegate*/ delegate
            {
                try
                {
                    if (waiter.Exception != null)
                    {
                        ExceptionsHandler.DisplayException(waiter.Exception);
                        return;
                    }

                    UpdateBranchesList(
                        mBranchesListView,
                        queryResult);

                    int branchesCount = GetBranchesCount(queryResult);

                    if (branchesCount == 0)
                    {
                        return;
                    }

                    BranchesSelection.SelectBranches(
                        mBranchesListView, branchesToSelect, defaultRow);
                }
                finally
                {
                    ((IProgressControls)mProgressControls).HideProgress();
                    mIsRefreshing = false;
                }
            });
        }
Ejemplo n.º 2
0
        void FillChangesets(WorkspaceInfo wkInfo, string query)
        {
            if (mIsRefreshing)
            {
                return;
            }

            mIsRefreshing = true;

            List <RepObjectInfo> changesetsToSelect =
                ChangesetsSelection.GetSelectedRepObjectInfos(mChangesetsListView);

            int defaultRow = TableViewOperations.
                             GetFirstSelectedRow(mChangesetsListView);

            ((IProgressControls)mProgressControls).ShowProgress(
                PlasticLocalization.GetString(
                    PlasticLocalization.Name.LoadingChangesets));

            long            loadedChangesetId = -1;
            ViewQueryResult queryResult       = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                queryResult = new ViewQueryResult(
                    PlasticGui.Plastic.API.FindQuery(wkInfo, query));

                loadedChangesetId = GetLoadedChangesetId(
                    wkInfo, mIsGluonMode);
            },
                /*afterOperationDelegate*/ delegate
            {
                try
                {
                    if (waiter.Exception != null)
                    {
                        ExceptionsHandler.DisplayException(waiter.Exception);
                        return;
                    }

                    int changesetsCount = GetChangesetsCount(queryResult);

                    mChangesetsLabelText = string.Format(
                        PlasticLocalization.GetString(PlasticLocalization.Name.ChangesetsCount),
                        changesetsCount);

                    UpdateChangesetsList(
                        mChangesetsListView,
                        queryResult,
                        loadedChangesetId);

                    if (changesetsCount == 0)
                    {
                        mDiffPanel.ClearInfo();
                        return;
                    }

                    ChangesetsSelection.SelectChangesets(
                        mChangesetsListView, changesetsToSelect, defaultRow);
                }
                finally
                {
                    ((IProgressControls)mProgressControls).HideProgress();
                    mIsRefreshing = false;
                }
            });
        }