Exemplo n.º 1
0
        static void Main(string[] agrs)
        {
            IDataReceiver dataReceiver  = new DataConverter();
            BLEHandler    bLEHandler    = new BLEHandler(dataReceiver);
            BikeSimulator bikeSimulator = new BikeSimulator(dataReceiver);

            bikeSimulator.setResistance(1);
            bikeSimulator.StartSimulation();


            bool running = true;

            while (running)
            {
                string input = Console.ReadLine();
                input.ToLower();
                input.Trim();
                if (input == "quit")
                {
                    running = false;
                    break;
                }
                try
                {
                    int resistance = Int32.Parse(input);
                    bLEHandler.setResistance(resistance);
                }
                catch
                {
                    //do nothing
                }
            }
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            Client client = new Client();

            InitializeComponent();
            DataContext = new MainWindowViewModel(this, client);

            //BLEHandler bLEHandler = new BLEHandler(client);

            //bLEHandler.Connect();

            //client.setHandler(bLEHandler);

            BikeSimulator bikeSimulator = new BikeSimulator(client);

            Thread newThread = new Thread(new ThreadStart(bikeSimulator.StartSimulation));

            newThread.Start();

            client.SetHandler(bikeSimulator);
            handler = bikeSimulator;
        }