public WordEditorVM(DictionaryEditorVM parentVM, Word word) { this.Word = word; this.DictionaryEditorVM = parentVM; this.wordStorage = DIContainer.Instance.Get<IWordStorage>(); if (this.Word == null) { this.Word = new Word() { ID = Guid.NewGuid(), Language = MainVM.Instance.Language }; this.isNewWord = true; } else this.Word.SavePointer.MakeSavePoint(); this.SaveTranslationCmd = new Command(SaveTranslation); this.AddTranslationCmd = new Command(AddTranslation); this.DeleteTranslationCmd = new Command(DeleteTranslation); this.MoveTranslationUpCmd = new Command(MoveTranslationUp); this.MoveTranslationDownCmd = new Command(MoveTranslationDown); this.SavePhraseCmd = new Command(SavePhrase); this.AddPhraseCmd = new Command(AddPhrase); this.DeletePhraseCmd = new Command(DeletePhrase); this.SaveCmd = new Command(Save); this.CancelCmd = new Command(Cancel); }
private void OpenEditor(object word) { var vm = new DictionaryEditorVM(word as Word); if (this.OnOpenEditor != null) this.OnOpenEditor(this, new ViewModelArgs() { ViewModel = vm }); }