예제 #1
0
 private void start(object sender, RoutedEventArgs e)
 {
     if (startbutton.Content.Equals("スタート"))
     {
         time_t = timese;
         target = 0;
         countdown.Foreground = System.Windows.Media.Brushes.Red;
         countdown.Content    = "3";
         cdtime        = 0;
         cnttime       = 0;
         count.Content = "獲得点数    0点";
         wiimote.Connect();
         dispatcharTimer11.Start();
     }
     else if (startbutton.Content.Equals("リスタート"))
     {
         countdown.Foreground = System.Windows.Media.Brushes.Red;
         countdown.Content    = "3";
         cdtime = 0;
         wiimote.Connect();
         dispatcharTimer11.Start();
     }
     else
     {
         //ストップの状態だと
         wiimote.Disconnect();
         startbutton.Content = "リスタート";
         game = false;
         dispatcharTimer.Stop();
     }
 }
예제 #2
0
 void Page_Closing(object sender, System.ComponentModel.CancelEventArgs e)  //アプリ閉じたら
 {
     //if (game == true)
     //{
     wiimote.Disconnect();
     //}
 }
예제 #3
0
        void bout(object sender, EventArgs e)
        {
            wiimote.Disconnect();
            var nextPage = new MainTitle();

            NavigationService.Navigate(nextPage);
        }
예제 #4
0
 public void StopDesktop()
 {
     if (IsCalibrated() && (lastCalibrationData != null))
     {
         CalibrationPersister.SaveCalibrationData(lastCalibrationData);
     }
     wiimote.SetReportType(Wiimote.InputReport.IRAccel, false);
     wiimote.SetLEDs(false, false, false, false);
     wiimote.Disconnect();
 }
예제 #5
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (wm1.WiimoteState.ConnectionState == WiimoteLib.ConnectionState.Connected)
            {
                wm1.Disconnect();
            }

            if (wm2.WiimoteState.ConnectionState == WiimoteLib.ConnectionState.Connected)
            {
                wm2.Disconnect();
            }
        }
예제 #6
0
        void bac(object sender, EventArgs e)
        {
            var nextPage = new k_Top();

            NavigationService.Navigate(nextPage);

            if (train == true)
            {
                wiimote.Disconnect();
                wiimo = false;
                timer.Stop();
            }
        }
예제 #7
0
        private void teardownWiimoteConnection(Wiimote pDevice)
        {
            if (pDevice != null)
            {
                pDeviceMutex.WaitOne();
                pDevice.WiimoteChanged          -= this.wiimoteChangedEventHandler;
                pDevice.WiimoteExtensionChanged -= this.wiimoteExtensionChangedEventHandler;
                int wiimoteid;
                if (pWiimoteMap.Keys.Contains(pDevice.HIDDevicePath))
                {
                    wiimoteid = this.pWiimoteMap[pDevice.HIDDevicePath].Status.ID;
                    this.pWiimoteMap[pDevice.HIDDevicePath].Teardown();
                    this.pWiimoteMap.Remove(pDevice.HIDDevicePath);
                }
                else
                {
                    wiimoteid = this.pWiimoteMap.Count + 1;
                }
                pDeviceMutex.ReleaseMutex();

                pDevice.SetReportType(InputReport.Status, false);

                pDevice.SetRumble(false);
                pDevice.SetLEDs(true, true, true, true);

                // Close the connection and dispose of the device.
                pDevice.Disconnect();
                pDevice.Dispose();

                OnDisconnect(wiimoteid, this.pWiimoteMap.Count);
            }
        }
예제 #8
0
파일: Form1.cs 프로젝트: oyakodon/Wiimote
        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            mWiimote.SetLEDs(false, false, false, false);
            mWiimote.Disconnect();

            DX.DxLib_End();
        }
예제 #9
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Stop updates.

            infoUpdateTimer.Enabled = false;
            wiiDevice.Disconnect();
        }
예제 #10
0
        private void disconnectButton_Click(object sender, EventArgs e)
        {
            wiiDevice.SetLEDs(false, false, false, false);
            wiiDevice.Disconnect();

            softLabel.Text = "Board disconnected.";
        }
예제 #11
0
 private void Cancel()
 {
     infoUpdateTimer.Enabled = false;
     wiiDevice.Disconnect();
     _canConnectWBB = true;
     _app.CurrentPageViewModel = _app.PreviousPageViewModel;
 }
