public void DeleteContact()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var messageBoxResult = MessageBox.Show(AppResources.ConfirmDeleteContact, AppResources.Confirm, MessageBoxButton.OKCancel);

            if (messageBoxResult != MessageBoxResult.OK)
            {
                return;
            }

            IsWorking = true;
            MTProtoService.DeleteContactAsync(
                CurrentContact.ToInputUser(),
                result =>
            {
                IsWorking = false;
                EventAggregator.Publish(result.User);
                RaiseImportStatusChanged(new ImportEventArgs {
                    Imported = false
                });

                ContactsHelper.DeleteContactAsync(StateService, CurrentContact.Id);
            },
                error =>
            {
                IsWorking = false;
                Execute.ShowDebugMessage("contacts.deleteContact error: " + error);
            });
        }
예제 #2
0
        public void DeleteContact(TLUserBase user)
        {
            if (user == null)
            {
                return;
            }

            MTProtoService.DeleteContactAsync(
                user.ToInputUser(),
                link => BeginOnUIThread(() => Items.Remove(user)),
                error => Execute.ShowDebugMessage("contacts.deleteContact error: " + error));
        }
예제 #3
0
        public void DeleteContact(TLUserBase user)
        {
            if (user == null)
            {
                return;
            }

            MTProtoService.DeleteContactAsync(
                user.ToInputUser(),
                link => Items.Remove(user),
                error =>
            {
            });
        }
예제 #4
0
        public void DeleteContact()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var messageBoxResult = MessageBox.Show(AppResources.ConfirmDeleteContact, AppResources.Confirm, MessageBoxButton.OKCancel);

            if (messageBoxResult != MessageBoxResult.OK)
            {
                return;
            }

            IsWorking = true;
            MTProtoService.DeleteContactAsync(
                CurrentContact.ToInputUser(),
                result =>
            {
                var link24 = result as TLLink24;
                if (link24 != null)
                {
                    EventAggregator.Publish(new TLUpdateContactLink24 {
                        UserId = link24.User.Id, MyLink = link24.MyLink, ForeignLink = link24.ForeignLink
                    });
                }

                RaiseImportStatusChanged(new ImportEventArgs {
                    Imported = false
                });

                ContactsHelper.DeleteContactAsync(StateService, CurrentContact.Id);

                BeginOnUIThread(() =>
                {
                    IsWorking = false;
                    NotifyOfPropertyChange(() => HasPhone);
                });
            },
                error => BeginOnUIThread(() =>
            {
                IsWorking = false;
                Execute.ShowDebugMessage("contacts.deleteContact error: " + error);
            }));
        }