Exemplo n.º 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //creates the main view model
            _viewModel = new MainViewModel();

            this.RootVisual = new MainPage();
        }
        public MainPage()
        {
            InitializeComponent();
            _viewModel = App.MainViewModel;

            try
            {
                _translationService = new TranslationService();
                _conversationService = new ConversationService();

                // Get the instance of LyncClient and subscribe to outgoing/incoming conversation events
                _lyncClient = LyncClient.GetClient();
                _lyncClient.StateChanged += new EventHandler<ClientStateChangedEventArgs>(LyncClient_StateChanged);

                _conversation = (Conversation)Microsoft.Lync.Model.LyncClient.GetHostingConversation();

                // Perform run-time registration using the ApplicationRegistration class.
                _myApplicationRegistration = _lyncClient.CreateApplicationRegistration(App.AppId, App.AppName);
                this._myApplicationRegistration.AddRegistration();
            }
            catch (ClientNotFoundException) { Console.WriteLine("Lync client was not found on startup"); }
            catch (LyncClientException lce) { MessageBox.Show("Lyncclientexception: " + lce.Message); }
        }