Example #1
0
        void naviBar_ActiveBandChanged(object sender, NaviBandEventArgs e)
        {
            log.Info(e.NewActiveBand.Tag.ToString());

            string      title = rm.GetString("FirstPage");
            DockContent frm   = this.FindDocument(title);

            if (frm == null)
            {
                FirstForm firstform = new FirstForm(this.dockpanel);
                firstform.DockTitle            = title;
                firstform.Functioncatalogindex = e.NewActiveBand.Tag.ToString();
                firstform.Functionlist         = this.functionalllist;
                firstform.ShowContentAtFirst(false);
                firstform.SetPanelVisible();
            }
            else
            {
                frm.Show(this.dockpanel);
                frm.BringToFront();
                FirstForm firstform = ((FirstForm)((BaseForm)(frm.Pane.Contents[0])).dockPanel.Panes[1].Contents[0]);
                firstform.Functioncatalogindex = e.NewActiveBand.Tag.ToString();
                firstform.Functionlist         = this.functionalllist;
                firstform.SetPanelVisible();
            }
        }
        /// <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);
            }
        }