/// <summary> /// Changes the currently active band to a given band /// </summary> /// <param name="band">The band to activate</param> public void SetActiveBand(NaviBand newBand) { NaviBandEventArgs e = new NaviBandEventArgs(newBand); OnActiveBandChanging(e); if (!e.Canceled) { if (activeBand != newBand) { foreach (NaviBand band in bands) { if ((band != newBand) && (band.Button != null)) { band.Button.Active = false; } } } if ((newBand != null) && (newBand.Button != null)) { newBand.Button.Active = true; } activeBand = newBand; OnActiveBandChanged(new EventArgs()); PerformLayout(); Invalidate(); } }
/// <summary> /// Raises the ActiveBandChanging event /// </summary> /// <param name="e">Additional event info</param> internal void OnActiveBandChanging(NaviBandEventArgs e) { NaviBandEventHandler handler = activeBandChanging; if (handler != null) { handler(this, e); } }
private void naviBar1_ActiveBandChanging(object sender, Guifreaks.Navisuite.NaviBandEventArgs e) { if (e.NewActiveBand == naviBand2) { MessageBox.Show("Test succeeded"); e.Canceled = true; } //textBoxBarLog.AppendText("BandChanging" + Environment.NewLine); //if (e.NewActiveBand == naviBand2) //{ // if (MessageBox.Show("Do you want to change to Band 2?", "Confirm", // MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) // { // e.Canceled = true; // } //} }