private void EditPrimaryContactCommandExecuted() { RaisePropertyChanged("DisableParentWindow"); var window = new AddContactView(_enquiry.PrimaryContact); window.ShowDialog(); if (window.DialogResult != null && window.DialogResult == false) { //_enquiry.PrimaryContact = _originalEnquiry.PrimaryContact; _enquiry.PrimaryContact.Address1 = _originalEnquiry.PrimaryContact.Address1; _enquiry.PrimaryContact.Address2 = _originalEnquiry.PrimaryContact.Address2; _enquiry.PrimaryContact.Address3 = _originalEnquiry.PrimaryContact.Address3; _enquiry.PrimaryContact.City = _originalEnquiry.PrimaryContact.City; _enquiry.PrimaryContact.CompanyName = _originalEnquiry.PrimaryContact.CompanyName; _enquiry.PrimaryContact.Country = _originalEnquiry.PrimaryContact.Country; _enquiry.PrimaryContact.Email = _originalEnquiry.PrimaryContact.Email; _enquiry.PrimaryContact.FirstName = _originalEnquiry.PrimaryContact.FirstName; _enquiry.PrimaryContact.LastName = _originalEnquiry.PrimaryContact.LastName; _enquiry.PrimaryContact.Phone1 = _originalEnquiry.PrimaryContact.Phone1; _enquiry.PrimaryContact.Phone2 = _originalEnquiry.PrimaryContact.Phone2; _enquiry.PrimaryContact.PostCode = _originalEnquiry.PrimaryContact.PostCode; _enquiry.PrimaryContact.Title = _originalEnquiry.PrimaryContact.Title; } else { // _enquiry.PrimaryContact = window.ViewModel.ContactModel; } RaisePropertyChanged("EnableParentWindow"); }
private void EditAlternativeContactCommandExecuted(EventContact obj) { RaisePropertyChanged("DisableParentWindow"); var window = new AddContactView(new ContactModel(obj.Contact)); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); }
private void EditPrimaryContactCommandExecuted() { RaisePropertyChanged("DisableParentWindow"); var window = new AddContactView(_event.PrimaryContact); window.ShowDialog(); if (window.DialogResult != null && window.DialogResult == false) { _event.PrimaryContact = _originalEvent.PrimaryContact.Clone(); } RaisePropertyChanged("EnableParentWindow"); }
private void ShowAddContactWindowCommandExecuted() { RaisePropertyChanged("DisableParentWindow"); var view = new AddContactView(); view.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (view.DialogResult != null && view.DialogResult.Value && view.ViewModel.ContactModel != null) { Contact = view.ViewModel.ContactModel; } }
void InitializeCommands() { SendMessageCommand = new RelayCommand((param) => { SelectedChat.DraftMessage.ChatId = SelectedChat.Chat.ChatId; SelectedChat.DraftMessage.SenderId = NetworkManager.CurrentUser.UserId; SelectedChat.DraftMessage.SendTime = DateTime.Now; SelectedChat.DraftMessage.MessageType = MessageType.Text; NetworkManager.Client.SendMessage(SelectedChat.DraftMessage); SelectedChat.Messages.Add(new MessageModel() { Message = SelectedChat.DraftMessage }); SelectedChat.DraftMessage = new MessageDTO(); }); DisconnectCommand = new RelayCommand((param) => { if (NetworkManager.Client.State == System.ServiceModel.CommunicationState.Opened) { NetworkManager.Client.Disconnect(NetworkManager.CurrentUser); MessageBox.Show("Dis"); } }); AddContactCommand = new RelayCommand((param) => { AddContactView addContactView = new AddContactView(NetworkManager.Client, NetworkManager.CurrentUser) { WindowStartupLocation = WindowStartupLocation.CenterOwner , Owner = Application.Current.MainWindow }; Application.Current.MainWindow.Effect = new BlurEffect(); addContactView.ShowDialog(); Application.Current.MainWindow.Effect = null; }); CreateChatCommand = new RelayCommand((param) => { CreateGroupView createGroupView = new CreateGroupView() { WindowStartupLocation = WindowStartupLocation.CenterOwner , Owner = Application.Current.MainWindow }; Application.Current.MainWindow.Effect = new BlurEffect(); createGroupView.ShowDialog(); Application.Current.MainWindow.Effect = null; }); }
private void ShowAddContactWindowCommandExecuted() { RaisePropertyChanged("DisableParentWindow"); var addContactView = new AddContactView(); addContactView.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (addContactView.DialogResult == null || addContactView.DialogResult != true || addContactView.ViewModel.ContactModel == null) { return; } Contact = addContactView.ViewModel.ContactModel; }
private void AddContactCommandExecuted() { RaisePropertyChanged("DisableParentWindow"); var window = new AddContactView(); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (window.DialogResult != null && window.DialogResult == true) { if (!window.ViewModel.IsExistingContact) { _allContacts.Add(window.ViewModel.ContactModel); } Contacts = new ObservableCollection <ContactModel>(_allContacts.OrderBy(x => x.LastName)); SelectedContact = window.ViewModel.IsExistingContact ? Contacts.FirstOrDefault(contact => contact.Contact == window.ViewModel.ContactModel.Contact) : window.ViewModel.ContactModel; RaisePropertyChanged("ScrollToSelectedItem"); } }
private void EditContactCommandExecuted(ContactModel model) { RaisePropertyChanged("DisableParentWindow"); var window = new AddContactView(model, IsFromMembership); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); if (window.DialogResult != null && window.DialogResult == true) { if (IsFromMembership) { _membershipDataUnit.ContactsRepository.RefreshContact(); } else { _contactsDataUnit.ContactsRepository.RefreshContact(); } } }
//add method for contact private void buttonAddContact_Click(object sender, EventArgs e) { Form contactOverlay = new Form(); try { using (AddContactView addContact = new AddContactView()) { addContact.setId(user_id); contactOverlay.StartPosition = FormStartPosition.Manual; contactOverlay.FormBorderStyle = FormBorderStyle.None; contactOverlay.Opacity = .50d; contactOverlay.BackColor = Color.Black; contactOverlay.WindowState = FormWindowState.Maximized; contactOverlay.TopMost = true; contactOverlay.Location = this.Location; contactOverlay.ShowInTaskbar = false; contactOverlay.Show(); addContact.Owner = contactOverlay; addContact.ShowDialog(); contactOverlay.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { contactOverlay.Dispose(); loadContactData(); loadTotalContact(); } }
void OnAddContactClick(object sender, EventArgs e) { var addContactDialogBox = new AddContactView(this, ((ContactsViewModel)this.DataContext).AddContactViewModel); addContactDialogBox.ShowDialog(); }