public void CreateNewWindow()
    {
        var view        = new PhoneWindow();
        var viewAdapter = new ViewAdapter(view)
                          var viewModel = new phoneWindowViewModel(viewAdapter);

        //Bind
        view.DataContext = viewModel;

        view.Show();
    }
        private void SetupAddCommand()
        {
            AddCommand = ReactiveCommand.CreateFromTask <Unit, Phone>(async unit =>
            {
                var phoneWindow = new PhoneWindow(new PhoneViewModel());
                if (phoneWindow.ShowDialog() == true)
                {
                    var newPhone   = phoneWindow.PhoneViewModel;
                    var addedPhone = await _repository.AddAsync(newPhone).ConfigureAwait(true);
                    return(addedPhone);
                }

                return(null);
            });

            AddCommand.ObserveOn(MainThreadScheduler).Subscribe(newPhone => { Phones.Add(newPhone); });
            AddCommand.ThrownExceptions.Subscribe(ex => { MessageBox.Show(ex.Message); });
        }
        private void SetupEditCommand()
        {
            EditCommand = ReactiveCommand.CreateFromTask <Unit, Phone>(async unit =>
            {
                var phoneWindow = new PhoneWindow(new PhoneViewModel(SelectedPhone));
                if (phoneWindow.ShowDialog() == true)
                {
                    var phone = await _repository.UpdateAsync(new Phone(phoneWindow.PhoneViewModel)).ConfigureAwait(false);
                    return(phone);
                }

                return(new Phone(SelectedPhone));
            }, this.WhenAny(vm => vm.SelectedPhone, change => change.Value != null));

            EditCommand.ObserveOn(MainThreadScheduler).Subscribe(updatedPhone =>
            {
                SelectedPhone.Price   = updatedPhone.Price;
                SelectedPhone.Company = updatedPhone.Company;
                SelectedPhone.Title   = updatedPhone.Title;
            });

            EditCommand.ThrownExceptions.Subscribe(ex => { MessageBox.Show(ex.Message); });
        }