コード例 #1
0
        private void buttonAddBoard_Click(object sender, RoutedEventArgs e)
        {
            AddBoard addBoard = new AddBoard();

            addBoard.ShowDialog();

            List <int> pins = new List <int>();

            if (addBoard.BoardName != null)
            {
                if (!addBoard.BoardName.Equals(""))
                {
                    Board b = new Board();
                    b.name           = addBoard.BoardName;
                    b.digitalPins    = addBoard.digitalPins;
                    b.analogPins     = addBoard.analogPins;
                    b.firstAnalogPin = addBoard.firstAnalogPin;

                    for (int i = 0; i <= b.digitalPins; i++)
                    {
                        pins.Add(i);
                    }

                    for (int i = 0; i < b.analogPins; i++) // add analog pins to the list
                    {
                        pins.Add(b.firstAnalogPin + i);
                    }

                    b.pinNumbers = pins;

                    this.saveBoard(b);
                }
            }
        }
コード例 #2
0
        private void buttonAddBoard_Click(object sender, RoutedEventArgs e)
        {
            AddBoard addBoard = new AddBoard();

            addBoard.ShowDialog();

            List <int> pins = new List <int>();

            if (addBoard.BoardName != null)
            {
                if (!addBoard.BoardName.Equals(""))
                {
                    Board b = new Board();
                    b.name = addBoard.BoardName;
                    for (int i = 1; i <= addBoard.Pins; i++)
                    {
                        pins.Add(i);
                    }
                    b.pinNumbers = pins;

                    this.saveBoard(b);
                }
            }
        }