コード例 #1
0
        /// <summary>
        /// Remove NavigateBarButton from collection
        /// </summary>
        /// <param name="e"></param>
        void NavigateBarButtonCollection_OnNavigateBarButtonItemRemoved(NavigateBarButtonEventArgs e)
        {
            try
            {

                if (navigateBarButtonCollection.Count >= 0)
                {

                    // Görünen NavigateBarButton sayısını yenile
                    // set new displayed button count

                    displayedButtonCount = GetVisibleButtonCount(VisibleType.Visible);

                    // Sonraki elemanı aktif hale getir
                    // Select next button if possible

                    if (navigateBarButtonCollection.Count >= 0)
                        this.SelectedButton = navigateBarButtonCollection[0];
                    else
                        this.SelectedButton = null;

                    ReDisplay(displayedButtonCount);

                    // Event çalıştır // trigger event

                    if (OnNavigateBarButtonRemoved != null)
                        OnNavigateBarButtonRemoved(e.NavigateBarButton);
                }
            }
            catch { }
        }
コード例 #2
0
        void NavigateBarButton_Selected(NavigateBarButtonEventArgs e)
        {
            // Zaten seçili ise
            // If already selected return

            if (selectedButton != null && SelectedButton.Equals(e.NavigateBarButton))
                return;

            // Control içerisindeki tüm butonların IsSelected ayarla
            // set IsSelected state for all buttons in collection

            foreach (NavigateBarButton nvb in navigateBarButtonCollection)
                nvb.IsSelected = nvb.Equals(e.NavigateBarButton);

            overFlowPanel.Refresh();

            // Seçili NavigateBarButtonun özelliklerini aktar
            // Set new caption and image info for selected button

            navigateBarCaption.Caption = e.NavigateBarButton.CaptionOrjinal;
            navigateBarCaption.Image = e.NavigateBarButton.IsShowCaptionImage ? e.NavigateBarButton.Image : null;
            navigateBarCaptionDesc.Caption = e.NavigateBarButton.CaptionDescription;

            navigateBarCaption.Visible = e.NavigateBarButton.IsShowCaption;
            navigateBarCaptionDesc.Visible = e.NavigateBarButton.IsShowCaptionDescription;

            // Seçili buttonu bar üzerindeki değişkenede atama
            // Set selected button var

            selectedButton = e.NavigateBarButton;

            // Seçilen NavigateBarButton için Controlü göster
            // display releated control for selected button

            SetControlForNavigateBarButton(e.NavigateBarButton.RelatedControl);

            //
            if (OnNavigateBarButtonSelected != null)
                OnNavigateBarButtonSelected(e.NavigateBarButton);
        }
コード例 #3
0
        /// <summary>
        /// Add new NavigateBarButton in collection
        /// </summary>
        /// <param name="e"></param>
        void NavigateBarButtonCollection_OnNavigateBarButtonItemAdded(NavigateBarButtonEventArgs e)
        {
            NavigateBarButton navigateBarButton = e.NavigateBarButton;

            if (navigateBarButton == null)
                return;

            // NavigateBarButtona özelliklerini belirt
            // Set NavigateBarButton properties

            navigateBarButton.NavigateBar = this;
            navigateBarButton.Height = this.NavigateBarButtonHeight;

            // 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 (navigateBarButtonCollection.Count > NavigateBarDisplayedButtonCount)
                navigateBarButton.Visible = false;

            // NavigateBarButtonu ekle
            // Add navigatebar button

            navigateBarButtonContainer.Controls.Add(navigateBarButton);
            ReDisplayNavigateBarButtons();

            // Eğer ilk NavigateBarButton eklendiyse Captionlar için tıkla
            // if added first navigatebar button select first button

            if (navigateBarButtonCollection.Count == 1)
            {
                navigateBarButton.IsSelected = true;
                NavigateBarButton_Selected(new NavigateBarButtonEventArgs(navigateBarButton));
            }

            navigateBarButton.Dock = DockStyle.Bottom;

            // Buttonun kayıtlı ayarlarını geri yükle
            // Load setting for added button

            if (saveAndRestoreSettings && settings.IsLoad)
            {
                NavigateBarSettings.ButtonRestoreSettings brs = null;
                settings.ButtonRestoreInfo.TryGetValue(navigateBarButton.Key, out brs);
                if (brs != null)
                {
                    navigateBarButton.Visible = brs.Visible;
                    navigateBarButton.Enabled = brs.Enabled;
                    navigateBarButton.IsDisplayed = brs.Display;
                    navigateBarButton.IsSelected = brs.Selected;

                    if (brs.Selected) // seçili // If selected on exit then select
                        SelectedButton = navigateBarButton;
                }
            }

            // Adeti yeniden belirler
            // set new displayed button count

            displayedButtonCount = GetVisibleButtonCount(VisibleType.Visible);

            // NavigateBarButton olayları / events

            navigateBarButton.OnNavigateBarButtonSelected += new NavigateBarButton.OnNavigateBarButtonSelectedEventHandler(NavigateBarButton_Selected);
            navigateBarButton.OnNavigateBarButtonDisplayChanged += new NavigateBarButton.OnNavigateBarButtonDisplayChangedEventHandler(NavigateBarButton_DisplayChanged);

            // trigger Event
            if (OnNavigateBarButtonAdded != null)
                OnNavigateBarButtonAdded(navigateBarButton);
        }