コード例 #1
0
ファイル: MainForm.cs プロジェクト: zzattack/g19applets
        public MainForm()
        {
            InitializeComponent();

            _conn = new PioneerConnection(new List <WritableDataSource> {
                new TcpClientDataSource("10.31.45.25", 8102),
                new TcpClientDataSource("10.31.45.25", 23),
            });
            _conn.ConnectionEstablished += (sender, args) => ReadCurrentSettings();
            _conn.MessageReceived       += MessageReceived;
            _conn.Start();

            if (!IsHandleCreated)
            {
                CreateHandle();
            }
            _hotkey = new PioneerHooks();
            _hotkey.RegisterHotKey(KeyModifiers.None, Keys.VolumeUp);
            _hotkey.RegisterHotKey(KeyModifiers.None, Keys.VolumeDown);
            _hotkey.RegisterHotKey(KeyModifiers.Control, Keys.VolumeUp);
            _hotkey.RegisterHotKey(KeyModifiers.Control, Keys.VolumeDown);
            _hotkey.RegisterHotKey(KeyModifiers.Control | KeyModifiers.Alt, Keys.VolumeUp);
            _hotkey.RegisterHotKey(KeyModifiers.Control | KeyModifiers.Alt, Keys.VolumeDown);
            _hotkey.RegisterHotKey(KeyModifiers.Control | KeyModifiers.Shift, Keys.P);
            _hotkey.RegisterHotKey(KeyModifiers.Control | KeyModifiers.Shift, Keys.Q);
            _hotkey.KeyPressed += HotkeyKeyPressed;

            /*Device.Up += DeviceUp;
            *  Device.Down += DeviceDown;
            *  Device.Left += DeviceLeft;
            *  Device.Right += DeviceRight;
            *  Device.Menu += DeviceMenu;
            *  Device.Ok += DeviceOk;*/

            _currentTheme = _themer.GetTheme();
            ApplyTheme();

            _switchableModes.Add(0x0009);             // STEREO
            _switchableModes.Add(0x0112);             // EXTENDED STEREO
            _switchableModes.Add(0x0109);             // UNPLUGGED
            _switchableModes.Add(0x0118);             // ADVANCED GAME

            // use a delayed timer in case the DeviceArrival event doesn't come up
            this._t = new Timer(delegate {
                _conn.Start();
                this._t.Dispose();
                this._t = null;
            }, null, 3000000, -1);
            ShowMe();
        }
コード例 #2
0
 public override void OnDeviceArrival(DeviceType deviceType)
 {
     _conn.MessageReceived += MessageReceived;
     _conn.Start();
 }