Пример #1
0
        private void btnSync_Click(object sender, RoutedEventArgs e)
        {
            Windows.SyncWindow sync = new Windows.SyncWindow();

            //foreach (var c in groupAvailable.Children)
            //{
            //    DeviceControl devCtrl = (DeviceControl)c;
            //    devCtrl.
            //}

            //deviceList[0].Device.

            //sync.ConnectedDeviceAddresses

            sync.NewDeviceFound += Sync_NewDeviceFound;
            sync.Closed         += Sync_Closed;

            sync.ShowDialog();

            //var timer = new DispatcherTimer();

            //timer.Interval = new TimeSpan(0, 0, 1);

            //timer.Tick += (sender2, e2) =>
            //{
            //    if (sync != null && sync.IsVisible)
            //    {
            //        //if (!sync.IsFocused)
            //        //{
            //        //    sync.Close();
            //        //}

            //       // Refresh();
            //    }
            //    else
            //    {
            //        timer.Stop();
            //    }
            //};
            //timer.Start();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            workThread = new System.Threading.Thread(() =>
            {
                //Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                //{
                SyncWindow.RemoveAllWiimotes();
                Application.Current.Dispatcher.BeginInvoke(new Action(() => Close()));
                //}));
            });

            workThread.IsBackground = true;

            workThread.Start();

            //Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            //{
            //    SyncWindow.RemoveAllWiimotes();
            //    Close();
            //}));
        }
Пример #3
0
 private void btnSync_Click(object sender, RoutedEventArgs e)
 {
     Windows.SyncWindow sync = new Windows.SyncWindow();
     sync.ShowDialog();
     Refresh();
 }