Beispiel #1
0
        private void FindAndClickExistingTab()
        {
            var found = false;

            if (this.TabContainer.Items.Count > 1)
            {
                var indexForNewItem = 0;
                foreach (var item in this.TabContainer.Items)
                {
                    if (item is ToolStripButton)
                    {
                        var castedItem = (ToolStripButton)item;
                        if (castedItem.Name.StartsWith("Tab"))
                        {
                            castedItem.PerformClick();
                            found = true;
                            break;
                        }
                    }
                    indexForNewItem++;
                }
            }
            if (!found)
            {
                ExitToolStripMenuItem.PerformClick();
            }
        }
 private void ExitNotifyIcon_Click(object sender, EventArgs e)
 {
     ExitToolStripMenuItem.PerformClick();
 }