/// <summary> /// Menu level changed handler. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuLevelChanged(object sender, MenuLevelChangedEventArgs e) { if (e.Level == MenuLevel.HelpDeskRequested) { lock (this.syncRoot) { if (this.callAnchor == null) { this.callAnchor = new CustomerCallAnchor(this, this.logger, this.conversation); } try { var helpdeskNumber = e.HelpdeskNumber; if (String.IsNullOrEmpty(helpdeskNumber)) { Console.WriteLine("Null or empty help desk number"); this.logger.Log("Null or empty help desk number"); } else { try { RealTimeAddress address = new RealTimeAddress(helpdeskNumber); this.callAnchor.BeginEstablish(address, (asyncResult) => { try { this.callAnchor.EndEstablish(asyncResult); } catch (Exception ex) { this.callAnchor.BeginTerminate((terminateAsyncResult) => { this.callAnchor.EndTerminate(terminateAsyncResult); }, null); Console.WriteLine("Call anchor failed with {0}", ex); this.logger.Log("Call anchor failed with {0}", ex); } }, null); } catch (ArgumentException ae) { Console.WriteLine("Invalid help desk number {0}, Exception ={1}", helpdeskNumber, ae); this.logger.Log("Invalid help desk number {0}, Exception ={1}", helpdeskNumber, ae); } } } catch (Exception ex) { Console.WriteLine("Call anchor failed with {0}", ex); this.logger.Log("Call anchor failed with {0}", ex); } } } }
/// <summary> /// Constructor. /// </summary> public TerminateAsyncResult(CustomerCallAnchor parent, Conversation trustedConversation, ILogger logger, AsyncCallback asyncCallback, object state) : base(asyncCallback, state) { this.trustedConversation = trustedConversation; this.logger = logger; this.parent = parent; }
/// <summary> /// Constructor. /// </summary> public EstablishAsyncResult(CustomerCallAnchor parent, Conversation trustedConversation, Conversation customerConversation, RealTimeAddress helpdeskNumber, ILogger logger, AsyncCallback asyncCallback, object state) : base(asyncCallback, state) { if (helpdeskNumber == null) { throw new ArgumentNullException("helpdeskNumber"); } this.trustedConversation = trustedConversation; this.customerConversation = customerConversation; this.logger = logger; this.parent = parent; this.helpdeskNumber = helpdeskNumber; }