Exemplo n.º 1
0
 static void Main()
 {
     if (_mutex.WaitOne(TimeSpan.Zero, true))
     {
         Application.EnableVisualStyles();
         try {
             var mf = new MainForm();
             Application.Run();
         }
         catch (TypeInitializationException) {
             MessageBox.Show("Type initialization exception! If lglcd.dll in the same folder as this program?");
         }
         catch (Exception exc) {
             if (exc.Message == "LCDMon is not running on the system.")
             {
                 MessageBox.Show(exc.Message);
             }
         }
         finally {
             Application.Exit();
             _mutex.ReleaseMutex();
         }
     }
     else
     {
         PioneerHooks.BroadcastForegroundRequest();
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }