/// <summary> /// Adds the extension to the client. /// </summary> /// <param name="Instance">Actor instance.</param> /// <param name="Client">XMPP Client</param> /// <returns>Extension object.</returns> public override async Task <object> Add(IActor Instance, Waher.Networking.XMPP.XmppClient Client) { ContractsClient Extension = new ContractsClient(Client, this.componentAddress); await Extension.LoadKeys(true); Client.SetTag("ContractsClient", Extension); Extension.ContractDeleted += (Sender, e) => { this.Model.ExternalEvent(Instance, "ContractDeleted", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.ContractSigned += (Sender, e) => { this.Model.ExternalEvent(Instance, "ContractSigned", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.ContractUpdated += (Sender, e) => { this.Model.ExternalEvent(Instance, "ContractUpdated", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.IdentityUpdated += (Sender, e) => { this.Model.ExternalEvent(Instance, "IdentityUpdated", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionForContractReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionForContractReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionedContractResponseReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionedContractResponseReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionForIdentityReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionForIdentityReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionedIdentityResponseReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionedIdentityResponseReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionForSignatureReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionForSignatureReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionedSignatureResponseReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionedSignatureResponseReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionForPeerReviewIDReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionForPeerReviewIDReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; Extension.PetitionedPeerReviewIDResponseReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionedPeerReviewIDResponseReceived", new KeyValuePair <string, object>("e", e), new KeyValuePair <string, object>("Client", Client)); return(Task.CompletedTask); }; return(Extension); }