public LightAnimator4Pi() { InitializeComponent(); //whichpi.Items.Add("custom"); SupportedPis[] values = (SupportedPis[])Enum.GetValues(typeof(SupportedPis)); for (int i = 0; i < values.Length; i++) { SupportedPis supported = values[i]; whichpi.Items.Add(supported.ToString()); } for (int i = 0; i < pinDatas.Length; i++) { PinData pinData = new PinData(i); pinDatas[i] = pinData; } frameInt = (int)frame.Value; selectedPinData = pinDatas[(int)selectedpin.Value]; selectedPinData.GetFrames().Add(new PinData.FrameData(frameInt, PinData.Pinmode.OFF)); whichpi.SelectedIndex = 0; fps.Value = 10; logBox.Scrollable = true; statusLabel.Text = "The current status is not set"; }
// *override* static method from subclass // (overriding a static method is not supported in Java // so this method definition will hide the subclass static method) public int AllPins(SupportedPis supportedPi) { int max; max = 16; // no further pins to add for Model B Rev 1 boards if (supportedPi == SupportedPis.RaspberryPi_B_Rev1) { // return pins collection return max; } // add pins exclusive to Model A and Model B (Rev2) if (supportedPi == SupportedPis.RaspberryPi_A || supportedPi == SupportedPis.RaspberryPi_B_Rev2) { max = 20; } // add pins exclusive to Models A+, B+, 2B, 3B, and Zero else { max = 31; } // return pins collection return max; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { SupportedPis selectedPi = ParseEnum<SupportedPis>(whichpi.SelectedItem.ToString()); selectedpin.Maximum = AllPins(selectedPi); }