Example #1
0
        void ConversationManager_ConversationAdded(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e)
        {
            ConversationContainer newcontainer = new ConversationContainer()
            {
                Conversation        = e.Conversation,
                ConversationCreated = DateTime.Now,
                m_convId            = nextConvId++
            };

            ActiveConversations.Add(e.Conversation, newcontainer);
            try
            {
                using (StreamWriter outfile = new StreamWriter(appDataPath + programFolder + @"\nextConvId.txt", false))
                {
                    outfile.WriteLine(nextConvId);
                    outfile.Close();
                }
            }
            catch (Exception _ex)
            {
                //ignore
            }
            e.Conversation.ParticipantAdded   += Conversation_ParticipantAdded;
            e.Conversation.ParticipantRemoved += Conversation_ParticipantRemoved;
            String s = String.Format("Conversation #{0} started.", newcontainer.m_convId);

            consoleWriteLine(s);
            if (WindowState == FormWindowState.Minimized)
            {
                this.notifyIcon.BalloonTipText = s;
                this.notifyIcon.ShowBalloonTip(BALOON_POPUP_TIMEOUT);
            }
        }
Example #2
0
        void ConversationManager_ConversationRemoved(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e)
        {
            string ConversationID = e.Conversation.Properties[ConversationProperty.Id].ToString();

            e.Conversation.ParticipantAdded   -= Conversation_ParticipantAdded;
            e.Conversation.ParticipantRemoved -= Conversation_ParticipantRemoved;
            if (ActiveConversations.ContainsKey(e.Conversation))
            {
                ConversationContainer container = ActiveConversations[e.Conversation];
                TimeSpan conversationLength     = DateTime.Now.Subtract(container.ConversationCreated);
                consoleWriteLine(String.Format("Conversation #{0} ended. It lasted {1} seconds", container.m_convId, conversationLength.ToString(@"hh\:mm\:ss")));
                ActiveConversations.Remove(e.Conversation);

                String s = String.Format("Conversation #{0} ended.", container.m_convId);
                if (WindowState == FormWindowState.Minimized)
                {
                    this.notifyIcon.BalloonTipText = s;
                    this.notifyIcon.ShowBalloonTip(BALOON_POPUP_TIMEOUT);
                }
            }
        }
Example #3
0
        void InstantMessageModality_InstantMessageReceived(object sender, Microsoft.Lync.Model.Conversation.MessageSentEventArgs args)
        {
            InstantMessageModality imm       = (sender as InstantMessageModality);
            ConversationContainer  container = ActiveConversations[imm.Conversation];
            DateTime now     = DateTime.Now;
            String   convlog = "[" + now + "] (Conv. #" + container.m_convId + ") <" + imm.Participant.Contact.GetContactInformation(ContactInformationType.DisplayName) + ">";

            convlog += Environment.NewLine + args.Text;
            using (StreamWriter outfile = new StreamWriter(mydocpath + programFolder + @"\AllLyncIMHistory.txt", true))
            {
                outfile.WriteLine(convlog);
                outfile.Close();
            }
            foreach (Participant participant in container.Conversation.Participants)
            {
                if (participant.Contact == myself.Contact)
                {
                    continue;
                }
                String directory = mydocpath + programFolder + @"\" + participant.Contact.GetContactInformation(ContactInformationType.DisplayName);
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }
                string dateString = now.ToString("yyyy-MM-dd");
                String filename   = directory + @"\" + dateString + ".txt";
                //consoleWriteLine(filename);
                using (StreamWriter partfile = new StreamWriter(filename, true))
                {
                    partfile.WriteLine(convlog);
                    partfile.Close();
                }
            }

            consoleWriteLine(convlog);
        }
 void ConversationManager_ConversationAdded(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e)
 {
     ConversationContainer newcontainer = new ConversationContainer()
     {
         Conversation = e.Conversation,
         ConversationCreated = DateTime.Now,
         m_convId = nextConvId++
     };
     ActiveConversations.Add(e.Conversation, newcontainer);
     e.Conversation.ParticipantAdded += Conversation_ParticipantAdded;
     e.Conversation.ParticipantRemoved += Conversation_ParticipantRemoved;
     String s = String.Format("Conversation {0} started.", newcontainer.m_convId);
     consoleWriteLine(s);
     if (WindowState == FormWindowState.Minimized)
     {
         this.notifyIcon.BalloonTipText = s;
         this.notifyIcon.ShowBalloonTip(BALOON_POPUP_TIMEOUT);
     }
 }
Example #5
0
 void ConversationManager_ConversationAdded(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e)
 {
     ConversationContainer newcontainer = new ConversationContainer()
     {
         Conversation = e.Conversation,
         ConversationCreated = DateTime.Now,
         m_convId = nextConvId++
     };
     ActiveConversations.Add(e.Conversation, newcontainer);
     try
     {
         using (StreamWriter outfile = new StreamWriter(appDataPath + programFolder + @"\nextConvId.txt", false))
         {
             outfile.WriteLine(nextConvId);
             outfile.Close();
         }
     }
     catch(Exception _ex)
     {
         //ignore
     }
     e.Conversation.ParticipantAdded += Conversation_ParticipantAdded;
     e.Conversation.ParticipantRemoved += Conversation_ParticipantRemoved;
     String s = String.Format("Conversation #{0} started.", newcontainer.m_convId);
     consoleWriteLine(s);
     if (WindowState == FormWindowState.Minimized)
     {
         this.notifyIcon.BalloonTipText = s;
         this.notifyIcon.ShowBalloonTip(BALOON_POPUP_TIMEOUT);
     }
 }