Esempio n. 1
0
        private void mnuShow_Click(object sender, EventArgs e)
        {
            List <Connection> selectedConnections = this.GetSelectedConnections();

            foreach (Connection connection in selectedConnections)
            {
                StoreManagerForm form = Program.MainForm.GetStoreManagerForm(connection);
                if (form == null)
                {
                    continue;
                }
                form.Show();
                form.Focus();
            }
        }
Esempio n. 2
0
        public void ShowStoreManagerForm(Connection connection)
        {
            try
            {
                StoreManagerForm storeManagerForm = new StoreManagerForm(connection);
                CrossThreadSetMdiParent(storeManagerForm, this);
                CrossThreadShow(storeManagerForm);

                // Update Quick Jump Bar
                ToolStripButton quickJumpButton = new ToolStripButton(connection.Name);
                connection.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args)
                {
                    if (args.PropertyName.Equals("Name"))
                    {
                        CrossThreadSetText(quickJumpButton, connection.Name);
                    }
                    if (args.PropertyName.Equals("IsOpen") && !connection.IsOpen)
                    {
                        this.quickJumpBar.Items.Remove(quickJumpButton);
                        if (this.quickJumpBar.Items.Count == 1)
                        {
                            this.quickJumpBar.Visible = false;
                        }
                    }
                };
                quickJumpButton.Click += delegate(object sender, EventArgs args)
                {
                    StoreManagerForm form = this.GetStoreManagerForm(connection);
                    if (form == null)
                    {
                        return;
                    }
                    form.Show();
                    form.Focus();
                };
                quickJumpBar.Items.Add(quickJumpButton);
                this.quickJumpBar.Visible = true;

                this.AddRecentConnection(connection);
            }
            catch (Exception ex)
            {
                Program.HandleInternalError("Unable to display a Store Manager form for the connection " + connection.Name, ex);
            }
        }