예제 #12
0
 /// <summary>
 /// Unloads our plugin
 /// </summary>
 public override void Unload()
 {
     if (remote != null)
     {
         remote.Disconnect();
     }
     ParentApplication.WorldWindow.KeyUp -= m_keyHandler;
 }
예제 #13
0
 /// <summary>
 /// Unloads our plugin
 /// </summary>
 public override void Unload()
 {
     if (remote != null)
     {
         remote.Disconnect();
     }
     Global.worldWindow.KeyUp -= m_keyHandler;
 }
예제 #14
0
 internal static void Disconnect()
 {
     if (Wiimote != null)
     {
         Wiimote.SetLEDs(false, false, false, false);
         Wiimote.Disconnect();
         Wiimote = null;
     }
 }
        /// <summary>
        /// Stop the IR Server plugin.
        /// </summary>
        public override void Stop()
        {
            if (_wiimote == null)
            {
                return;
            }

            _wiimote.SetLEDs(false, false, false, false);
            _wiimote.SetRumble(false);
            _wiimote.Disconnect();
        }
예제 #16
0
        private void start(object sender, RoutedEventArgs e)
        {
            if (startbutton.Content.Equals("スタート"))
            {
                time_t  = timekeeper;
                cnttime = 0;
//                 target = 0;
                countdown.Foreground = System.Windows.Media.Brushes.Red;
                countdown.Content    = "3";
                GameOver_flg         = false;
                cdtime = 0;


                //鬼のオブジェクト・座標を初期化
                ye = 0; xe = 0;
                this.field.Children.Remove(this.Enemy);

                //重心のオブジェクト・座標を初期化
                xza = 0; yza = 0;
                this.field.Children.Remove(this.drawingBalance);

                wiimote.Connect();
                dispatcharTimer11.Start();
            }
            else if (startbutton.Content.Equals("リスタート")) //リスタートの状態だと
            {
                countdown.Foreground = System.Windows.Media.Brushes.Red;
                countdown.Content    = "3";
                cdtime = 0;
                wiimote.Connect();
                dispatcharTimer11.Start();
            }
            else
            {
                //ストップの状態だと
                wiimote.Disconnect();
                startbutton.Content = "リスタート";
                game = false;
                dispatcharTimer.Stop();
            }
        }
예제 #17
0
        private void Disconnect_Click(object sender, EventArgs e)
        {
            wiiDevice.Disconnect();
            Connect.Enabled    = true;
            Start30.Enabled    = false;
            Start60.Enabled    = false;
            Disconnect.Enabled = false;

            StatusDat.Text = "Not Connected";
            StatusDat.Refresh();
            StatusContainer.Update();
        }
예제 #18
0
 public override void Unload()
 {
     try
     {
         _wiimote.SetLEDs(false, false, false, false);
         _wiimote.Disconnect();
     }
     catch (Exception exc)
     {
         Logger.Instance.Error(exc.Message, exc);
     }
     _wiimote = null;
 }
예제 #19
0
 //-----------------------------------------------------------------------
 public override void Stop()
 {
     if (Motes != null)
     {
         for (int i = 0; i < Motes.Count; i++)
         {
             Wiimote wii = Motes.ElementAt(i);
             wii.SetLEDs(false, false, false, false);
             wii.Disconnect();
         }
         Motes = null;
     }
 }
예제 #20
0
 public void OnClosing()
 {
     if (wm != null)
     {
         try
         {
             wm.Disconnect();
         }
         catch
         {
         }
     }
 }
예제 #21
0
 void MainWindowClosed(object sender, EventArgs e)
 {
     try
     {
         if (wm != null)
         {
             wm.Disconnect();
         }
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex);
     }
 }
예제 #22
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();
        }
예제 #23
0
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     /******************************************************************
      *  PreCondition: The form is closing
      * PostCondition: If a Wii Remote is connected, it will be disconnected
      *   Description: This event terminates any communication with the
      *                  Wii Remote
      *     Algorithm: If a Wii Remote is connected,
      *                  Turn off the Player 1 LED
      *                  Disconnect the Wii Remote
      *****************************************************************/
     //If there's a Wii Remote connected, disconnect from it
     if (WiiRemotePresent)
     {
         Remote.SetLEDs(false, false, false, false);                 //Turn off the LEDs
         Remote.Disconnect();
     }
 }
예제 #24
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Stop updates.

            infoUpdateTimer.Enabled = false;
            wiiDevice.Disconnect();

            // Prevent 'stuck' down keys from closing while doing an action.

            actionList.Left.Stop();
            actionList.Right.Stop();
            actionList.Forward.Stop();
            actionList.Backward.Stop();
            actionList.Modifier.Stop();
            actionList.Jump.Stop();
            actionList.DiagonalLeft.Stop();
            actionList.DiagonalRight.Stop();
        }
