private void SendInstantMessageBinding_Executed(object sender, ExecutedRoutedEventArgs e) { BugTracer.Get(BugId.N01).BeginTrace(@"SendInstantMessageBinding_Executed"); ISession session = StartConversation(SessionType.ImSession, false); this.chatWindow.Activate(); this.chatWindow.SelectTabItem(session); e.Handled = true; }
private ISession StartConversation(SessionType sessionType, bool enableVideo) { BugTracer.Get(BugId.N01).Trace(string.Format(@"StartConversation: {0}, {1}", sessionType, enableVideo)); IPresentity presentity = this.ContactsWindow.GetSelectedContact(); BugTracer.Get(BugId.N01).Trace(string.Format(@"StartConversation: {0}", presentity.Uri)); ISession session = this.Endpoint.FindSession(sessionType, presentity.Uri); BugTracer.Get(BugId.N01).Trace(string.Format(@"StartConversation: session {0}found", (session == null) ? "not " : "")); if (session != null) { if (enableVideo) { (session as IAvSession).EnableVideo(); } this.Endpoint.RestoreSession(session); } else { session = this.Endpoint.CreateSession(sessionType); if (enableVideo) { (session as IAvSession).EnableVideo(); } BugTracer.Get(BugId.N01).EndTrace(@"StartConversation -- endtrace"); session.AddPartipant(presentity.Uri); } return(session); }