예제 #1
0
        protected override void OnLoad(IServiceProvider serviceProvider)
        {
            try
            {
                base.OnLoad(serviceProvider);

                // Store service provider reference
                _serviceProvider = serviceProvider;

                // Get Session
                _session = _serviceProvider.GetService(typeof(Session)) as Session;
                if (_session == null)
                {
                    throw new InstanceNotFoundException("Failed to get the IceLib Session from the service provider!");
                }

                // Get IInteractionSelector
                _interactionSelector =
                    _serviceProvider.GetService(typeof(IInteractionSelector)) as IInteractionSelector;

                VidyoIntegration.VidyoAddin.Trace.Main.status("The OnLoad thread has apartment state: {}", Thread.CurrentThread.GetApartmentState());
            }
            catch (Exception ex)
            {
                VidyoIntegration.VidyoAddin.Trace.Main.exception(ex, ex.Message);
                MessageBox.Show(
                    "Vidyo Addin initialization failed! " + ex.Message +
                    "\n\nPlease contact your system administrator.",
                    "Critical error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        public void Initialize(Session session, IInteractionSelector interactionSelector)
        {
            using (Trace.Main.scope())
            {
                try
                {
                    Trace.Main.always("Initializing VidyoPanelViewModel");

                    // Set things
                    if (_session == null)
                    {
                        // Only do these things the first time around
                        _session = session;
                        _session.ConnectionStateChanged += SessionOnConnectionStateChanged;
                    }

                    _interactionSelector = interactionSelector;

                    _customNotification = new CustomNotification(_session);
                    MyInteractions      = new InteractionQueue(InteractionsManager.GetInstance(_session),
                                                               new QueueId(QueueType.User, _session.UserId));

                    // Watch queue
                    MyInteractions.InteractionAdded   += MyInteractionsOnInteractionAdded;
                    MyInteractions.InteractionChanged += MyInteractionsOnInteractionChanged;
                    MyInteractions.InteractionRemoved += MyInteractionsOnInteractionRemoved;
                    MyInteractions.StartWatching(_watchedAttrs.ToArray());

                    // Watch for custom notifications
                    _customNotification.CustomNotificationReceived += OnCustomNotificationReceived;
                    WatchCustomNotifications();

                    // Get the Vidyo service client base URL
                    SendCustomNotification(CustomMessageType.ApplicationRequest, VidyoServiceClientBaseUrlRequestOid,
                                           VidyoServiceClientBaseUrlRequestEid, _session.UserId.ToLower());

                    // Let everyone know we're ready
                    IsInitialized = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Trace.Main.exception(ex, ex.Message);
                    //MessageBox.Show(
                    //    "There was an error intializing the Vidyo addin. Please contact your system administrator.",
                    //    "Vidyo Addin - critical error");
                    throw;
                }
            }
        }
        private void Initialize()
        {
            try
            {
                // Set up queue watch
                var queueService = _serviceProvider.GetService(typeof(IQueueService)) as IQueueService;
                _queue = queueService.GetMyInteractions(new[]
                {
                    "Eic_InteractionId",
                    "Hootsuite_Subject",
                    "Hootsuite_Priority",
                    "Hootsuite_Reason",
                    "Hootsuite_Notes",
                    "Hootsuite_RawData",
                    InteractionAttributes.State,
                    InteractionAttributes.StateDisplay
                });
                _queue.InteractionAdded   += Queue_OnInteractionAdded;
                _queue.InteractionChanged += Queue_OnInteractionChanged;
                _queue.InteractionRemoved += Queue_OnInteractionRemoved;

                // Set up context changed event
                _interactionSelector = _serviceProvider.GetService(typeof(IInteractionSelector)) as IInteractionSelector;
                if (_interactionSelector != null)
                {
                    _interactionSelector.SelectedInteractionChanged += InteractionSelector_OnSelectedInteractionChanged;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
#if DEBUG
                MessageBox.Show(ex.Message);
#endif
            }
        }