Exemple #1
0
        private BTUtil btu;                                 // Bluetooth
        #endregion

        public Form1()
        {
            InitializeComponent();

            this.FormBorderStyle = FormBorderStyle.Fixed3D; // ウィンドウの大きさを変更させない

            // オーディオデバイスの取得
            var DevEnum = new MMDeviceEnumerator();

            device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
#if DEBUG
            statLblVol.Text = (float)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100) + "%";
#else
            statLblVol.Text = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100) + "%";
#endif
            device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);

            // タイマー設定
            pressingTimer.Tick    += PressingTimer_Tick;
            pressingTimer.Interval = 100;
            pressingTimer.Start();

            // Bluetooth
            btu = new BTUtil();
            btu.ShowDialog();
            System.Threading.Thread.Sleep(2000);
            if (btu.userClosed)
            {
                Environment.Exit(0);
            }
        }
Exemple #2
0
        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            // 閉じられたら
            this.Text             = "Wiimote Mouse - Closing...";
            this.notifyIcon1.Text = "Wiimote Mouse - Closing...";

            mWiimote.SetLEDs(false, false, false, false);
            mWiimote.Disconnect();
            System.Threading.Thread.Sleep(3000);
            Application.DoEvents();
            btu = new BTUtil();
            btu.disconnectWiimote();
            Application.DoEvents();
        }