Esempio n. 1
0
        /// <summary>
        /// Copies the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        public static void Copy(IChapters source, IChapters target, CopyToProgress progressDelegate)
        {
            if (target.Parent.GetParentDictionary().Parent.Properties.ContainsKey(ParentProperty.ChapterMappings))
            {
                return;
            }

            Dictionary <int, int> chaperMappings = new Dictionary <int, int>();

            foreach (IChapter chapter in source.Chapters)
            {
                IChapter newChapter = target.AddNew();
                chapter.CopyTo(newChapter, progressDelegate);
                chaperMappings.Add(chapter.Id, newChapter.Id);

                if (source.Parent.GetParentDictionary().DefaultSettings.SelectedLearnChapters.Contains(chapter.Id))
                {
                    target.Parent.GetParentDictionary().DefaultSettings.SelectedLearnChapters.Add(newChapter.Id);
                }
                if (source.Parent.GetParentDictionary().UserSettings.SelectedLearnChapters.Contains(chapter.Id))
                {
                    target.Parent.GetParentDictionary().UserSettings.SelectedLearnChapters.Add(newChapter.Id);
                }
            }

            target.Parent.GetParentDictionary().Parent.Properties[ParentProperty.ChapterMappings] = chaperMappings;
        }
Esempio n. 2
0
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            IChapters targetChapters = target as IChapters;

            if (targetChapters != null)
            {
                ChaptersHelper.Copy(this, targetChapters, progressDelegate);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChapterDictionary"/> class.
 /// </summary>
 /// <param name="dict">The dict.</param>
 /// <remarks>Documented by Dev05, 2007-09-04</remarks>
 public ChapterDictionary(Dictionary dict, IChapters Chapters)
 {
     dictionary = dict;
     this.chapters = Chapters;
 }
Esempio n. 4
0
        /// <summary>
        /// Copies the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        public static void Copy(IChapters source, IChapters target, CopyToProgress progressDelegate)
        {
            if (target.Parent.GetParentDictionary().Parent.Properties.ContainsKey(ParentProperty.ChapterMappings))
                return;

            Dictionary<int, int> chaperMappings = new Dictionary<int, int>();
            foreach (IChapter chapter in source.Chapters)
            {
                IChapter newChapter = target.AddNew();
                chapter.CopyTo(newChapter, progressDelegate);
                chaperMappings.Add(chapter.Id, newChapter.Id);

                if (source.Parent.GetParentDictionary().DefaultSettings.SelectedLearnChapters.Contains(chapter.Id))
                    target.Parent.GetParentDictionary().DefaultSettings.SelectedLearnChapters.Add(newChapter.Id);
                if (source.Parent.GetParentDictionary().UserSettings.SelectedLearnChapters.Contains(chapter.Id))
                    target.Parent.GetParentDictionary().UserSettings.SelectedLearnChapters.Add(newChapter.Id);
            }

            target.Parent.GetParentDictionary().Parent.Properties[ParentProperty.ChapterMappings] = chaperMappings;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChapterDictionary"/> class.
 /// </summary>
 /// <param name="dict">The dict.</param>
 /// <remarks>Documented by Dev05, 2007-09-04</remarks>
 public ChapterDictionary(Dictionary dict, IChapters Chapters)
 {
     dictionary    = dict;
     this.chapters = Chapters;
 }