/// <summary> /// Removes language from viewModel and model. /// </summary> /// <param name="languageViewModel"></param> public void RemoveLanguage(LingvaViewModel languageViewModel) { Lingva lang = languageViewModel.CurrentLanguage; L.Logger.Debug(string.Format("Removing {0} language from {1}.", lang.Language, lang.Folder)); model.RemoveOldLanguage(lang); }
/// <summary> /// Adds new language to viewmodel and model. /// </summary> /// <param name="languageViewModel"></param> public void AddNewLanguage(LingvaViewModel languageViewModel) { L.Logger.Debug("Adding new language."); // Use copy constructor. Lingva lang = new Lingva(languageViewModel.CurrentLanguage); model.AddNewLanguage(lang); }
/// <summary> /// Changes state of viewModel according to selected language. /// </summary> /// <param name="item"></param> public void SelectLanguage(object item) { L.Logger.Debug("Language is selected."); LingvaViewModel lang = (LingvaViewModel)item; // Let the model know that selected language changed model.SelectLanguage(lang.CurrentLanguage); }
// Equals override public override bool Equals(object obj) { LingvaViewModel item = obj as LingvaViewModel; if (item == null) { return(false); } return(this.currentLanguage.Equals(item.currentLanguage)); }