/// <summary> /// The invoke. /// </summary> /// <param name="args"> /// The args. /// </param> /// <returns> /// The <see cref="T"/>. /// </returns> /// <exception cref="Exception"> /// Exception when error is returned /// </exception> public Domain.Contracts.ServiceResponse <T> Invoke(params object[] args) { var lookupService = new WeborbClient(this.gateway, this.destination ?? "GenericDestination"); lookupService.Invoke(this.@class, this.method, args, new Responder <ServiceResponse>(this.GotResult, this.GotError)); this.executedCallBack.WaitOne(); if (this.fault != null) { throw new ApplicationException(string.Format("Message: " + this.fault.Message + ", Details: " + this.fault.Detail)); } return(this.result); }
private void Init() { _client = new WeborbClient( App.WeborbUrl, "DemoDestination" ); _client.Subscribed += () => Dispatcher.BeginInvoke(() => SendButton.IsEnabled = true); _client.Subscribe( new SubscribeResponder( message => Dispatcher.BeginInvoke(() => { IAdaptingType[] body = message.GetBody(); object mess = body[0].defaultAdapt(); string sender = message.headers["WebORBClientId"].ToString() == "" ? "Anonymous" : message.headers["WebORBClientId"].ToString(); Messages.Text += sender + ": " + mess + "\n"; }), fault => Dispatcher.BeginInvoke(() => Messages.Text += fault.Message + "\n"))); }