/// <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) { CopyBase.Copy(this, target, typeof(ICard), progressDelegate); //copy media objects ICard targetCard = target as ICard; if (targetCard != null) { foreach (IMedia media in QuestionMedia) { targetCard.AddMedia(media, Side.Question); } foreach (IMedia media in AnswerMedia) { targetCard.AddMedia(media, Side.Answer); } try { if (targetCard is MLifter.DAL.XML.XmlCard) { (targetCard as MLifter.DAL.XML.XmlCard).Id = Id; } } catch (Exception ex) { Trace.WriteLine("Tried to set the card id for XML but failed: " + ex.ToString()); } } }
/// <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(ICards source, ICards target, CopyToProgress progressDelegate) { source.Parent.GetParentDictionary().Chapters.CopyTo(target.Parent.GetParentDictionary().Chapters, progressDelegate); CopyBase.Copy(source, target, typeof(ICards), progressDelegate); int counter = 0; int count = source.Cards.Count - (CardIdsNotToCopy != null ? CardIdsNotToCopy.Count : 0); Dictionary <int, int> chapterMappings = target.Parent.GetParentDictionary().Parent.Properties[ParentProperty.ChapterMappings] as Dictionary <int, int>; foreach (ICard card in source.Cards) { if (CardIdsNotToCopy != null && CardIdsNotToCopy.Contains(card.Id)) { continue; } ++counter; if (progressDelegate != null && counter % 5 == 0) { progressDelegate.Invoke(String.Format(Properties.Resources.CARDS_COPYTO_STATUS, counter, count), counter * 1.0 / count * 100); } ICard newCard = target.AddNew(); card.CopyTo(newCard, progressDelegate); newCard.Chapter = chapterMappings[card.Chapter]; } }
/// <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) { CopyBase.Copy(this, target, typeof(IDictionary), progressDelegate); //copy extensions foreach (IExtension extension in Extensions) { IExtension newExtension = ((IDictionary)target).ExtensionFactory(extension.Id); extension.CopyTo(newExtension, progressDelegate); } }
/// <summary> /// Copies this instance to the specified target. /// </summary> /// <param name="target">The target.</param> /// <param name="progressDelegate">The progress delegate.</param> public void CopyTo(MLifter.DAL.Tools.ICopy target, CopyToProgress progressDelegate) { IChapter targetChapter = target as IChapter; if (targetChapter != null && targetChapter.Settings == null && this.Settings != null) { targetChapter.Settings = targetChapter.Parent.GetParentDictionary().CreateSettings(); } CopyBase.Copy(this, target, typeof(IChapter), progressDelegate); }
/// <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) { CopyBase.Copy(this, target, typeof(ICardStyle), progressDelegate); if (target is DbCardStyle) { CopyMediaTo((DbCardStyle)target); } if (target is DbCardStyle) { ((DbCardStyle)target).FlushToDB(); } }
public static void Copy(ISettings source, ISettings target, CopyToProgress progressDelegate) { try { if (!(source is XmlAllowedSettings) && source.Style != null && target.Style == null) { target.Style = target.Parent.GetParentDictionary().CreateCardStyle(); } } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } CopyBase.Copy(source, target, typeof(ISettings), progressDelegate); try { if (source is XmlChapterSettings || source is XmlCardSettings || source is XmlAllowedSettings || source.Logo == null) { target.Logo = null; } else { target.Logo = GetNewMedia(source.Logo, target); } } catch { } try { if (!(source is XmlChapterSettings || source is XmlCardSettings || source is XmlAllowedSettings)) { Dictionary <CommentarySoundIdentifier, IMedia> cSounds = new Dictionary <CommentarySoundIdentifier, IMedia>(); foreach (KeyValuePair <CommentarySoundIdentifier, IMedia> pair in source.CommentarySounds) { cSounds.Add(pair.Key, GetNewMedia(pair.Value, target)); } target.CommentarySounds = cSounds; } } catch { } }
/// <summary> /// Copies to. /// </summary> /// <param name="target">The target.</param> /// <param name="progressDelegate">The progress delegate.</param> /// <remarks>Documented by Dev03, 2009-03-23</remarks> public void CopyTo(ICopy target, CopyToProgress progressDelegate) { CopyBase.Copy(this, target, typeof(ICard), progressDelegate); //copy media objects ICard targetCard = target as ICard; if (targetCard != null) { foreach (IMedia media in QuestionMedia) { targetCard.AddMedia(media, Side.Question); } foreach (IMedia media in AnswerMedia) { targetCard.AddMedia(media, Side.Answer); } } }
/// <summary> /// Copies this instance to the specified target. /// </summary> /// <param name="target">The target.</param> /// <param name="progressDelegate">The progress delegate.</param> public void CopyTo(ICopy target, CopyToProgress progressDelegate) { CopyBase.Copy(this, target, typeof(IExtension), progressDelegate); //copy data stream using (Stream data = this.Data) { if (data != null) { ((IExtension)target).Data = data; } } //copy actions IList <ExtensionAction> actions = ((IExtension)target).Actions; actions.Clear(); foreach (ExtensionAction action in this.Actions) { actions.Add(action); } }
public void CopyTo(MLifter.DAL.Tools.ICopy target, CopyToProgress progressDelegate) { CopyBase.Copy(this, target, typeof(IGradeSynonyms), progressDelegate); }
/// <summary> /// Copies this instance to the specified target. /// </summary> /// <param name="target">The target.</param> /// <param name="progressDelegate">The progress delegate.</param> public void CopyTo(MLifter.DAL.Tools.ICopy target, CopyToProgress progressDelegate) { CopyBase.Copy(this, target, typeof(ISnoozeOptions), progressDelegate); }
public void CopyTo(MLifter.DAL.Tools.ICopy target, CopyToProgress progressDelegate) { CopyBase.Copy(this, target, typeof(IQueryMultipleChoiceOptions), progressDelegate); }
/// <summary> /// Copies this instance to the specified target. /// </summary> /// <param name="target">The target.</param> /// <param name="progressDelegate">The progress delegate.</param> public void CopyTo(MLifter.DAL.Tools.ICopy target, CopyToProgress progressDelegate) { CopyBase.Copy(this, target, typeof(IQueryType), progressDelegate); }
public void CopyTo(MLifter.DAL.Tools.ICopy target, MLifter.DAL.Tools.CopyToProgress progressDelegate) { CopyBase.Copy(this as ISettings, target, typeof(ISettings), progressDelegate); }