Пример #1
0
        private void OnAddPhoneClicked(object sender, ContactEventArgs args)
        {
            var phoneTypes = args.PhoneTypes;
            var firstType  = phoneTypes.First();
            var model      = new Phone
            {
                Id          = -1,
                PhoneNumber = string.Empty,
                PhoneType   = firstType
            };
            var viewModel = new PhoneViewModel(model, phoneTypes);
            var window    = new PhoneView(viewModel);

            window.ShowDialog();
            if (window.DialogResult.HasValue &&
                window.DialogResult.Value)
            {
                if (viewModel.PhoneSaved)
                {
                    var phone = viewModel.GetModel();
                    _viewModel.AddPhoneToList(model);
                }
            }
        }