コード例 #1
0
        public PersonViewModel(Person person)
        {
            Argument.IsNotNull(() => person);

            Person = person;
        }
コード例 #2
0
        /// <summary>
        /// Method to invoke when the AddPerson command is executed.
        /// </summary>
        private async Task OnAddPersonExecuteAsync()
        {
            var person = new Person();
            person.LastName = FamilyName;

            // Note that we use the type factory here because it will automatically take care of any dependencies
            // that the PersonViewModel will add in the future
            var typeFactory = this.GetTypeFactory();
            var personViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion<PersonViewModel>(person);
            if (await _uiVisualizerService.ShowDialogAsync(personViewModel) ?? false)
            {
                Persons.Add(person);
            }
        }