Пример #1
0
        private void frame_ValueChanged(object sender, EventArgs e)
        {

            frameInt = (int)frame.Value - 1;

            int frameTime = frameInt + 1;

            frame.Maximum = decimal.MaxValue;



            if (selectedPinData.GetFrames().ToArray().Length < frameTime)
            {
                int times = frameTime - selectedPinData.GetFrames().ToArray().Length;


                for (int i = 0; i < times; i++)
                {
                    int newFrame = frameTime - i;
                    selectedPinData.GetFrames().Add(new PinData.FrameData(newFrame, PinData.Pinmode.OFF));
                }


            }

            if (frameInt < 0) frameInt = 0;

            PinData.FrameData frameData = selectedPinData.GetFrames()[frameInt];
            updateFrame(frameData);
        }
Пример #2
0
        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";
        }