예제 #1
0
파일: Project.cs 프로젝트: mff-uk/exolutio
        /// <summary>
        /// Creates the version manager and delcares the existing content as the virst version of the project.
        /// </summary>
        public void StartVersioning(int firstVersionNumber = 1, string firstVersionLabel = "v1")
        {
            VersionManager = new VersionManager(this);

            Version firstVersion = new Version(this)
            {
                Label = firstVersionLabel, Number = firstVersionNumber
            };

            VersionManager.Versions.Add(firstVersion);
            ProjectVersion firstProjectVersion = this.SingleVersion;

            firstProjectVersion.Version = firstVersion;
            this.SingleVersion          = null;

            /* direct property base assignment is used to prevent
             * methods reacting to the change of "UsesVersioning"
             * property during an incoherent state */
            usesVersioning = true;
            ProjectVersions.Add(firstProjectVersion);

            foreach (IVersionedItem versionedItem in ModelIterator.GetAllModelItems(firstProjectVersion).OfType <IVersionedItem>())
            {
                firstVersion.Items.Add(versionedItem);
                VersionManager.AddVersionedItem(versionedItem);
            }

            /* Now listeners to the change of "UsesVersioning" can be notified */
            UsesVersioning = true;
        }