/// <summary> /// Mail button selected /// </summary> /// <param name="e"></param> void nvbMail_OnNavigateBarButtonSelected(NavigateBarButtonEventArgs e) { this.Text = "Mail button pressed"; }
/// <summary> /// Mail button selected /// </summary> /// <param name="e"></param> void nvbMail_OnNavigateBarButtonSelected(NavigateBarButtonEventArgs e) { this.Text = "Mail button pressed"; }
/// <summary> /// Remove NavigateBarButton from collection /// </summary> /// <param name="e"></param> void NavigateBarButtonCollection_OnButtonRemoved(NavigateBarButtonEventArgs e) { try { // Remove from orjinal order string key = string.IsNullOrEmpty(e.NavigateBarButton.Key) ? e.NavigateBarButton.Caption : e.NavigateBarButton.Key; if (buttonOrder.ContainsKey(key)) buttonOrder.Remove(key); // Collection if (this.NavigateBarButtons.Count >= 0) { // Görünen NavigateBarButton sayısını yenile // set new displayed button count displayedButtonCount = this.GetVisibleButtonCount(VisibleType.Visible); // Sonraki elemanı aktif hale getir // Select next button if possible if (this.NavigateBarButtons.Count >= 0) this.SelectedButton = this.NavigateBarButtons[0]; else this.SelectedButton = null; this.ReDisplay(displayedButtonCount); // Event çalıştır // trigger event if (OnNavigateBarButtonRemoved != null) OnNavigateBarButtonRemoved(e.NavigateBarButton); } } catch { } }
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); }
/// <summary> /// Add new NavigateBarButton in collection /// </summary> /// <param name="e"></param> void NavigateBarButtonCollection_OnButtonAdded(NavigateBarButtonEventArgs e) { NavigateBarButton nbButton = e.NavigateBarButton; if (nbButton == null) return; // NavigateBarButtona özelliklerini belirt // Set NavigateBarButton properties nbButton.NavigateBar = this; nbButton.Height = this.NavigateBarButtonHeight; nbButton.OverFlowPanelButton.Height = this.OverFlowPanelHeight - 2; nbButton.Visible = true; nbButton.Dock = DockStyle.Bottom; // NavigateBarButtonu ekle // Add navigatebar button this.Controls.Add(nbButton); // Eğer gözükmesini istenen sayıdan dazla ise eklenen // NavigateBarButtonları görünmez yaparak OverFlowPanele gönder // if collection count bigger max displayed count then show on overflowpanel if (this.NavigateBarButtons.Count > this.NavigateBarDisplayedButtonCount) nbButton.Visible = false; // Orjinal Order string strKey = string.IsNullOrEmpty(nbButton.Key) ? nbButton.Caption : nbButton.Key; if (string.IsNullOrEmpty(strKey)) // if empty key create a new key from guid strKey = NavigateBarHelper.CreateUniqKey(); buttonOrder.Add(strKey, this.NavigateBarButtons.Count); // Display Panel this.ReDisplayNavigateBarButtons(); // Eğer ilk NavigateBarButton eklendiyse Captionlar için tıkla // if added first navigatebar button select first button if (this.NavigateBarButtons.Count == 1) { nbButton.IsSelected = true; NavigateBarButton_Selected(new NavigateBarButtonEventArgs(nbButton)); } // Overflow panel daima en altta olmalı if (this.Controls.Contains(overFlowPanel)) this.Controls.SetChildIndex(overFlowPanel, this.Controls.Count); // Adeti yeniden belirler // set new displayed button count displayedButtonCount = this.GetVisibleButtonCount(VisibleType.Visible); // NavigateBarButton olayları / events nbButton.OnNavigateBarButtonSelected += new NavigateBarButton.OnNavigateBarButtonSelectedEventHandler(NavigateBarButton_Selected); nbButton.OnNavigateBarButtonDisplayChanged += new NavigateBarButton.OnNavigateBarButtonDisplayChangedEventHandler(NavigateBarButton_DisplayChanged); // trigger Event if (OnNavigateBarButtonAdded != null) OnNavigateBarButtonAdded(nbButton); }