示例#1
0
        private void updatePosition(bool forward)
        {
            if (forward)
            {
                if (playbackPos < (numFrames - 1))
                {
                    playbackPos++;
                }
                else if (ckLoop.Checked)
                {
                    playbackPos = 0;
                }
            }
            else
            {
                if (playbackPos > 0)
                {
                    playbackPos--;
                }
                else if (ckLoop.Checked)
                {
                    playbackPos = numFrames - 1;
                }
            }
            //Debug.Print(playbackPos.ToString());

            //only send frame out if its ID is checked in the list. Otherwise discard it.
            int fid = foundID.IndexOf(loadedFrames[playbackPos].ID);

            if (cListFrames.GetItemChecked(fid))
            {
                loadedFrames[playbackPos].timestamp = Utility.GetTimeMS();
                parent.sideloadFrame(loadedFrames[playbackPos]);
                //index 0 is none, 1 is Bus 0, 2 is bus 1, 3 is from file.
                if (whichBusSend == 1)
                {
                    parent.SendCANFrame(loadedFrames[playbackPos], 0);
                }
                if (whichBusSend == 2)
                {
                    parent.SendCANFrame(loadedFrames[playbackPos], 1);
                }
                if (whichBusSend == 3)
                {
                    parent.SendCANFrame(loadedFrames[playbackPos], loadedFrames[playbackPos].bus);
                }
                //updateFrameCounter();
            }
        }