Esempio n. 1
0
        public void OnStop()
        {
            if (!Started)
            {
                return;
            }
            Log.WriteFile("TV Service: stopping");

            if (_InitializedEvent != null)
            {
                _InitializedEvent.Reset();
            }
            StopRemoting();
            RemoteControl.Clear();
            if (_controller != null)
            {
                _controller.DeInit();
                _controller = null;
            }

            StopPlugins();
            if (_powerEventThreadId != 0)
            {
                Log.Debug("TV Service: OnStop asking PowerEventThread to exit");
                PostThreadMessage(_powerEventThreadId, WM_QUIT, IntPtr.Zero, IntPtr.Zero);
                _powerEventThread.Join();
            }
            _powerEventThreadId = 0;
            _powerEventThread   = null;
            _started            = false;
            Log.WriteFile("TV Service: stopped");
        }
Esempio n. 2
0
        public void OnStop()
        {
            if (!_started)
            {
                return;
            }

            Log.WriteFile("TV Service: stopping");

            // Reset "Global\MPTVServiceInitializedEvent"
            if (_InitializedEvent != null)
            {
                _InitializedEvent.Reset();
            }

            // Stop the plugins
            StopPlugins();

            // Stop remoting and deinit the TvController
            StopRemoting();
            RemoteControl.Clear();
            if (_controller != null)
            {
                _controller.DeInit();
                _controller = null;
            }

            // Terminate the power event thread
            if (_powerEventThreadId != 0)
            {
                Log.Debug("TV Service: OnStop asking PowerEventThread to exit");
                PostThreadMessage(_powerEventThreadId, WM_QUIT, IntPtr.Zero, IntPtr.Zero);
                _powerEventThread.Join();
            }
            _powerEventThreadId = 0;
            _powerEventThread   = null;

            _started = false;
            Log.WriteFile("TV Service: stopped");
        }