/// <summary> /// Check selecting for any button /// </summary> /// <param name="e"></param> void outlookNavigatePane_OnNavigateBarButtonSelecting(NavigateBarButtonCancelEventArgs e) { // Calendar control if (e.Selected.Equals(nvbCalendar) && !this.DesignMode) { if (MessageBox.Show("Select " + e.Selected.Caption + " button ", "Select", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) e.Cancel = true; } }
void NavigateBarButton_Selected(NavigateBarButtonEventArgs e) { // Zaten seçili ise // If already selected return if (this.SelectedButton != null && this.SelectedButton.Equals(e.NavigateBarButton)) return; // Button seçim işlemini kontrol et // Cancel Selected Button NavigateBarButton previousSelected = this.SelectedButton; NavigateBarButtonCancelEventArgs cancelArgs = new NavigateBarButtonCancelEventArgs(e.NavigateBarButton, previousSelected); if (this.OnNavigateBarButtonSelecting != null) // Run Selecting Event this.OnNavigateBarButtonSelecting(cancelArgs); if (cancelArgs.Cancel) // Check Cancel state { e.NavigateBarButton.IsSelected = false; this.SelectedButton = previousSelected; previousSelected = null; return; } // Control içerisindeki tüm butonların IsSelected ayarla // set IsSelected state for all buttons in collection foreach (NavigateBarButton nvb in this.NavigateBarButtons) nvb.IsSelected = nvb.Equals(e.NavigateBarButton); // Seçili NavigateBarButtonun özelliklerini aktar // Set new caption and image info for selected button this.SetCaptionText(e.NavigateBarButton); // Select Button selectedButton = e.NavigateBarButton; // Seçilen NavigateBarButton için Controlü göster // display releated control for selected button this.SetControlForNavigateBarButton(e.NavigateBarButton.RelatedControl); // If set true IsShowOnButtonSelect and not displayed screen then show collapse screen if (this.IsCollapseScreenShowOnButtonSelect && !collapsibleScreen.IsShowWindow) ShowOverScreen(); // Trigger Event if (OnNavigateBarButtonSelected != null) OnNavigateBarButtonSelected(e.NavigateBarButton); }