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(); base.InitializeApplet(); Device.SetAsLCDForegroundApp(true); UpdateLcdScreen(this, EventArgs.Empty); if (!IsHandleCreated) { CreateHandle(); } _hotkey = new PioneerHooks(Device); _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); }