示例#1
0
        private void ExecuteAddCommand(object obj)
        {
            if (!ServiceManager.Instance.ContactService.IsEditing())
            {
                ContactEditViewModel model = new ContactEditViewModel(true, string.Empty, string.Empty);
                var contactEditView        = new ContactEditView(model);
                var dialogResult           = contactEditView.ShowDialog();
                if (dialogResult != null && dialogResult.Value)
                {
                    var contact = ServiceManager.Instance.ContactService.FindContact(new ContactID(model.ContactSipAddress, IntPtr.Zero));
                    if (contact != null && contact.Fullname == model.ContactName)
                    {
                        return;
                    }

                    ServiceManager.Instance.ContactService.AddLinphoneContact(model.ContactName, model.ContactSipUsername,
                                                                              model.ContactSipAddress);
                }
            }
        }
        public void AddNewContact(HistoryCallEventViewModel callEventViewModel)
        {
            if (!ServiceManager.Instance.ContactService.IsEditing())
            {
                var remote = callEventViewModel.CallEvent.RemoteParty.TrimSipPrefix();
                ContactEditViewModel model = new ContactEditViewModel(false, remote, string.Empty);
                model.ContactName = callEventViewModel.DisplayName;
                var contactEditView = new com.vtcsecure.ace.windows.Views.ContactEditView(model);
                var dialogResult    = contactEditView.ShowDialog();
                if (dialogResult != null && dialogResult.Value)
                {
                    var contact = ServiceManager.Instance.ContactService.FindContact(new ContactID(model.ContactSipAddress, IntPtr.Zero));
                    if (contact != null && contact.Fullname == model.ContactName)
                    {
                        return;
                    }

                    ServiceManager.Instance.ContactService.AddLinphoneContact(model.ContactName, model.ContactSipUsername,
                                                                              model.ContactSipAddress);
                }
            }
        }