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++; } }
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); } }
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++; } }
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); } }
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); } }
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 } }
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); } }
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()); } }
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++; } }
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) { 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) { 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());*/ }
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++; } }
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(); } }
private void setTimeString(metronomeEventArgs e) { DateTime currDateTime = e.currentTime; listBox.Items.Add(currDateTime.ToString()); }
//Method to update spinBox, method signature matches Delegate that will be invoked by spinBox thread. private void updateSpinbox(metronomeEventArgs e) { spinBox.Value++; }
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); } }
//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()); }
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) { SetFormControlValue lb = new SetFormControlValue(setTimeString); listBox.Invoke(lb, new object[] { e }); }
public void UpdateListBox(metronomeEventArgs e) { DateTime currDateTime = e.currentTime; listBox.Items.Add(currDateTime.ToString()); }
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()); } }
public void updateSpinBox(metronomeEventArgs me) { spinBox.Value++; }
public virtual void onMetronomeEvent(object sender, metronomeEventArgs e) { MessageBox.Show("My metronome clicked"); }
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()); }
public void UpdateSpinBox(metronomeEventArgs e) { spinBox.Value++; }