示例#1
0
        private void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

            _twoMotorsDriver = new TwoMotorsDriver(new Motor(6, 5), new Motor(13, 26));
            _uln2003Driver = new Uln2003Driver(16, 12, 25, 24);
            _ultrasonicDistanceSensor = new UltrasonicDistanceSensor(4, 27);

            _worker = new BackgroundWorker();
            _worker.DoWork += QueueListener_DoWork;
            _worker.RunWorkerAsync();

            _worker2 = new BackgroundWorker();
            _worker2.DoWork += AvoidCrash_DoWork;
            _worker2.RunWorkerAsync();
        }
示例#2
0
        private void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

            _twoMotorsDriver          = new TwoMotorsDriver(new Motor(6, 5), new Motor(13, 26));
            _uln2003Driver            = new Uln2003Driver(16, 12, 25, 24);
            _ultrasonicDistanceSensor = new UltrasonicDistanceSensor(4, 27);

            _worker         = new BackgroundWorker();
            _worker.DoWork += DoWork;
            _worker.RunWorkerAsync();

            _worker2         = new BackgroundWorker();
            _worker2.DoWork += DoWork2;
            _worker2.RunWorkerAsync();
        }