Пример #1
0
        public void Stop()
        {
            // sometimes stop is called before SystemEvents_SessionEnding
            // in this case we shut down devices here, if necessary (before connection is closed)

            bool bShutDownPending = GetSystemMetrics(0x2000) != 0;

            Log.Debug("Auto3D: Stop - ShutDownPending = " + bShutDownPending);
            Log.Debug("Auto3D: Stop - MePoPowerOff = " + GUIGraphicsContext.StoppingToPowerOff);

            if (bShutDownPending || GUIGraphicsContext.StoppingToPowerOff)
            {
                SystemShutDown();
            }

            // stop UPnP
            Auto3DUPnP.StopSSDP();

            _run = false;
            _activeDevice.Stop();

            if (bMenuMCERemote)
            {
                HIDInput.getInstance().HidEvent -= Auto3DSetup_HidEvent;
            }

            if (!bSuppressSwitchBackTo2D)
            {
                GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.None;
            }

            g_Player.PlayBackEnded   -= OnVideoEnded;
            g_Player.PlayBackStopped -= OnVideoStopped;
            g_Player.PlayBackStarted -= OnVideoStarted;

            SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
        }
Пример #2
0
        private void comboBoxModel_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_lastDevice != null)
            {
                _lastDevice.Stop();
            }

            Auto3DUPnP.StopSSDP();

            IAuto3DSetup setup = (IAuto3DSetup)((IAuto3D)comboBoxModel.SelectedItem).GetSetupControl();

            setup.BringToFront();
            setup.GetDevice().Start();

            if (setup.GetDevice() is Auto3DUPnPBaseDevice)
            {
                Auto3DUPnP.StartSSDP();
            }

            buttonConfig.Visible = (setup.GetDevice().GetRemoteControl() != null);

            Auto3DBaseDevice baseDevice = (Auto3DBaseDevice)setup.GetDevice();

            if (baseDevice.GetTurnOffInterfaces() == DeviceInterface.None)
            {
                checkBoxTurnOffDevice.Enabled = false;
                comboBoxTurnOffDevice.Enabled = false;
                buttonTurnOffDevice.Enabled   = false;
                radioButtonIpOff.Enabled      = false;
                radioButtonIrOff.Enabled      = false;
            }
            else
            {
                checkBoxTurnOffDevice.Enabled = true;
                comboBoxTurnOffDevice.Enabled = true;
                buttonTurnOffDevice.Enabled   = true;

                if ((baseDevice.GetTurnOffInterfaces() & DeviceInterface.IR) == DeviceInterface.IR)
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIrOff.Enabled = true;
                        radioButtonIrOff.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffVia", 0) == 2;
                    }
                }
                else
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIrOff.Enabled = false;
                        radioButtonIrOff.Checked = false;
                    }
                }

                if ((baseDevice.GetTurnOffInterfaces() & DeviceInterface.Network) == DeviceInterface.Network)
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIpOff.Enabled = true;
                        radioButtonIpOff.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffVia", 0) == 1;
                    }
                }
                else
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIpOff.Enabled = false;
                        radioButtonIpOff.Checked = false;
                    }
                }
            }

            if (baseDevice.GetTurnOnInterfaces() == DeviceInterface.None)
            {
                checkBoxTurnOnDevice.Enabled = false;
                comboBoxTurnOnDevice.Enabled = false;
                buttonTurnOnDevice.Enabled   = false;
                radioButtonIpOn.Enabled      = false;
                radioButtonIrOn.Enabled      = false;
            }
            else
            {
                checkBoxTurnOnDevice.Enabled = true;
                comboBoxTurnOnDevice.Enabled = true;
                buttonTurnOnDevice.Enabled   = true;

                if ((baseDevice.GetTurnOnInterfaces() & DeviceInterface.IR) == DeviceInterface.IR)
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIrOn.Enabled = true;
                        radioButtonIrOn.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnVia", 0) == 2;
                    }
                }
                else
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIrOn.Enabled = false;
                        radioButtonIrOn.Checked = false;
                    }
                }

                if ((baseDevice.GetTurnOnInterfaces() & DeviceInterface.Network) == DeviceInterface.Network)
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIpOn.Enabled = true;
                        radioButtonIpOn.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnVia", 0) == 1;
                    }
                }
                else
                {
                    using (Settings reader = new MPSettings())
                    {
                        radioButtonIpOn.Enabled = false;
                        radioButtonIpOn.Checked = false;
                    }
                }
            }
        }