Esempio n. 1
0
        public void onMetronomeEvent()
        {
            DateTime now = DateTime.Now;
            metronomeEventArgs e = new metronomeEventArgs(now);

            if (metronomeEvent != null)
            {
                metronomeEvent(this, e);
            }
        }
Esempio n. 2
0
        public void onMetronomeEvent()
        {
            DateTime           now = DateTime.Now;
            metronomeEventArgs e   = new metronomeEventArgs(now);

            if (metronomeEvent != null)
            {
                metronomeEvent(this, e);
            }
        }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if(spinBox.InvokeRequired)
     {
         SetFormControlValue s = new SetFormControlValue(incrementSpinnerValue);
         spinBox.Invoke(s, new object[] { e });
     }
     else
     {
         spinBox.Value++;
     }
 }
Esempio n. 4
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         valueIncrement v = new valueIncrement(valuePlus);
         spinBox.Invoke(v);
     }
     else
     {
         valuePlus();
     }
 }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (listBox.InvokeRequired)
     {
         FormControl formControl = new FormControl(updateListBox);
         listBox.Invoke(formControl, new object[] { e });
     }
     else
     {
         updateListBox(e);
     }
 }
Esempio n. 6
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if(spinBox.InvokeRequired)
     {
         valueIncrement v = new valueIncrement(valuePlus);
         spinBox.Invoke(v);
     }
     else
     {
         valuePlus();
     }
 }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         SetFormControlValue s = new SetFormControlValue(incrementSpinnerValue);
         spinBox.Invoke(s, new object[] { e });
     }
     else
     {
         spinBox.Value++;
     }
 }
Esempio n. 8
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (this.spinBox.InvokeRequired)
     {
         UpdateForm updateForm = new UpdateForm(UpdateSpinBox);
         spinBox.Invoke(updateForm, new object[] { e });
     }
     else
     {
         UpdateSpinBox(e);
     }
 }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         //making new delegate
         FormControl formControl = new FormControl(updateSpinBox);
         spinBox.Invoke(formControl, new object[] {e});
     }
     else
     {
         updateSpinBox(e);
     }
 }
Esempio n. 10
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         //making new delegate
         FormControl formControl = new FormControl(updateSpinBox);
         spinBox.Invoke(formControl, new object[] { e });
     }
     else
     {
         updateSpinBox(e);
     }
 }
Esempio n. 11
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired) // if invoke required
     {
         updateSpinBox spinDelegate = new updateSpinBox(incrementSpinBox);
         spinBox.Invoke(spinDelegate);
         // we will use invoke to ensure the code we are calling will run on the thread
         // that the control lives on so that we are "thread safe"
     }
     else                    // otherwise we are on the thread the control lives on so we can increment
     {
         incrementSpinBox(); // from this thread
     }
 }
Esempio n. 12
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     //DateTime currDateTime = e.currentTime;
     //listBox.Items.Add(currDateTime.ToString());
     if (listBox.InvokeRequired)
     {
         updateListBox listDelegate = new updateListBox(changeDateTime);
         listBox.Invoke(listDelegate, e.currentTime);
     }
     else
     {
         changeDateTime(e.currentTime);
     }
 }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            count++;

            if (spinBox.InvokeRequired)
            {
                incrementSpinBoxCallback = SetSpinBox;
                spinBox.Invoke(incrementSpinBoxCallback, count);
            }
            else
            {
                SetSpinBox(count);
            }
        }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            if (listBox.InvokeRequired)
            {
                setDateTimeCallback = SetText;
                listBox.Invoke(setDateTimeCallback, currDateTime);
            }
            else
            {
                SetText(currDateTime);
            }
        }
Esempio n. 15
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            if (listBox.InvokeRequired)
            {
                addToListbox a = new addToListbox(addIntoListbox);
                listBox.Invoke(a, currDateTime.ToString());
            }
            else
            {
                addIntoListbox(currDateTime.ToString());
            }
        }
Esempio n. 16
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         // It's on a different thread, so use Invoke.
         SetCallBack d = new SetCallBack(IncrementSpinBox);
         metronome.mainForm.Invoke(d);
     }
     else
     {
         // It's on the same thread, no need for Invoke
         spinBox.Value++;
     }
 }
Esempio n. 17
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         //Set call back
         setCallBack d = new setCallBack(onMetronomeEvent);
         //Let spinBox know what we want to do
         spinBox.Invoke(d, new object[] {sender,e});
     }
     else
     {
         spinBox.Value++;
     }
 }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            count++;

            if (spinBox.InvokeRequired)
            {
                incrementSpinBoxCallback = SetSpinBox;
                spinBox.Invoke(incrementSpinBoxCallback, count);
            }
            else
            {
                SetSpinBox(count);
            }
        }
Esempio n. 19
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            if (listBox.InvokeRequired)
            {
                // It's on a different thread, so use Invoke.
                SetCallBack d = new SetCallBack(AddTimeStamp);
                metronome.mainForm.Invoke(d, currDateTime.ToString());
            }
            else
            {
                listBox.Items.Add(currDateTime.ToString());
            }
        }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.spinBox.InvokeRequired)
     {
         FormControlDelegate updateControl = new FormControlDelegate(increaseSpinBox);
         spinBox.Invoke(updateControl, new object[] { e });
     }
     else
     {
         increaseSpinBox(e);
     }
 }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.spinBox.InvokeRequired)
     {
         FormControlDelegate updateControl = new FormControlDelegate(increaseSpinBox);
         spinBox.Invoke(updateControl, new object[] { e });
     }
     else
     {
         increaseSpinBox(e);
     }
 }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            if (listBox.InvokeRequired)
            {
                listboxDelegate ld = new listboxDelegate(updateTimeString);
                listBox.Invoke(ld, e.currentTime);
            }
            else
            {
                updateTimeString(e.currentTime);
            }


            /*DateTime currDateTime = e.currentTime;
             * listBox.Items.Add(currDateTime.ToString());*/
        }
