예제 #1
0
        /// <summary>
        /// Performs checking out documents from source control</summary>
        /// <param name="doing">True iff doing the command</param>
        /// <returns>True iff any documents checked out or can be checked out</returns>
        protected virtual bool DoCheckOut(bool doing)
        {
            if (SourceControlService == null || !SourceControlService.Enabled ||
                SourceControlContext == null)
            {
                return(false);
            }

            int checkedOutCount = 0;

            foreach (IResource resource in SourceControlContext.Resources)
            {
                if (GetStatus(resource) != SourceControlStatus.CheckedIn)
                {
                    return(false);
                }

                if (SourceControlService.IsLocked(resource.Uri))
                {
                    return(false);
                }
                checkedOutCount++;
                if (doing)
                {
                    SourceControlService.CheckOut(resource.Uri);
                }
            }
            return(checkedOutCount != 0);
        }
예제 #2
0
        /// <summary>
        /// Tests if the resource is checked-in and needs checking out</summary>
        private void TestCheckedIn(object obj)
        {
            if (SourceControlService == null)
            {
                return;
            }
            IResource resource = obj.As <IResource>();

            if (resource == null)
            {
                return;
            }

            if (SourceControlService.GetStatus(resource.Uri) == SourceControlStatus.CheckedIn)
            {
                SourceControlService.CheckOut(resource.Uri);
            }
        }