public ViewModel() { fileOperating = false; username = "******"; themesList = new ObservableCollection<GenericCard>(); newThemeCard = new ThemeCard(username); }
// All of the functions for the backend #region Functions public ViewModel() { fileOperating = false; username = "******"; themesList = new ObservableCollection <GenericCard>(); newThemeCard = new ThemeCard(username); }
public override void Clone(GenericCard clone) { if (clone != null) { ThemeCard cloneTheme = (ThemeCard)clone; Theme = cloneTheme.Theme; Type = cloneTheme.Type; Author = cloneTheme.Author; } }
public override bool Equals(object obj) { bool isEqual = false; if (obj != null) { ThemeCard checkCard = (ThemeCard)obj; if (Theme.Equals(checkCard.Theme, StringComparison.CurrentCultureIgnoreCase)) { isEqual = true; } } return(isEqual); }
void ParseThemes(XmlNodeList themeList) { string key = CardEnum.Theme.ToString(); if (populatedLists.ContainsKey(key) == false) { populatedLists[key] = new List <GenericCard>(); } ThemeCard newTheme = null; foreach (XmlNode theme in themeList) { newTheme = new ThemeCard(); foreach (XmlNode child in theme.ChildNodes) { switch (child.Name) { case "Author": { newTheme.Author = child.Value; break; } case "Theme": { newTheme.Theme = child.Value; break; } case "Type": { newTheme.Type = child.Value; break; } } } populatedLists[key].Add(newTheme); } }
public void SubmitItem(object card) { if (card != null) { GenericCard cardToSubmit = (GenericCard)card; GenericCard cloneCard = null; ObservableCollection <GenericCard> checkList = null; switch (cardToSubmit.GetStringType()) { case "Theme": { checkList = themesList; cloneCard = new ThemeCard(); break; } default: break; } GenericCard foundCard = null; if (checkList != null) { foreach (GenericCard listedCard in checkList) { if (listedCard.Equals(card)) { foundCard = listedCard; break; } } if (foundCard == null) { cloneCard.Clone(cardToSubmit); checkList.Add(cloneCard); } } } }
void ParseThemes(XmlNodeList themeList) { string key = CardEnum.Theme.ToString(); if (populatedLists.ContainsKey(key) == false) { populatedLists[key] = new List<GenericCard>(); } ThemeCard newTheme = null; foreach(XmlNode theme in themeList) { newTheme = new ThemeCard(); foreach(XmlNode child in theme.ChildNodes) { switch(child.Name) { case "Author": { newTheme.Author = child.Value; break; } case "Theme": { newTheme.Theme = child.Value; break; } case "Type": { newTheme.Type = child.Value; break; } } } populatedLists[key].Add(newTheme); } }
public ThemeCard(ThemeCard clone) : this(clone.Author) { Theme = clone.Theme; Type = clone.Type; }
public void SubmitItem(object card) { if (card != null) { GenericCard cardToSubmit = (GenericCard)card; GenericCard cloneCard = null; ObservableCollection<GenericCard> checkList = null; switch (cardToSubmit.GetStringType()) { case "Theme": { checkList = themesList; cloneCard = new ThemeCard(); break; } default: break; } GenericCard foundCard = null; if(checkList != null) { foreach(GenericCard listedCard in checkList) { if(listedCard.Equals(card)) { foundCard = listedCard; break; } } if(foundCard == null) { cloneCard.Clone(cardToSubmit); checkList.Add(cloneCard); } } } }