예제 #1
0
        private void _buttonCloseTab_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if ((button == null) || (button.Parent == null))
            {
                return;
            }

            Grid grid = button.Parent as Grid;

            if (grid == null)
            {
                return;
            }

            foreach (var item in grid.Children)
            {
                if (item is Label)
                {
                    ContentPresenter contentPresenter = (item as Label).Content as ContentPresenter;
                    if (contentPresenter != null)
                    {
                        CloseTabRequest?.Invoke(contentPresenter.Content, null);
                    }
                }
            }
        }
예제 #2
0
        public void OnBeforeClose(IWebBrowser browserControl, IBrowser browser)
        {
            Thread thread = new Thread(() => { CloseTabRequest?.Invoke(browser, EventArgs.Empty); });

            thread.Start();
        }