private void OnPetitionForContractReceived(ContractPetitionEventArgs e)
 {
     PetitionForContractReceived?.Invoke(this, e);
 }
 private async Task ContractsClient_PetitionForContractReceived(object sender, ContractPetitionEventArgs e)
 {
     try
     {
         this.OnPetitionForContractReceived(e);
     }
     catch (Exception ex)
     {
         this.logService.LogException(ex);
         await this.uiDispatcher.DisplayAlert(AppResources.ErrorTitle, ex.Message);
     }
 }
        private async void Contracts_PetitionForNeuronContractReceived(object sender, ContractPetitionEventArgs e)
        {
            (bool succeeded, Contract contract) = await this.networkService.TryRequest(() => this.neuronService.Contracts.GetContract(e.RequestedContractId));

            if (!succeeded)
            {
                return;
            }

            if (contract.State == ContractState.Deleted ||
                contract.State == ContractState.Rejected)
            {
                await this.networkService.TryRequest(() => this.neuronService.Contracts.SendPetitionContractResponse(e.RequestedContractId, e.PetitionId, e.RequestorFullJid, false));
            }
            else
            {
                this.uiDispatcher.BeginInvokeOnMainThread(async() =>
                {
                    await this.navigationService.GoToAsync(nameof(PetitionContractPage), new PetitionContractNavigationArgs(e.RequestorIdentity, e.RequestorFullJid, contract, e.PetitionId, e.Purpose));
                });
            }
        }