public void pairingMessage(string message, WiiCPP.WiiPairListener.MessageType type)
        {
            Dispatcher.BeginInvoke(new Action(delegate()
            {
                this.pairWiimoteText.Text = message;
                if (message == "Scanning...")
                {
                    pairWiimotePressSync.Visibility = Visibility.Visible;

                    if (this.imgClosePairCheck.Visibility == Visibility.Hidden && this.imgClosePairClose.Visibility == Visibility.Hidden)
                    {
                        this.imgClosePairClose.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    pairWiimotePressSync.Visibility = Visibility.Hidden;
                }
            }), null);
        }
        public void onPairingDone(WiiCPP.WiiPairReport report)
        {
            Dispatcher.BeginInvoke(new Action(delegate()
            {
            this.pairingTitle.Content = "Pairing Cancelled";
            this.pairWiimoteTryAgain.Visibility = Visibility.Visible;
            this.imgClosePairCheck.Visibility = Visibility.Hidden;
            this.imgClosePairClose.Visibility = Visibility.Visible;
            this.pairWiimoteCheckmarkImg.Visibility = Visibility.Hidden;

            this.pairProgress.IsIndeterminate = false;
            }), null);
        }
Beispiel #3
0
        public void pairingMessage(string message, WiiCPP.WiiPairListener.MessageType type)
        {
            Dispatcher.BeginInvoke(new Action(delegate()
            {
                this.pairWiimoteText.Text = message;
                if (message == "Scanning...")
                {
                    pairWiimotePressSync.Visibility = Visibility.Visible;

                }
                else
                {
                    pairWiimotePressSync.Visibility = Visibility.Hidden;
                }

                if (type == WiiCPP.WiiPairListener.MessageType.ERR)
                {
                    this.showMessage(message, MessageType.Error);
                }

            }), null);
        }
        public void onPairingProgress(WiiCPP.WiiPairReport report)
        {
            Console.WriteLine("Success report: number=" + report.numberPaired + " removeMode=" + report.removeMode + " devicelist=" + report.deviceNames);

            if (report.removeMode)
            {
                this.wiiPairRunning = true;
                Dispatcher.BeginInvoke(new Action(delegate()
                {
                    this.imgClosePairCheck.Visibility = Visibility.Hidden;
                    this.imgClosePairClose.Visibility = Visibility.Visible;
                }), null);
                wiiPair.start(false,10); //Run the actual pairing after removing all previous connected devices.
            }
            else if (report.numberPaired > 0)
            {
                Settings.Default.pairedOnce = true;

                Dispatcher.BeginInvoke(new Action(delegate()
                {
                    if (report.numberPaired == 1)
                    {
                        this.pairingTitle.Content = "One Wiimote Paired";
                    }
                    else
                    {
                        this.pairingTitle.Content = report.numberPaired + " Wiimotes Paired";
                    }
                    this.imgClosePairCheck.Visibility = Visibility.Visible;
                    this.imgClosePairClose.Visibility = Visibility.Hidden;
                }), null);

                if (!this.wiiPairRunning)
                {
                    if (report.deviceNames.Contains(@"Nintendo RVL-CNT-01-TR"))
                    {
                        Dispatcher.BeginInvoke(new Action(delegate()
                        {
                            //this.pairingTitle.Content = "Pairing Successful";
                            this.pairWiimoteText.Text = @"";
                            this.pairWiimotePressSync.Visibility = Visibility.Hidden;
                            this.pairWiimoteTRFail.Visibility = Visibility.Visible;
                            this.pairWiimoteTryAgain.Visibility = Visibility.Visible;

                            this.pairProgress.Visibility = Visibility.Hidden;

                            this.pairProgress.IsIndeterminate = false;

                        }), null);
                    }
                    else
                    {
                        Dispatcher.BeginInvoke(new Action(delegate()
                        {
                            //this.pairWiimoteOverlayPairing.Visibility = Visibility.Hidden;
                            //this.pairWiimoteOverlayDone.Visibility = Visibility.Visible;
                            this.pairWiimoteText.Text = @"";
                            this.pairWiimotePressSync.Visibility = Visibility.Hidden;
                            this.pairWiimoteTryAgain.Visibility = Visibility.Hidden;
                            this.pairWiimoteCheckmarkImg.Visibility = Visibility.Visible;

                            this.pairProgress.Visibility = Visibility.Hidden;

                            this.pairProgress.IsIndeterminate = false;

                        }), null);
                    }
                }
            }
            else
            {
                Dispatcher.BeginInvoke(new Action(delegate()
                {
                    this.imgClosePairCheck.Visibility = Visibility.Hidden;
                    this.imgClosePairClose.Visibility = Visibility.Visible;
                }), null);
            }
        }
Beispiel #5
0
        public void onPairingProgress(WiiCPP.WiiPairReport report)
        {
            Console.WriteLine("Pairing progress: number=" + report.numberPaired + " removeMode=" + report.removeMode + " devicelist=" + report.deviceNames);
            if (report.status == WiiCPP.WiiPairReport.Status.RUNNING)
            {
                if (report.numberPaired > 0)
                {
                    Settings.Default.pairedOnce = true;

                    if (report.deviceNames.Contains(@"Nintendo RVL-CNT-01-TR"))
                    {
                        this.showMessage("At least one of your Wiimotes is not compatible with the Microsoft Bluetooth Stack, use only Wiimotes manufactured before November 2011 or try the instructions on touchmote.net/wiimotetr ",MessageType.Info);
                    }
                }
            }
            else
            {
                if (report.removeMode && report.status != WiiCPP.WiiPairReport.Status.CANCELLED)
                {
                    this.wiiPairRunning = true;

                    Dispatcher.BeginInvoke(new Action(delegate()
                    {
                        this.connectProvider();
                    }), null);

                    int stopat = 10;
                    if (this.startupPair)
                    {
                        stopat = 1;
                        this.startupPair = false;
                    }
                    wiiPair.start(false, stopat); //Run the actual pairing after removing all previous connected devices.
                }
                else
                {
                    this.wiiPairRunning = false;
                    Dispatcher.BeginInvoke(new Action(delegate()
                    {
                        //this.canvasPairing.Visibility = Visibility.Collapsed;
                        this.animateCollapse(this.spPairing,false);
                        this.tbPair2.Visibility = Visibility.Visible;
                        this.tbPairDone.Visibility = Visibility.Collapsed;

                        this.pairProgress.IsActive = false;
                    }), null);
                }
            }
        }