Exemplo n.º 1
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            //Compare if the calling thread is the same as the creating thread of the spinBox. if different, returns true.
            if (spinBox.InvokeRequired)
            {
                //Create delegate and pass in method to run from delegate.
                UpdateFormControlDelegate updateSpinBoxDelegate = new UpdateFormControlDelegate(updateSpinbox);
                //Get the spinbox(original Creating thread) to invoke\call\run the delegate and pass in the arguments as an array.
                spinBox.Invoke(updateSpinBoxDelegate, new object[] { e });//spinbox updates on form,

            }
            else
            {
                spinBox.Value++;
            }
        }
Exemplo n.º 2
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            if(listBox.InvokeRequired)
            {
                //Create delegate and pass in method to run from delegate.
                UpdateFormControlDelegate updateListBoxDateTimeDelegate = new UpdateFormControlDelegate(updateDateTimeListBox);
                //Get the listBox(original Creating thread) to invoke\call\run the delegate and pass in the arguments as an array.
                listBox.Invoke(updateListBoxDateTimeDelegate, new object[]{e});   //update list box from passed in array of arguments.

            }
            else{

                updateDateTimeListBox(e);

            }
        }