コード例 #1
0
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         //Start the conversation
         automation = LyncClient.GetAutomation();
         client     = LyncClient.GetClient();
     }
     catch (LyncClientException lyncClientException)
     {
         MessageBox.Show("Failed to connect to Lync." + lyncClientException.Message);
         Console.Out.WriteLine(lyncClientException);
     }
     catch (SystemException systemException)
     {
         if (IsLyncException(systemException))
         {
             // Log the exception thrown by the Lync Model API.
             MessageBox.Show("Failed to connect to Lync." + systemException.Message);
             Console.WriteLine("Error: " + systemException);
         }
         else
         {
             // Rethrow the SystemException which did not come from the Lync Model API.
             throw;
         }
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: seketman/ChaTito
        static void Main(string[] args)
        {
            //Init
            LyncClient client = null;

            Microsoft.Lync.Model.Extensibility.Automation automation = null;
            //InstantMessageModality _ConversationImModality;

            try
            {
                //Start the conversation
                automation = LyncClient.GetAutomation();
                client     = LyncClient.GetClient();
            }
            catch (LyncClientException lyncClientException)
            {
                Console.WriteLine("Failed to connect to Lync." + lyncClientException.Message);
                Console.Out.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.Write("Failed to connect to Lync." + systemException.Message);
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

            //los eventos
            client.ConversationManager.ConversationAdded += ConeversAded;

            Console.ReadKey();
        }
コード例 #3
0
        public SeriousBusinessCat(MainWindow main)
        {
            this._main = main;

            this.whisperCat = new WhisperCat(this);

            try
            {
#if DEBUG
                debug = new DebugWindow();
                debug.info("Test");
                debug.Show();

                /*
                 * var _testWhisper = new WhisperWindow(null, null, null, "Your key: 12345\r\nTheir key: 6789A");
                 *
                 * _testWhisper.AddWhisper(new Whisper(true, "testing a really really long message, at least it seems pretty long, but i guess it is really not that long to begin with", "cipher1"));
                 * _testWhisper.AddWhisper(new Whisper(false, "okay, looks good", "cipher2"));
                 * _testWhisper.AddWhisper(new Whisper(true, "glad you think so, you jerk", "cipher3"));
                 * _testWhisper.Show();
                 */
#endif


                //Start the conversation
                automation = LyncClient.GetAutomation();
                client     = LyncClient.GetClient();

                ConversationManager conversationManager = client.ConversationManager;
                conversationManager.ConversationAdded   += ConversationManager_ConversationAdded;
                conversationManager.ConversationRemoved += ConversationManager_ConversationRemoved;
                //conversationManager.ConversationAdded += new EventHandler<ConversationManagerEventArgs>(conversationManager_ConversationAdded);

                _main.lbConversations.ItemsSource = _conversations;

                RefreshConversations(true);

                try
                {
                    _selfUserName = client.Self.Contact.GetContactInformation(ContactInformationType.PrimaryEmailAddress).ToString();
                    if (_selfUserName.Contains("@"))
                    {
                        _selfUserName = _selfUserName.Split('@')[0];
                    }
                    _selfUserNameLast = _selfUserName;
                    if (_selfUserNameLast.Contains('.'))
                    {
                        _selfUserNameLast = _selfUserNameLast.Split('.')[1];
                    }
                }
                catch (Exception)
                {
                    // ignore
                }
            }
            catch (LyncClientException lyncClientException)
            {
                MessageBox.Show("Failed to connect to Lync: " + lyncClientException.ToString());
                Console.Out.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (Util.IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    MessageBox.Show("Failed to connect to Lync with system error: " + systemException.ToString());
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

            CreateFileWatcher();
        }
コード例 #4
0
        public SeriousBusinessCat(MainWindow main)
        {
            this._main = main;

            this.whisperCat = new WhisperCat(this);

            try
            {
#if DEBUG
                var _testWhisper = new WhisperWindow(null, null, null, "Your key: 12345\r\nTheir key: 6789A");
     
                _testWhisper.AddWhisper(new Whisper(true, "testing a really really long message, at least it seems pretty long, but i guess it is really not that long to begin with", "cipher1"));
                _testWhisper.AddWhisper(new Whisper(false, "okay, looks good", "cipher2"));
                _testWhisper.AddWhisper(new Whisper(true, "glad you think so, you jerk", "cipher3"));
                _testWhisper.Show();
#endif


                //Start the conversation
                automation = LyncClient.GetAutomation();
                client = LyncClient.GetClient();

                ConversationManager conversationManager = client.ConversationManager;
                conversationManager.ConversationAdded += ConversationManager_ConversationAdded;
                conversationManager.ConversationRemoved += ConversationManager_ConversationRemoved;
                //conversationManager.ConversationAdded += new EventHandler<ConversationManagerEventArgs>(conversationManager_ConversationAdded);

                _main.lbConversations.ItemsSource = _conversations;

                RefreshConversations(true);

                try
                {
                    _selfUserName = client.Self.Contact.GetContactInformation(ContactInformationType.PrimaryEmailAddress).ToString();
                    if (_selfUserName.Contains("@"))
                    {
                        _selfUserName = _selfUserName.Split('@')[0];
                    }
                    _selfUserNameLast = _selfUserName;
                    if (_selfUserNameLast.Contains('.'))
                    {
                        _selfUserNameLast = _selfUserNameLast.Split('.')[1];
                    }
                }
                catch (Exception)
                {
                    // ignore
                }
            }
            catch (LyncClientException lyncClientException)
            {
                MessageBox.Show("Failed to connect to Lync: " + lyncClientException.ToString());
                Console.Out.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (Util.IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    MessageBox.Show("Failed to connect to Lync with system error: " + systemException.ToString());
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }
        }