Beispiel #1
0
        public void ProcessKey(string keycommand)
        {
            bool focussed = false;

            switch (keycommand.ToLower())
            {
            case "channelup":
            case "nexttrack":
            case "next_control":
                for (int i = 0; i < _pnlCameras.Controls.Count; i++)
                {
                    Control c = _pnlCameras.Controls[i];
                    if (c.Focused)
                    {
                        i++;
                        if (i == _pnlCameras.Controls.Count)
                        {
                            i = 0;
                        }
                        _pnlCameras.Controls[i].Focus();
                        focussed = true;
                        break;
                    }
                }
                if (!focussed && _pnlCameras.Controls.Count > 0)
                {
                    _pnlCameras.Controls[0].Focus();
                }
                break;

            case "channeldown":
            case "previoustrack":
            case "previous_control":
                for (int i = 0; i < _pnlCameras.Controls.Count; i++)
                {
                    Control c = _pnlCameras.Controls[i];
                    if (c.Focused)
                    {
                        i--;
                        if (i == -1)
                        {
                            i = _pnlCameras.Controls.Count - 1;
                        }
                        _pnlCameras.Controls[i].Focus();
                        focussed = true;
                        break;
                    }
                }

                if (!focussed && _pnlCameras.Controls.Count > 0)
                {
                    _pnlCameras.Controls[0].Focus();
                }
                break;

            case "play":
            case "pause":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow)
                        {
                            CameraWindow cw = (CameraWindow)c;
                            if (cw.Camobject.settings.active)
                            {
                                Maximise(cw);
                            }
                            else
                            {
                                cw.Enable();
                            }
                        }
                        if (c is VolumeLevel)
                        {
                            VolumeLevel vw = (VolumeLevel)c;
                            if (vw.Micobject.settings.active)
                            {
                                Maximise(vw);
                            }
                            else
                            {
                                vw.Enable();
                            }
                        }
                        break;
                    }
                }
                break;

            case "stop":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow)
                        {
                            ((CameraWindow)c).Disable();
                        }
                        if (c is VolumeLevel)
                        {
                            ((VolumeLevel)c).Disable();
                        }
                        break;
                    }
                }
                break;

            case "record":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow)
                        {
                            ((CameraWindow)c).RecordSwitch(!((CameraWindow)c).Recording);
                        }
                        if (c is VolumeLevel)
                        {
                            ((VolumeLevel)c).RecordSwitch(!((VolumeLevel)c).Recording);
                        }
                        break;
                    }
                }
                break;

            case "zoom":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow || c is VolumeLevel || c is FloorPlanControl)
                        {
                            Maximise(c);
                            break;
                        }
                    }
                }
                break;

            case "standby":
            case "back":
            case "power":
                Close();
                break;
            }
        }