private void Edit(object obj) { if (_addEditContactView == null) { if (_selectedContact != null) { _logger.Info("show add/edit contact view"); _addEditContactView = Container.Resolve<AddEditContactView>(); _addEditContactView.Show(); var viewmodel = (AddEditContactViewModel) _addEditContactView.DataContext; viewmodel.OriginalName = _selectedContact.Name; viewmodel.Name = _selectedContact.Name; viewmodel.PublicKey = _selectedContact.PublicKey; viewmodel.KeyFilePath = "No new key file selected, but there is still a key for this contact!"; viewmodel.IsNew = false; } else { _logger.Warn("no contact selected! can not open add/edit contact view"); } } else { _logger.Warn("add/edit contact view already open"); _logger.Info("push view in foreground"); var viewmodel = (AddEditContactViewModel) _addEditContactView.DataContext; viewmodel.OriginalName = _selectedContact.Name; viewmodel.Name = _selectedContact.Name; viewmodel.PublicKey = _selectedContact.PublicKey; viewmodel.KeyFilePath = "No new key file selected, but there is still a key for this contact!"; viewmodel.IsNew = false; _addEditContactView.Focus(); } }
private void OnAddEditContactViewClosedMsg(AddEditContactViewClosedMsg msg) { _logger.Info("set add/edit contact view to null"); _addEditContactView = null; }
private void Add(object obj) { if (_addEditContactView == null) { _logger.Info("show add/edit contact view"); _addEditContactView = Container.Resolve<AddEditContactView>(); _addEditContactView.Show(); var viewmodel = (AddEditContactViewModel) _addEditContactView.DataContext; viewmodel.IsNew = true; } else { _logger.Warn("add/edit contact view already open"); _logger.Info("push view in foreground"); var viewmodel = (AddEditContactViewModel) _addEditContactView.DataContext; viewmodel.IsNew = true; _addEditContactView.Focus(); } }