private void conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
        {
            if (e.NewState == ConversationState.Terminated)
            {
                var conversation = sender as Conversation;
                var participants = conversation.Participants;
                var convKey      = calculateKey(participants);

                try
                {
                    var convItem = conversationContent[convKey];

                    var archivers = ArchiveHelper.GetArchivers();
                    foreach (var arcer in archivers)
                    {
                        Parallel.Invoke(() => arcer.Save(convKey, convItem));
                    }
                }
                finally
                {
                    conversationContent.Remove(convKey);
                    conversation.ParticipantAdded   += new EventHandler <ParticipantCollectionChangedEventArgs>(conversation_ParticipantAdded);
                    conversation.ParticipantRemoved += new EventHandler <ParticipantCollectionChangedEventArgs>(conversation_ParticipantRemoved);

                    if (conversation.Modalities.ContainsKey(ModalityTypes.InstantMessage) && conversation.Modalities[ModalityTypes.InstantMessage] != null)
                    {
                        var imModality = (InstantMessageModality)conversation.Modalities[ModalityTypes.InstantMessage];
                        imModality.InstantMessageReceived -= new EventHandler <MessageSentEventArgs>(conversation_InstantMessageSent);
                    }

                    conversation.StateChanged -= new EventHandler <ConversationStateChangedEventArgs>(conversation_StateChanged);
                }
            }
        }
示例#2
0
 static void conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     if (e.NewState == ConversationState.Terminated)
     {
         OnCallDeclined();
     }
 }
示例#3
0
 private void OnConversationStateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     if (e.NewState == ConversationState.Terminated)
     {
     }
     _log.Debug("OnConversationStateChanged  NewState:{0}", e.NewState.ToString());
 }
        /// <summary>
        /// Handles event raised when the state of an active conversation has changed.
        /// </summary>
        /// <param name="source">Conversation. The active conversation that raised the state change event.</param>
        /// <param name="data">ConversationStateChangedEventArgs. Event data containing state change data</param>
        void Conversation_StateChangedEvent(Object source, ConversationStateChangedEventArgs data)
        {
            switch (data.NewState)
            {
            case ConversationState.Terminated:
                //*******************************************************************
                //update form status label text with current state of conversation.
                //*******************************************************************
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.SetFormBackColor, this, Brushes.AntiqueWhite });
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.DisableButton, EndConversation_Button, null });
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Conversation Ended" });
                break;

            case ConversationState.Active:
                //*******************************************************************
                //update form status label text with current state of conversation.
                //*******************************************************************
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.SetFormBackColor, this, Brushes.CadetBlue });
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Conversation is Active" });
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.EnableButton, EndConversation_Button, null });
                break;

            case ConversationState.Inactive:
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.SetFormBackColor, this, Brushes.AntiqueWhite });
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Conversation is inactive" });
                break;

            case ConversationState.Invalid:
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.SetFormBackColor, this, Brushes.AntiqueWhite });
                this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Conversation is invalid" });
                break;
            }
        }
示例#5
0
 private void OnConversationStateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     _log.Debug
         ("OnConversationStateChanged  NewState:{0} StatusCode:{1}"
         , e.NewState.ToString()
         , e.StatusCode
         );
 }
示例#6
0
 /// <summary>
 /// Called when the conversation state changes.
 ///
 /// Updates the status bar.
 /// </summary>
 void conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     //posts the execution into the UI thread
     this.BeginInvoke(new MethodInvoker(delegate()
     {
         //show the current conversation state
         toolStripStatusLabelConvesation.Text = e.NewState.ToString();
     }));
 }
示例#7
0
        private void Conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
        {
            Conversation conv = sender as Conversation;

            if (conv != null)
            {
                conv.End();
            }
        }
示例#8
0
 /// <summary>
 /// Conversation model state changed event handler.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 private void ConversationModelStateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     this.Status = String.Format("{0} {1}", StatusResource.ConversationStateChange, e.CurrentState);
     if (e.CurrentState == ConversationModelState.Terminated)
     {
         this.IsCallMeCommandEnabled      = false;
         this.IsSendMessageCommandEnabled = false;
         ConversationModel conversationModel = sender as ConversationModel;
         this.UnregisterConversationModelEventHandlers(conversationModel);
     }
 }
示例#9
0
 void conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     throw new NotImplementedException();
 }
 void Conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
 {
 }
 private void ConversationStateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     this.SetConversationStatus(e.NewState.ToString());
 }
 private static void conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     if (e.NewState == ConversationState.Terminated)
     {
         OnCallDeclined();
     }
 }
示例#13
0
 /// <summary>
 /// Handles the StateChangedEvent event of the Conversation control.
 /// </summary>
 /// <param name="source">The source of the event.</param>
 /// <param name="data">The <see cref="Microsoft.Lync.Model.Conversation.ConversationStateChangedEventArgs"/> instance containing the event data.
 /// </param>
 ///
 private void Conversation_StateChangedEvent(object source, ConversationStateChangedEventArgs data)
 {
 }
 //StateChanged event handler
 private void Conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
 {
     MessageBox.Show("Conversation_StateChanged: " + e.NewState);
 }
        private void conversation_StateChanged(object sender, ConversationStateChangedEventArgs e)
        {
            if (e.NewState == ConversationState.Terminated)
            {
                var conversation = sender as Conversation;
                var participants = conversation.Participants;
                var convKey = calculateKey(participants);
                
                try
                {
                    var convItem = conversationContent[convKey];

                    var archivers = ArchiveHelper.GetArchivers();
                    foreach (var arcer in archivers)
                    {
                        Parallel.Invoke(() => arcer.Save(convKey, convItem));
                    }
                    
                }
                finally
                {
                    conversationContent.Remove(convKey);
                    conversation.ParticipantAdded += new EventHandler<ParticipantCollectionChangedEventArgs>(conversation_ParticipantAdded);
                    conversation.ParticipantRemoved += new EventHandler<ParticipantCollectionChangedEventArgs>(conversation_ParticipantRemoved);

                    if (conversation.Modalities.ContainsKey(ModalityTypes.InstantMessage) && conversation.Modalities[ModalityTypes.InstantMessage] != null)
                    {
                        var imModality = (InstantMessageModality)conversation.Modalities[ModalityTypes.InstantMessage];
                        imModality.InstantMessageReceived -= new EventHandler<MessageSentEventArgs>(conversation_InstantMessageSent);
                    }

                    conversation.StateChanged -= new EventHandler<ConversationStateChangedEventArgs>(conversation_StateChanged);
                }
            }
        }