Example #1
0
        /// <summary>
        /// Handles event from WinPart when that
        /// WinPart is closing.
        /// </summary>
        private void CloseWinPart(object sender, EventArgs e)
        {
            WinPart part = (WinPart)sender;

            part.CloseWinPart -= new EventHandler(CloseWinPart);
            part.Visible       = false;
            Panel1.Controls.Remove(part);
            part.Dispose();
            PopulateDocuments();

            if (DocumentCount == 0)
            {
                this.DocumentsToolStripDropDownButton.Enabled = false;
                this.Text = "Project Tracker";
            }
            else
            {
                // Find the first WinPart control and set
                // the main form's Text property accordingly.
                // This works because the first WinPart
                // is the active one.
                foreach (Control ctl in Panel1.Controls)
                {
                    if (ctl is WinPart)
                    {
                        this.Text = "Project Tracker - " + ((WinPart)ctl).ToString();
                        break;
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Make the specified WinPart the
 /// active, displayed control.
 /// </summary>
 /// <param name="part">The WinPart control to display.</param>
 private void ShowWinPart(WinPart part)
 {
     part.Dock    = DockStyle.Fill;
     part.Visible = true;
     part.BringToFront();
     this.Text = "Project Tracker - " + part.ToString();
     PopulateDocuments();
 }
Example #3
0
 /// <summary>
 /// Add a new WinPart control to the
 /// list of available documents and
 /// make it the active WinPart.
 /// </summary>
 /// <param name="part">The WinPart control to add and display.</param>
 private void AddWinPart(WinPart part)
 {
     part.CloseWinPart += new EventHandler(CloseWinPart);
     part.BackColor     = toolStrip1.BackColor;
     Panel1.Controls.Add(part);
     this.DocumentsToolStripDropDownButton.Enabled = true;
     ShowWinPart(part);
 }
Example #4
0
        /// <summary>
        /// Make selected WinPart the active control.
        /// </summary>
        private void DocumentClick(object sender, EventArgs e)
        {
            WinPart ctl = (WinPart)((MenuItem)sender).Tag;

            ShowWinPart(ctl);
        }