예제 #25
0
 /// <summary>
 /// Dispose and destroy the Wiimote manager
 /// </summary>
 public void Dispose()
 {
     if (_wiimote != null)
     {
         try
         {
             _wiimote.WiimoteChanged          -= wiimote_WiimoteChanged;
             _wiimote.WiimoteExtensionChanged -= wiimote_WiimoteExtensionChanged;
             _wiimote.Disconnect();
             _wiimote.Dispose();
             _wiimote = null;
         }
         catch (Exception ex)
         {
             Console.Error.WriteLine(ex.Message);
             IsAvailable = false;
         }
     }
 }
예제 #26
0
        private void AddNewWiimote(Wiimote NewWiimote)
        {
            if (AvailableIndices.Count == 0)
            {
                NewWiimote.Disconnect();
            }

            NewWiimote.WiimoteDisconnected += OnWiimoteDisconnected;
            NewWiimote.ButtonPressed       += OnButtonPressed;

            int WiimoteIndex = AvailableIndices[0];

            AvailableIndices.RemoveAt(0);

            Wiimote.WiimoteLED LED = Wiimote.WiimoteLED.ALL;

            switch (WiimoteIndex)
            {
            case 0:
                LED = Wiimote.WiimoteLED.LED1;
                break;

            case 1:
                LED = Wiimote.WiimoteLED.LED2;
                break;

            case 2:
                LED = Wiimote.WiimoteLED.LED3;
                break;

            case 3:
                LED = Wiimote.WiimoteLED.LED4;
                break;
            }

            NewWiimote.SetLED(LED);
            RumbleWiimote(NewWiimote);

            Buzzer.Add(new Buzzer("Team " + (WiimoteIndex + 1), BuzzerColors[WiimoteIndex], WiimoteIndex, NewWiimote));
            Buzzer.Sort();
            BuzzerPanel.Items.Refresh();
        }
예제 #27
0
        private void AddNewWiimote(Wiimote NewWiimote)
        {
            if (AvailableIndices.Count == 0)
            {
                NewWiimote.Disconnect();
            }

            NewWiimote.WiimoteDisconnected += OnWiimoteDisconnected;
            NewWiimote.ButtonPressed += OnButtonPressed;

            int WiimoteIndex = AvailableIndices[0];
            AvailableIndices.RemoveAt(0);

            Wiimote.WiimoteLED LED = Wiimote.WiimoteLED.ALL;

            switch (WiimoteIndex)
            {
                case 0:
                    LED = Wiimote.WiimoteLED.LED1;
                    break;
                case 1:
                    LED = Wiimote.WiimoteLED.LED2;
                    break;
                case 2:
                    LED = Wiimote.WiimoteLED.LED3;
                    break;
                case 3:
                    LED = Wiimote.WiimoteLED.LED4;
                    break;
            }

            NewWiimote.SetLED(LED);
            RumbleWiimote(NewWiimote);

            Buzzer.Add(new Buzzer("Team " + (WiimoteIndex + 1), BuzzerColors[WiimoteIndex], WiimoteIndex, NewWiimote));
            Buzzer.Sort();
            BuzzerPanel.Items.Refresh();
        }
예제 #28
0
        //接続・切断ボタンが押されたら
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (button1.Text.Equals("CONNECT"))
            {
                wm.Connect();                                         //Wiimoteの接続
                wm.WiimoteChanged += wm_WiimoteChanged;               //イベント関数の登録
                wm.SetReportType(InputReport.IRExtensionAccel, true); //レポートタイプの設定
                wm.InitializeMotionPlus();

                button1.Text = "DISCONNECT";
                label1.Text  = "GYRO DISABLED";

                wm.SetLEDs(1);
            }
            else
            {
                wm.SetLEDs(0);

                wm.Disconnect();                                     //Wiimote切断
                button1.Text = "CONNECT";
                label1.Text  = "";
            }
        }
예제 #29
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     wm.Disconnect();
 }
예제 #30
0
 public void DisconnectWiimote()
 {
     wm.Disconnect();
     wm.SetReportType(InputReport.IRAccel, true);
     wm.SetLEDs(false, true, true, false);
 }
예제 #31
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     //disconnect the wiimote
     wm.Disconnect();
     saveCalibrationData();
 }