public static async Task <LegalService> Create(TreeNode Parent, string JID, string Name, string Node, Dictionary <string, bool> Features) { LegalService Result = new LegalService(Parent, JID, Name, Node, Features); Result.contractsClient = await ContractsClient.Create(Result.Account.Client, JID); Result.contractsClient.IdentityUpdated += Result.ContractsClient_IdentityUpdated; return(Result); }
/// <summary> /// Adds the extension to the client. /// </summary> /// <param name="Instance">Actor instance.</param> /// <param name="Client">XMPP Client</param> public override async Task Add(IActor Instance, Waher.Networking.XMPP.XmppClient Client) { ContractsClient Extension = await ContractsClient.Create(Client, this.componentAddress); 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.PetitionedContractReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionedContractReceived", 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.PetitionedIdentityReceived += (Sender, e) => { this.Model.ExternalEvent(Instance, "PetitionedIdentityReceived", 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); }; }