/// <summary>
        /// Remove button from collection
        /// </summary>
        void RemoveButton()
        {
            if (this.designerHost == null)
            {
                return;
            }

            if (!(this.Component is NavigateBar))
            {
                throw new Exception("Component is not NavigateBar or derived");
            }

            try
            {
                NavigateBar navigationPane = (NavigateBar)this.Component;


                if (navigationPane.NavigateBarButtons.Count <= 0)
                {
                    return;
                }

                // Get last button in collection

                NavigateBarButton nvButton = navigationPane.NavigateBarButtons[navigationPane.NavigateBarButtons.Count - 1];

                if (nvButton == null)
                {
                    return;
                }

                navigationPane.NavigateBarButtons.Remove(nvButton);

                if (navigationPane.NavigateBarDisplayedButtonCount > 0)
                {
                    navigationPane.NavigateBarDisplayedButtonCount--;
                    if (navigationPane.DisplayedButtonCount > navigationPane.NavigateBarDisplayedButtonCount)
                    {
                        navigationPane.DisplayedButtonCount = navigationPane.NavigateBarDisplayedButtonCount;
                    }
                }

                if (navigationPane.NavigateBarButtons.Count == 0)
                {
                    navigationPane.SetCaptionText(null);
                }

                navigationPane.PerformNavigationPane();       // Panelin görünümünü yenile

                this.designerHost.DestroyComponent(nvButton); // buttonu kaldır

                ReFreshUI();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "RemoveButton");
            }
        }
        /// <summary>
        /// Run mail button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRunMailButtonClick_Click(object sender, EventArgs e)
        {
            NavigateBarButton nvbMail = navigateBar.NavigateBarButtons.FindByKey("MAIL");

            if (nvbMail == null)
            {
                return;
            }

            nvbMail.PerformClick();
        }
        /// <summary>
        /// Change enabled state "Tasks" button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEnableDisableTasks_Click(object sender, EventArgs e)
        {
            NavigateBarButton nvb = navigateBar.NavigateBarButtons.FindByKey("TASKS");

            if (nvb != null)
            {
                nvb.Enabled = !nvb.Enabled;
            }

            // OR
            //nvbTasks.Enabled = !nvbTasks.Enabled;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Any button selected
        /// </summary>
        /// <param name="tNavigateBarButton"></param>
        void outlookNavigatePane_OnNavigateBarButtonSelected(NavigateBarButton tNavigateBarButton)
        {
            if (outlookNavigatePane == null || nbRemoteControl == null)
            {
                return;
            }
            nbRemoteControl.nudPosition.Value = outlookNavigatePane.NavigateBarButtons.IndexOf(tNavigateBarButton);

            if (outlookNavigatePane.SelectedButton != null)
            {
                this.Text = outlookNavigatePane.SelectedButton.Caption;
            }
        }
        /// <summary>
        /// Add a new button
        /// </summary>
        void AddButton()
        {
            if (this.designerHost == null)
            {
                return;
            }

            if (!(this.Component is NavigateBar))
            {
                throw new Exception("Component is not NavigateBar or derived");
            }

            try
            {
                NavigateBar navigationPane = (NavigateBar)this.Component;

                // Yeni button
                NavigateBarButton nvButton = (NavigateBarButton)this.designerHost.CreateComponent(typeof(NavigateBarButton));

                if (nvButton == null)
                {
                    System.Windows.Forms.MessageBox.Show("Component is null");
                    return;
                }
                nvButton.Caption = nvButton.Name;
                navigationPane.NavigateBarButtons.Add(nvButton);

                navigationPane.NavigateBarDisplayedButtonCount = navigationPane.NavigateBarButtons.Count;

                navigationPane.PerformNavigationPane(); // Panelin görünümünü yenile

                ReFreshUI();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "AddButton");
            }
        }
        /// <summary>
        /// Eğer bir button yada panel kaldırıldıysa
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void componentChnSvc_ComponentRemoving(object sender, ComponentEventArgs e)
        {
            try
            {
                if (e.Component is NavigateBarButton)
                {
                    // eğer bir button kaldırıldıysa

                    NavigateBarButton nvButton = e.Component as NavigateBarButton;

                    if (!nvButton.Name.Equals(lastSelectedControlName))
                    {
                        return;
                    }

                    NavigateBar navigationPane = (NavigateBar)this.Control;


                    if (navigationPane.NavigateBarButtons.Contains(nvButton))
                    {
                        this.componentChnSvc.OnComponentChanging(this.Component, null);
                        navigationPane.NavigateBarButtons.Remove(nvButton);

                        if (navigationPane.NavigateBarDisplayedButtonCount > 0)
                        {
                            navigationPane.NavigateBarDisplayedButtonCount--;
                            if (navigationPane.DisplayedButtonCount > navigationPane.NavigateBarDisplayedButtonCount)
                            {
                                navigationPane.DisplayedButtonCount = navigationPane.NavigateBarDisplayedButtonCount;
                            }
                        }

                        if (navigationPane.NavigateBarButtons.Count == 0)
                        {
                            navigationPane.SetCaptionText(null);
                        }

                        navigationPane.PerformNavigationPane();

                        this.componentChnSvc.OnComponentChanged(this.Component, null, null, null);
                        return;
                    }
                }
                else if (e.Component is NavigateBar)
                {
                    // eğer navigation pane kaldırıldıysa panele baglı buttonlarıda kaldır

                    NavigateBar navigationPane = (NavigateBar)this.Component;

                    if (!navigationPane.Name.Equals(lastSelectedControlName))
                    {
                        return;
                    }

                    for (int i = navigationPane.NavigateBarButtons.Count - 1; i >= 0; i--)
                    {
                        NavigateBarButton nvButton = navigationPane.NavigateBarButtons[i];
                        this.componentChnSvc.OnComponentChanging(this.Component, null);

                        navigationPane.NavigateBarButtons.Remove(nvButton);

                        if (navigationPane.NavigateBarButtons.Count == 0)
                        {
                            navigationPane.SetCaptionText(null);
                        }

                        navigationPane.PerformNavigationPane();

                        this.designerHost.DestroyComponent(nvButton);

                        this.componentChnSvc.OnComponentChanged(this.Component, null, null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "ComponentRemoving");
            }
        }
Exemplo n.º 7
0
            private void InitializeNavBar()
            {
                AppNavigation.CollapsibleScreenWidth = 150;
                AppNavigation.Dock = DockStyle.Fill;
                nvbFilterView = new NavigateBarButton();
                nvbFilterView.RelatedControl = FilterView;
                nvbFilterView.Caption = "Report Filters";
                nvbFilterView.ToolTipText = "Report Filter Options";
                nvbFilterView.Image = global::My.Resources.Clock;
                nvbFilterView.Enabled = true;
                nvbFilterView.Key = "FILTERVIEW";

                nvbGroupingView = new NavigateBarButton();
                nvbGroupingView.RelatedControl = null;
                nvbGroupingView.Caption = "Report Grouping";
                nvbGroupingView.ToolTipText = "Report Grouping Options";
                nvbGroupingView.Image = global::My.Resources.Clock;
                nvbGroupingView.Enabled = true;
                nvbGroupingView.Key = "GROUPINGVIEW";

                AppNavigation.NavigateBarButtons.Clear();
                AppNavigation.NavigateBarButtons.Add(nvbFilterView);
                AppNavigation.NavigateBarButtons.Add(nvbGroupingView);

                AppNavigation.NavigateBarDisplayedButtonCount = 2;
                AppNavigation.Theme = NavigateBarTheme.VS2005Color;
            }
Exemplo n.º 8
0
        public void InitNavigateBar()
        {
            // For automatically save (Save %APPDATA%<exe filename> folder )
            //outlookNavigatePane = new NavigateBar();
            //outlookNavigatePane.SaveAndRestoreSettings = true;

            // For custom save
            outlookNavigatePane      = new NavigateBar(Environment.CurrentDirectory + @"\NavigateBarSettings.xml");
            outlookNavigatePane.Dock = DockStyle.Left;
            outlookNavigatePane.IsShowCollapsibleScreen = true;
            outlookNavigatePane.CollapsedScreenWidth    = 150; // For all buttons // Optional
            outlookNavigatePane.CollapsibleWidth        = 32;
            outlookNavigatePane.OnNavigateBarDisplayedButtonCountChanged += new NavigateBar.OnNavigateBarDisplayedButtonCountChangedEventHandler(NavigationPane_OnNavigateBarDisplayedButtonCountChanged);
            outlookNavigatePane.OnNavigateBarButtonSelected  += new NavigateBar.OnNavigateBarButtonEventHandler(outlookNavigatePane_OnNavigateBarButtonSelected);
            outlookNavigatePane.OnNavigateBarButtonSelecting += new NavigateBar.OnNavigateBarButtonSelectingEventHandler(outlookNavigatePane_OnNavigateBarButtonSelecting);

            outlookNavigatePane.OnNavigateBarColorChanged += new EventHandler(outlookNavigatePane_OnNavigateBarColorChanged);
            outlookNavigatePane.HandleCreated             += new EventHandler(outlookNavigatePane_HandleCreated);
            outlookNavigatePane.RightToLeftChanged        += new EventHandler(outlookNavigatePane_RightToLeftChanged);
            outlookNavigatePane.Width = 150;

            #region Optional features
            //outlookNavigatePane.RelatedControl = new MailTree(); // If Button.RelatedControl is empty then display this control
            //outlookNavigatePane.NavigateBarDisplayedButtonCount = 5; // Max display 5 button in panel
            //outlookNavigatePane.AlwaysUseSystemColors = true;
            #endregion

            #region NavigateBar Buttons

            nvbMail = new NavigateBarButton();
            nvbMail.RelatedControl     = new MailTree();
            nvbMail.Caption            = "Mail";
            nvbMail.CaptionDescription = "Mail Folders";
            nvbMail.Image                        = Properties.Resources.Mail24;
            nvbMail.Enabled                      = true;
            nvbMail.Key                          = "MAIL";
            nvbMail.IsShowCaptionImage           = false;
            nvbMail.OnNavigateBarButtonSelected += new NavigateBarButton.OnNavigateBarButtonSelectedEventHandler(nvbMail_OnNavigateBarButtonSelected);

            Calendar clndr = new Calendar();
            clndr.BackColor                      = Color.Red;
            nvbCalendar                          = new NavigateBarButton(clndr);
            nvbCalendar.Caption                  = "Calendar";
            nvbCalendar.IsShowCaption            = true;
            nvbCalendar.IsShowCaptionDescription = false;
            nvbCalendar.Image                    = Properties.Resources.Calendar24;
            //nvbCalendar.Font = new Font("Tahoma", 12, FontStyle.Italic | FontStyle.Bold);
            nvbCalendar.ForeColor                   = Color.Red; // move on ColorTable
            nvbCalendar.Key                         = "CALENDAR";
            nvbCalendar.IsShowCaptionImage          = false;
            nvbCalendar.CollapsedScreenWidth        = 195;
            nvbCalendar.IsShowCollapseScreenCaption = false; // Hide collapse screen caption band

            DataGridView dgv = new DataGridView();

            nvbContacts                          = new NavigateBarButton();
            nvbContacts.Caption                  = "Contacts";
            nvbContacts.CaptionDescription       = "My Friends";
            nvbContacts.Image                    = Properties.Resources.Contacts24;
            nvbContacts.RelatedControl           = dgv;
            nvbContacts.IsShowCaption            = false;
            nvbContacts.IsShowCaptionDescription = true;
            nvbContacts.Key                      = "CONTACTS";
            nvbContacts.IsAlwaysDisplayed        = true; // Always show in panel
            nvbContacts.CollapsedScreenWidth     = 240;  // For Contacts button

            nvbTasks                    = new NavigateBarButton(new RichTextBox());
            nvbTasks.Caption            = "Tasks";
            nvbTasks.CaptionDescription = "My Tasks";
            nvbTasks.Image              = Properties.Resources.Tasks24;
            nvbTasks.MouseOverImage     = Properties.Resources.Contacts24;
            nvbTasks.SelectedImage      = Properties.Resources.Mail24;
            nvbTasks.ToolTipText        = "ToolTipText for tasks";
            //nvbTasks.Enabled = false;
            nvbTasks.IsShowCaption            = false;
            nvbTasks.IsShowCaptionDescription = false;
            nvbTasks.Key = "TASKS";

            nvbNotes     = new NavigateBarButton("Notes", Properties.Resources.Notes24);
            nvbNotes.Key = "NOTES";

            nvbFolderList     = new NavigateBarButton("Folder List", Properties.Resources.FolderList24);
            nvbFolderList.Key = "FOLDERLIST";

            nvbShortCuts     = new NavigateBarButton("Shortcuts", Properties.Resources.Shortcut24);
            nvbShortCuts.Key = "SHORTCUT";

            nvbDiary     = new NavigateBarButton("Diary", Properties.Resources.Diary24);
            nvbDiary.Key = "DIARY";

            outlookNavigatePane.NavigateBarButtons.AddRange(new NavigateBarButton[] { nvbMail, nvbCalendar, nvbContacts });
            outlookNavigatePane.NavigateBarButtons.Add(nvbTasks);
            outlookNavigatePane.NavigateBarButtons.Add(nvbNotes);
            outlookNavigatePane.NavigateBarButtons.Add(nvbFolderList);
            outlookNavigatePane.NavigateBarButtons.Add(nvbShortCuts);
            outlookNavigatePane.NavigateBarButtons.Add(nvbDiary);
            #endregion

            #region Strips

            // ToolStrip
            toolStrip            = new ToolStrip();
            toolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode;

            tbtnMDIChildForm        = new ToolStripButton();
            tbtnMDIChildForm.Text   = "MDI Child";
            tbtnMDIChildForm.Click += new EventHandler(tbtnMDIChildForm_Click);

            tbtnAbout        = new ToolStripButton();
            tbtnAbout.Text   = "About";
            tbtnAbout.Click += delegate(object sender, EventArgs e)
            {
                Type typ = typeof(TestMainForm);

                object[] r = typ.Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                AssemblyCopyrightAttribute ct = (AssemblyCopyrightAttribute)r[0];

                object[] d = typ.Assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
                AssemblyDescriptionAttribute dt = (AssemblyDescriptionAttribute)d[0];

                object[] v = typ.Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
                AssemblyFileVersionAttribute vt = (AssemblyFileVersionAttribute)v[0];

                MessageBox.Show(ct.Copyright + "\n\n" + dt.Description + "\n\n" + "Version : " + vt.Version);
            };


            tbtnExit        = new ToolStripButton();
            tbtnExit.Text   = "Exit";
            tbtnExit.Click += delegate(object sender, EventArgs e)
            {
                this.Close();
            };

            toolStrip.Items.Add(tbtnMDIChildForm);
            toolStrip.Items.Add(new ToolStripSeparator());
            toolStrip.Items.Add(tbtnAbout);
            toolStrip.Items.Add(tbtnExit);


            // MenuStrip

            menuStrip            = new MenuStrip();
            menuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode;
            menuStrip.Dock       = DockStyle.Top;
            MainMenuStrip        = menuStrip;

            // StatusStrip

            statusStrip            = new StatusStrip();
            statusStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode;

            #endregion

            // Splitter

            splitterNavigateMenu      = new MTSplitter();
            splitterNavigateMenu.Size = new Size(7, 100);
            splitterNavigateMenu.SplitterPointCount = 10;
            splitterNavigateMenu.SplitterPaintAngle = 360F;

            splitterNavigateMenu.Dock = DockStyle.Left;

            // Navigatebar Remote Control

            nbRemoteControl      = new NavigateBarRemoteControl(outlookNavigatePane);
            nbRemoteControl.Dock = DockStyle.Fill;

            containerControlProp       = new ContainerControl();
            containerControlProp.Width = nbRemoteControl.Width;

            containerControlProp.Controls.Add(nbRemoteControl);
            containerControlProp.Dock = DockStyle.Right;


            Controls.AddRange(new Control[] { splitterNavigateMenu, outlookNavigatePane, containerControlProp, toolStrip, statusStrip, menuStrip });
        }
Exemplo n.º 9
0
 private void navigateBar_OnNavigateBarButtonSelected(NavigateBarButton tNavigateBarButton)
 {
     CurrentCategoryChanged(tNavigateBarButton.Caption);
 }