Exemplo n.º 1
0
        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);
                }
            }
        }
        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);
                }
            }
        }