Example #1
0
 public void Dispose()
 {
     if (_tvProvider != null)
     {
         _tvProvider.DeInit();
         _tvProvider = null;
     }
 }
        public void Shutdown()
        {
            ITvProvider tvProvider = ServiceRegistration.Get <ITvProvider>(false);

            if (tvProvider != null)
            {
                tvProvider.DeInit();
            }
        }
Example #3
0
        private void DeInit()
        {
            ITvProvider provider = _tvProvider;

            if (provider != null)
            {
                provider.DeInit();
            }
        }
Example #4
0
        void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
        {
            if (message.ChannelName == ServerConnectionMessaging.CHANNEL)
            {
                ServerConnectionMessaging.MessageType type = (ServerConnectionMessaging.MessageType)message.MessageType;
                switch (type)
                {
                case ServerConnectionMessaging.MessageType.HomeServerAttached:
                    RegisterService();
                    break;

                case ServerConnectionMessaging.MessageType.HomeServerDisconnected:
                case ServerConnectionMessaging.MessageType.HomeServerDetached:
                    UnregisterService();
                    break;
                }
            }
            if (message.ChannelName == SystemMessaging.CHANNEL)
            {
                SystemMessaging.MessageType messageType = (SystemMessaging.MessageType)message.MessageType;
                if (messageType == SystemMessaging.MessageType.SystemStateChanged)
                {
                    SystemState state = (SystemState)message.MessageData[SystemMessaging.NEW_STATE];
                    switch (state)
                    {
                    case SystemState.Suspending:
                        ITvProvider tvProvider = ServiceRegistration.Get <ITvProvider>(false);
                        if (tvProvider != null)
                        {
                            tvProvider.DeInit();
                        }
                        break;

                    case SystemState.ShuttingDown:
                        // Called to make sure that timeshifting on server is stopped on shutdown.
                        UnregisterService();
                        break;
                    }
                }
            }
        }