/// <summary>
        /// Context menu for closing of the map
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CloseMapTab(object sender, EventArgs e)
        {
            if (tabs.Items.Count <= 1) // at least 1 tabs for now
            {
                return;
            }
            if (MessageBox.Show("Are you sure you want to close this map?", "Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            System.Windows.Controls.MenuItem item = (System.Windows.Controls.MenuItem)sender;
            if (item == null)
            {
                return;
            }

            System.Windows.Controls.TabItem tabItem = (System.Windows.Controls.TabItem)item.Tag;
            TabItemContainer container     = (TabItemContainer)tabItem.Tag;
            Board            selectedBoard = container.Board;

            lock (selectedBoard.ParentControl)
            {
                tabs.SelectedItem = tabs.Items[0];
                tabs.Items.Remove(tabItem);

                selectedBoard.Dispose();
            }
        }
Exemplo n.º 2
0
        void tabs_PageRemoved(ThirdParty.TabPages.TabPage page)
        {
            Board board = (Board)page.Tag;

            board.Dispose();
        }