예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            for (int i = 0; i < 20; i++)
            {
                WrapPanel wrapPanel = new WrapPanel();
                Label     label     = new Label();
                label.Content = "Test" + i.ToString();

                TextBox textBox = new TextBox();
                textBox.Width = 100;

                wrapPanel.Children.Add(label);
                wrapPanel.Children.Add(textBox);
                stk_Panel.Children.Add(wrapPanel);
            }

            Page16 page16 = new Page16(0x19, 0x66, 0x63, 0x03, 0xFF, 3, 4);
            Page25 page25 = new Page25(0x7A, 0x49, 0x32, 0x06, 0x00, 0x33);

            simulationBike = new SimulationBike(this);
            simulationBike.AddPageSimualtion(page16, 10, 250);
            simulationBike.AddPageSimualtion(page25, 10, 250);

            //Page16 page = new Page16(0x19, 0x66, 0x63, 0x03, 0xFF, 3, 4);
            //Page16 page = new Page16(0x19, 0x68, 0x63, 0x02, 0xFF, 3, 4);
            //Page16 page = new Page16(0x19, 0x66, 0x63, 0x03, 0xFF, 0x34);
            //Page25 page = new Page25(0x7A, 0x49, 0x32, 0x06, 0x00, 0x33);
            //BikeMessage message = new BikeMessage(page);
            //txb_Messages.Text = BitConverter.ToString(message.GetBytes());
        }
        public override Page SimulateNewPage(double variance, Random random)
        {
            Page25 page = new Page25(RandomWithVariance(random, this.updateEventCount, variance),
                                     this.instantaneousCadence,
                                     (byte)(this.accumulatedPowerMSB + RandomWithVariance(random, this.instantaneousPowerMSB, variance)),
                                     RandomWithVariance(random, this.instantaneousPowerMSB, variance),
                                     this.trainerField,
                                     this.bitFields);

            return(page);
        }