Esempio n. 23
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++;
            }
        }
Esempio n. 24
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++;
            }
        }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            // InvokeRequired gets a value indicating whether the caller must call an invoke
            // method when making method calls to the control because the caller is on a different
            // thread than the one the control was created on
            // Returns true, if the control's handle was created on a different thread than the
            // calling thread
            if (spinBox.InvokeRequired)
            {
                spinDelegate sd = new spinDelegate(incrementSpinVal);

                // Invoke method executes the specified delegate on the thread that owns the
                // control's underlying window handle
                spinBox.Invoke(sd);
            }
            else
            {
                incrementSpinVal();
            }
        }
Esempio n. 26
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (listBox.InvokeRequired)
     {
         FormControl formControl = new FormControl(updateListBox);
         listBox.Invoke(formControl, new object[] { e });
     }
     else
     {
         updateListBox(e);
     }
 }
        private void setTimeString(metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            listBox.Items.Add(currDateTime.ToString());
        }
Esempio n. 28
0
 //Method to update spinBox, method signature matches Delegate that will be invoked by spinBox thread.
 private void updateSpinbox(metronomeEventArgs e)
 {
     spinBox.Value++;
 }
Esempio n. 29
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);

            }
        }
Esempio n. 30
0
 //Method to print DateTime to listBox, method signature matches Delegate that will be invoked by listBox thread.
 public void updateDateTimeListBox(metronomeEventArgs e)
 {
     //Create date time from passed in object.
     DateTime currDateTime = e.currentTime;
     listBox.Items.Add(currDateTime.ToString());
 }
Esempio n. 31
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     soundPlayer.Play();
 }
 private void incrementSpinnerValue(metronomeEventArgs e)
 {
     spinBox.Value++;
 }
 //method changes spinbox (method matches FormControlDelegate signature)
 public void increaseSpinBox(metronomeEventArgs e)
 {
     spinBox.Value++;
 }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            if (listBox.InvokeRequired)
            {
                setDateTimeCallback = SetText;
                listBox.Invoke(setDateTimeCallback, currDateTime);
            }
            else
            {
                SetText(currDateTime);
            }
        }
 private void incrementSpinnerValue(metronomeEventArgs e)
 {
     spinBox.Value++;
 }
 //method changes spinbox (method matches FormControlDelegate signature)
 public void increaseSpinBox(metronomeEventArgs e)
 {
     spinBox.Value++;
 }
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            SetFormControlValue lb = new SetFormControlValue(setTimeString);

            listBox.Invoke(lb, new object[] { e });
        }
Esempio n. 38
0
 public void UpdateListBox(metronomeEventArgs e)
 {
     DateTime currDateTime = e.currentTime;
     listBox.Items.Add(currDateTime.ToString());
 }
Esempio n. 39
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            if (listBox.InvokeRequired)
            {
                //Set call back
                setCallBack d = new setCallBack(onMetronomeEvent);
                listBox.Invoke(d, new object[] { sender, e });
            }
            else
            {
                listBox.Items.Add(currDateTime.ToString());
            }
        }
Esempio n. 40
0
 public void updateSpinBox(metronomeEventArgs me)
 {
     spinBox.Value++;
 }
Esempio n. 41
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     if (spinBox.InvokeRequired)
     {
         // It's on a different thread, so use Invoke.
         SetCallBack d = new SetCallBack(IncrementSpinBox);
         metronome.mainForm.Invoke(d);
     }
     else
     {
         // It's on the same thread, no need for Invoke
         spinBox.Value++;
     }
 }
Esempio n. 42
0
 public virtual void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     MessageBox.Show("My metronome clicked");
 }
Esempio n. 43
0
        public override void onMetronomeEvent(object sender, metronomeEventArgs e)
        {
            DateTime currDateTime = e.currentTime;

            if (listBox.InvokeRequired)
            {
                // It's on a different thread, so use Invoke.
                SetCallBack d = new SetCallBack(AddTimeStamp);
                metronome.mainForm.Invoke(d, currDateTime.ToString());
            }
            else
            {
                listBox.Items.Add(currDateTime.ToString());
            }
        }
Esempio n. 44
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 });
            }
        }
        //method gets time from metronome event object and sets it to listbox (method matches FormControlDelegate signature)
        public void updateListBox(metronomeEventArgs e)
        {
            DateTime dateTime = e.currentTime;

            listBox.Items.Add(dateTime.ToString());
        }
Esempio n. 46
0
 public virtual void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     MessageBox.Show("My metronome clicked");
 }
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     SetFormControlValue lb = new SetFormControlValue(setTimeString);
     listBox.Invoke(lb, new object[] { e });
 }
Esempio n. 48
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     soundPlayer.Play();
 }
 private void setTimeString(metronomeEventArgs e)
 {
     DateTime currDateTime = e.currentTime;
     listBox.Items.Add(currDateTime.ToString());
 }
Esempio n. 50
0
 public void UpdateSpinBox(metronomeEventArgs e)
 {
     spinBox.Value++;
 }
Esempio n. 51
0
 public override void onMetronomeEvent(object sender, metronomeEventArgs e)
 {
     DateTime currDateTime = e.currentTime;
     if (listBox.InvokeRequired)
     {
         addToListbox a = new addToListbox(addIntoListbox);
         listBox.Invoke(a, currDateTime.ToString());
     }
     else
     {
         addIntoListbox(currDateTime.ToString());
     }
 }