Exemplo n.º 1
0
        private async Task DeleteMessageExecute()
        {
            if (IsBusy)
            {
                return;
            }
            string tx = null;

            try
            {
                IsBusy = true;

                if (FromInbox)
                {
                    tx = await PhantasmaService.RemoveInboxMessage(SelectedMessage.ID);
                }
                else
                {
                    tx = await PhantasmaService.RemoveOutboxMessage(SelectedMessage.ID);
                }
            }
            catch (Exception ex)
            {
                if (ex is RpcClientUnknownException || ex is RpcClientTimeoutException) //todo switch error message
                {
                    AppSettings.ChangeRpcServer();
                }
                await DialogService.ShowAlertAsync(ex.Message, AppResource.Alert_Error);
            }
            finally
            {
                IsBusy = false;
            }

            if (!string.IsNullOrEmpty(tx))
            {
                await _db.DeleteMessage(SelectedMessage.ToStoreMessage());

                await DialogService.ShowAlertAsync("Message will be deleted in the next block", "Success"); //todo move to resources

                await NavigationService.NavigateBackAsync();
            }
            else
            {
                await DialogService.ShowAlertAsync(AppResource.Alert_SomethingWrong, AppResource.Alert_Error);
            }
        }
Exemplo n.º 2
0
        private async Task DeleteMessageExecute(Message msg)
        {
            if (msg == null)
            {
                return;
            }
            if (IsBusy)
            {
                return;
            }
            try
            {
                IsBusy = true;
                var tx = await PhantasmaService.RemoveInboxMessage(msg.ID);

                if (string.IsNullOrEmpty(tx))
                {
                    await DialogService.ShowAlertAsync(AppResource.Alert_SomethingWrong, AppResource.Alert_Error);
                }
                else
                {
                    _fullInboxList.Remove(msg);
                    InboxList = new ObservableCollection <Message>(_fullInboxList);
                }
            }
            catch (Exception ex)
            {
                if (ex is RpcClientUnknownException || ex is RpcClientTimeoutException) //todo switch error message
                {
                    AppSettings.ChangeRpcServer();
                }
                await DialogService.ShowAlertAsync(ex.Message, AppResource.Alert_Error);
            }
            finally
            {
                IsBusy = false;
            }
        }