Beispiel #1
0
        /*
         * Function: StickDrawThread
         * Parameters: None
         * Returns: None
         * Description: This method creates a new stick based on the current attributes
         *              of tmpStick, adds the new stick to the stick draw list and then starts
         *              a new thread passing the stick draw list as a reference.
         */
        private void StickDrawThread()
        {
            // create new stick and copy over required tmpStick attributes
            Stick s = new Stick(this);

            s.LineLength = tmpStick.LineLength;
            s.LineAngle  = tmpStick.LineAngle;
            s.CurrPoint  = tmpStick.CurrPoint;
            s.PrevPoint  = tmpStick.PrevPoint;
            s.Lines      = tmpStick.Lines;
            // prevent any current threads from accessing the list
            lock (syncSticks) {
                s.Index = sticks.Count;
                sticks.Add(s);
            }
            // create new thread, start thread, then add thread to thread list
            Thread t = new Thread(new ParameterizedThreadStart(s.UpdateStick));

            threads.Add(t);
            t.Start(sticks);
        }
Beispiel #2
0
        private Stick tmpStick;                                  // stick controlled by the user via mouse

        // constructor
        public frmWindow()
        {
            InitializeComponent();
            tmpStick = new Stick(this);
        }