Ejemplo n.º 1
0
        public EditorViewModel(CompletePhrase phrase)
        {
            this.PhraseResult = new PhraseReference.Phrase();
            this.PhraseResult.phraseId = phrase.Phrase.phraseId;
            this.PhraseResult.AutorId = phrase.Phrase.AutorId;
            this.PhraseResult.OriginId = phrase.Phrase.OriginId;
            this.PhraseResult.TranslationId = phrase.Phrase.TranslationId;

            this.TranslationResult = new TranslationReference.Translation();
            this.TranslationResult.TranslationId = phrase.Translation.TranslationId;
            this.TranslationResult.LanguageId = phrase.Translation.LanguageId;
            this.TranslationResult.Lexicon = phrase.Translation.Lexicon;
            this.TranslationResult.TranslationContent = phrase.Translation.TranslationContent;
            this.TranslationResult.TranslationDescription = phrase.Translation.TranslationDescription;
            this.TranslationResult.TranslationFirstLetter = phrase.Translation.TranslationFirstLetter;
            this.TranslationResult.PhraseId = phrase.Translation.PhraseId;
            this.TranslationResult.PhraseByDefault = phrase.Translation.PhraseByDefault;

            this.Languages = new ObservableCollection<LanguageReference.Language>();
            this.Autors = new ObservableCollection<AutorReference.Autor>();
            this.Origins = new ObservableCollection<OriginReference.Origin>();
            this.ValidationMessage = string.Empty;

            _languageClient = new LanguageReference.LanguageServiceClient();
            _languageClient.DisplayLanguagesCompleted += DisplayListLanguageComplete;
            _languageClient.DisplayLanguagesAsync();

            _autorClient = new AutorReference.AutorServiceClient();
            _autorClient.DisplayAutorsCompleted += DisplayListAutorComplete;
            _autorClient.DisplayAutorsAsync();

            _originClient = new OriginReference.OriginServiceClient();
            _originClient.DisplayOriginsCompleted += DisplayListOriginComplete;
            _originClient.DisplayOriginsAsync();
        }
Ejemplo n.º 2
0
        public HomeViewModel()
        {
            this.Autors = new ObservableCollection<AutorReference.Autor>();

            this.CreateAutorCommand = new DelegateCommand(AddAutor_Execute, AddAutor_CanExecute);
            this.EditAutorCommand = new DelegateCommand(EditAutor_Execute, EditAutor_CanExecute);
            this.DeleteAutorCommand = new DelegateCommand(DeleteAutor_Execute, DeleteAutor_CanExecute);

            _autorClient = new AutorReference.AutorServiceClient();
            _autorClient.CreateAutorCompleted += CreateAutorComplete;
            _autorClient.DisplayAutorsCompleted += DisplayListAutorComplete;
            _autorClient.EditAutorCompleted += EditAutorComplete;
            _autorClient.DeleteAutorCompleted += DeleteAutorComplete;

            _autorClient.DisplayAutorsAsync();

            _messageBoxService = new MessageBoxService();
            _modalDialogService = new ModalDialogService();
            _informationDialogService = new ModalDialogService();
        }