Esempio n. 1
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            //The InvokeRequired method will compares the ID of the thread that
            //CALLED this event, to the one that MADE this event.
            //If they are different, invoke required returns TRUE.
            if (spinBox.InvokeRequired)
            {
                //Create delegate instance and provide it an update method
                FormControllerDelegate fcd = new FormControllerDelegate(incrementSpinner);

                //Invoke method asynchronously via a callback method.
                spinBox.Invoke(fcd, new object[] { e });
            }
            else
            {
                spinBox.Value++;
            }
        }
Esempio n. 2
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            //Check if invoke required
            if (listBox.InvokeRequired)
            {
                //Create delegate instance and provide it an update method
                FormControllerDelegate fcd = new FormControllerDelegate(addMetronomeTick);

                //Invoke method asynchronously via a callback method.
                listBox.Invoke(fcd, new object[] { e });
            }
        }