예제 #1
0
        public SupervisorDashboardChannel(string guid)
        {
            Conversation      = (Conversation)LyncClient.GetHostingConversation();
            ApplicationId     = guid;
            _requestProcessor = new RequestProcessor(null);
            _agents           = new Dictionary <string, agentType>();

            Conversation.ContextDataReceived += ConversationContextDataReceived;
        }
예제 #2
0
        public AgentDashboardChannel(string guid)
        {
            Conversation = LyncClient.GetHostingConversation() as Conversation;

            ApplicationId     = guid;
            _requestProcessor = new RequestProcessor(null);

            Initialize();

            if (Conversation != null)
            {
                Conversation.ContextDataReceived += ConversationContextDataReceived;
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //gets the conversation this translator is associated with
                _conversation = (Conversation)LyncClient.GetHostingConversation();

                // Subscribe to conversation events
                _conversation.InitialContextReceived += Conversation_InitialContextReceived;
                _conversation.ContextDataReceived    += Conversation_ContextDataReceived;
                _conversation.StateChanged           += Conversation_StateChanged;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
            }
        }
예제 #4
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            Conversation conversation = LyncClient.GetHostingConversation() as Conversation;

            if (conversation != null)
            {
                bool agent = false;
                try
                {
                    conversation.GetApplicationData("{63D37F02-47B3-4B9E-AA8E-FEF3665298DC}");
                    RootVisual = new Views.AgentDashboardView(new ViewModels.AgentDashboard());
                    agent      = true;
                }
                catch (Exception)
                {
                }

                if (!agent)
                {
                    RootVisual = new Views.SupervisorDashboardView(new ViewModels.SupervisorDashboard());
                }
            }
            //RootVisual = new Views.SupervisorDashboardView(new ViewModels.SupervisorDashboard());
        }
        /// <summary>
        /// Loads the necessary components and register for events.
        /// </summary>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //gets the conversation this translator is associated with
                conversation = (Conversation)LyncClient.GetHostingConversation();

                //DEBUG: when running on the web browser, just get the first current
                //active conversation on OC
                if (conversation == null)
                {
                    //obtains the first active conversation in Lync
                    conversation = LyncClient.GetClient().ConversationManager.Conversations[0];

                    //cannot run without a conversation
                    if (this.conversation == null)
                    {
                        throw new NotSupportedException("You need one conversation to Debug the Conversation Translator");
                    }
                }

                //set the initial UI state to proof
                SetUIState(UIState.Proof);

                //creates the conversation service component and subscribes to events
                conversationService = new ConversationService(conversation);
                conversationService.MessageError   += new MessageError(conversationService_MessageError);
                conversationService.MessageRecived += new MessageRecived(conversationService_MessageRecived);
                conversationService.MessageSent    += new MessageSent(conversationService_MessageSent);

                //starts listening to Lync events
                conversationService.Start();


                //obtains the translation service component and subscribes to events
                translationService = new TranslationService();
                translationService.LanguagesReceived   += new LanguagesReceived(translationService_LanguagesReceived);
                translationService.TranslationError    += new TranslationError(translationService_TranslationError);
                translationService.TranslationReceived += new TranslationReceived(translationService_TranslationReceived);
                translationService.Start();
            }
            catch (AutomationServerException automationException)
            {
                if (automationException.Reason == AutomationServerException.FailureReason.ClientNotTrusted)
                {
                    ShowError("Please add the website from which the Conversation Translator is being downloaded to your Internet Explorer trusted site list.");
                }
                else if (automationException.Reason == AutomationServerException.FailureReason.ServerNotRunning)
                {
                    ShowError("Microsoft Lync does not appear to be running. If you opened Translator from Lync, there might be an issue with the Lync installation.");
                }
                else
                {
                    //The reason for the AutomationServerException in unknown, report a generic message
                    ShowError("There was an error when connecting to Microsoft Lync");
                }
            }
            catch (Exception)
            {
                //possibly an error in one of the services
                ShowError("There was an error when starting the Conversation Translator. Please try again later.");
            }
        }
        public MainPage()
        {
            InitializeComponent();

            //Get the conversation from the Lync client
            try
            {
                _conversation = (Conversation)LyncClient.GetHostingConversation();
            }
            catch (LyncClientException lyncClientException)
            {
                Debug.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

            if (_conversation != null)
            {
                //Get the subject and appdata from the conversation. In this application they represent the
                //Proposals ProjectName and Description respectively.
                try
                {
                    _subject = (string)_conversation.Properties[ConversationProperty.Subject];
                    _appData = _conversation.GetApplicationData(ApplicationGuid);
                }
                catch (LyncClientException lyncClientException)
                {
                    Debug.WriteLine(lyncClientException);
                }
                catch (SystemException systemException)
                {
                    if (IsLyncException(systemException))
                    {
                        // Log the exception thrown by the Lync Model API.
                        Console.WriteLine("Error: " + systemException);
                    }
                    else
                    {
                        // Rethrow the SystemException which did not come from the Lync Model API.
                        throw;
                    }
                }

                //Event to get fired when a context is received from other participants.
                _conversation.ContextDataReceived += ConversationContextDataReceived;

                //By default, we want one of the checkboxes to get checked when the context loads.
                PieChartRadioButton.IsChecked = true;

                //Bind the subject to be the title and the app data to be the description.
                MainPortletFrame.PortletTitle = _subject;
                AppDataTextBlock.Text         = _appData;
            }
        }