コード例 #1
0
        private void btnSetLane_Click(object sender, RoutedEventArgs e)
        {
            string number     = tbLaneNumber.Text.Trim();
            int    laneNumber = 0;

            if (!Int32.TryParse(number, out laneNumber))
            {
                return;
            }
            XBowlingDataGrabber DG = new XBowlingDataGrabber(laneNumber);
            Thread scoreUpdater    = new Thread(DG.Updater);

            scoreUpdater.Start();
            MH = new MainHelper(grid, challenge);
            Thread screenUpdater = new Thread(() => {
                while (true)
                {
                    if (DG.Scores != scores && DG.Scores.Count >= scores.Count)
                    {
                        scores = DG.Scores;
                        Dispatcher.Invoke(new Action(delegate()
                        {
                            int children = grid.Children.Count;
                            for (int i = 0; i < children; i++)
                            {
                                grid.Children.Remove(grid.Children[0]);
                            }
                            MH.AutoPopulation(DG.Scores);
                        }));
                    }
                    else
                    {
                        //nothing
                    }
                    System.Threading.Thread.Sleep(700);
                }
            });

            screenUpdater.Start();
            this.Topmost = true;
        }