Example #1
0
        void SPTabView_MouseDown(object sender, MouseEventArgs e)
        {
            int pos = -scrollX;

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                foreach (SPTab tab in this.Views.Values)
                {
                    if (e.X >= pos && e.X <= pos + 120)
                    {
                        Navigate(tab.Title, tab.Uri);
                        break;
                    }
                    pos += 120;
                }
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
            {
                int i = 0;
                foreach (KeyValuePair <String, SPTab> tab in this.Views)
                {
                    if (e.X >= pos && e.X <= pos + 120)
                    {
                        if (tab.Value.Control is ISPComponent)
                        {
                            ISPComponent component = (ISPComponent)tab.Value.Control;
                            if (component.Close())
                            {
                                this.Views.Remove(tab.Key);
                                this.Controls.Remove(tab.Value.Control); // Remove view
                                if (i > 0)
                                {
                                    SPTab prevTab = this.Views.Values.ElementAt(i - 1);
                                    this.Navigate(prevTab.Title, prevTab.Uri);
                                }
                                else
                                {
                                    try
                                    {
                                        SPTab prevTab = this.Views.Values.ElementAt(i + 1);
                                        this.Navigate(prevTab.Title, prevTab.Uri);
                                    }
                                    catch (Exception ex)
                                    {
                                        this.Navigate("Home", new Uri("http://static.cobresia.webfactional.com/spotdev/index.html"));
                                    }
                                }
                                break;
                            }
                            i++;
                        }
                        break;
                    }
                    pos += 120;
                }
                this.Draw(CreateGraphics());
            }
        }
Example #2
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Control c = tabView.ActiveTab.Control;

            if (c is ISPComponent)
            {
                ISPComponent component = (ISPComponent)c;
                component.Save();
            }
        }
Example #3
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            /***
             * Check all open activities if there is something that needs to be saved and ask
             * */
            bool cancel = false;

            foreach (SPTab tab in tabView.Views.Values)
            {
                if (tab.Control is ISPComponent)
                {
                    ISPComponent component = ((ISPComponent)tab.Control);
                    if (!component.Close())
                    {
                        e.Cancel = true;
                        return;
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// Show a control
        /// </summary>
        /// <param name="control"></param>
        /// <param name="title"></param>
        /// <param name="uri"></param>
        public void ShowControl(Control control, String title, Uri uri)
        {
            String url = uri.ToString();

            contentPanel.Controls.Add(control);
            control.Dock = DockStyle.Fill;
            SPTab tab = new SPTab();

            tab.Control    = control;
            tab.Title      = title;
            tab.Uri        = uri;
            this.activeTab = tab;
            Views.Add(url, tab);
            control.BringToFront();
            if (control is ISPComponent)
            {
                ISPComponent comp = (ISPComponent)control;
                comp.Changed += new EventHandler(comp_Changed);
                comp.Saved   += new EventHandler(comp_Saved);
            }
        }