Exemple #1
0
        static void Main(string[] args)
        {
            //Listen for events of changes in the state of the client
            try
            {
                lyncClient    = LyncClient.GetClient();
                arduinoSerial = new ArduinoSerial {
                    RunLoop = true
                };
                arduinoSerial.Setup();
            }
            catch (ClientNotFoundException clientNotFoundException)
            {
                Console.WriteLine(clientNotFoundException);
                return;
            }
            catch (NotStartedByUserException notStartedByUserException)
            {
                Console.Out.WriteLine(notStartedByUserException);
                return;
            }
            catch (LyncClientException lyncClientException)
            {
                Console.Out.WriteLine(lyncClientException);
                return;
            }
            catch (SystemException systemException)
            {
                if (IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                    return;
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

            lyncClient.StateChanged +=
                new EventHandler <ClientStateChangedEventArgs>(Client_StateChanged);

            lyncClient.Self.Contact.ContactInformationChanged +=
                new EventHandler <ContactInformationChangedEventArgs>(SelfContact_ContactInformationChanged);

            SetAvailability();
            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //Listen for events of changes in the state of the client
            try
            {
                lyncClient = LyncClient.GetClient();
                arduinoSerial = new ArduinoSerial { RunLoop = true };
                arduinoSerial.Setup();
            }
            catch (ClientNotFoundException clientNotFoundException)
            {
                Console.WriteLine(clientNotFoundException);
                return;
            }
            catch (NotStartedByUserException notStartedByUserException)
            {
                Console.Out.WriteLine(notStartedByUserException);
                return;
            }
            catch (LyncClientException lyncClientException)
            {
                Console.Out.WriteLine(lyncClientException);
                return;
            }
            catch (SystemException systemException)
            {
                if (IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                    return;
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

            lyncClient.StateChanged +=
                new EventHandler<ClientStateChangedEventArgs>(Client_StateChanged);

            lyncClient.Self.Contact.ContactInformationChanged +=
                   new EventHandler<ContactInformationChangedEventArgs>(SelfContact_ContactInformationChanged);

            SetAvailability();
            Console.ReadKey();
        }