private void onTabOpenExternalLink(object sender, OpenLinkEventArgs e)
        {
            TabView tab = createTab();

            tab.loadUrl(e.url);
            tabControl.SelectedItem = tab.getTab();
        }
        private void btnForward_Click(object sender, RoutedEventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                selectedTab.goToHistoryOffset(1);
            }
        }
        private void print_Click(object sender, RoutedEventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                selectedTab.print();
            }
        }
        private void onTabURLUpdated(object sender, EventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                txtAddress.Text = selectedTab.getURL();
            }
        }
        private void onTabTitleUpdated(object sender, EventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                this.Title = "Tabbed Browser Sample - Awesomium - " + selectedTab.getTitle();
            }
        }
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                selectedTab.reload();
            }
        }
        private void btnHome_Click(object sender, RoutedEventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                selectedTab.loadURL("http://www.google.com");
            }
        }
        private void btnZoomOut_Click(object sender, RoutedEventArgs e)
        {
            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                selectedTab.zoomOut();
            }
        }
        private TabView CreateTab()
        {
            TabView tab = new TabView(tabControl);
            tab.OnUpdateTitle += onTabTitleUpdated;
            tab.OnUpdateURL += onTabURLUpdated;
            tab.OnOpenExternalLink += onTabOpenExternalLink;
            tabViewList.Add(tab);
            tabControl.SelectedItem = tab.getTab();

            return tab;
        }
        private TabView createTab()
        {
            TabView tab = new TabView(tabControl);

            tab.OnUpdateTitle      += onTabTitleUpdated;
            tab.OnUpdateURL        += onTabURLUpdated;
            tab.OnOpenExternalLink += onTabOpenExternalLink;
            tabViewList.Add(tab);
            tabControl.SelectedItem = tab.getTab();

            return(tab);
        }
 private void removeTab_Click(object sender, RoutedEventArgs e)
 {
     if (tabControl.Items.Count > 1)
     {
         TabView selectedTab = getSelectedTab();
         if (selectedTab != null)
         {
             tabViewList.Remove(selectedTab);
             tabControl.Items.Remove(tabControl.SelectedItem);
         }
     }
 }
        private TabView getSelectedTab()
        {
            TabView result = null;

            foreach (TabView i in tabViewList)
            {
                if (i.getTab() == tabControl.SelectedItem)
                {
                    result = i;
                    break;
                }
            }

            return(result);
        }
        IntPtr HandleMessages(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            int message = (msg & 65535);

            if ((message == WM_KEYDOWN || message == WM_KEYUP || message == WM_CHAR) && !txtAddress.IsFocused)
            {
                TabView selectedTab = getSelectedTab();
                if (selectedTab != null)
                {
                    selectedTab.handleKeyboardEvent((int)msg, (int)wParam, (int)lParam);
                    handled = true;
                }
            }

            return(IntPtr.Zero);
        }
        private void btnGo_Click(object sender, RoutedEventArgs e)
        {
            btnGo.IsDefault = false;

            TabView selectedTab = getSelectedTab();

            if (selectedTab != null)
            {
                if (txtAddress.Text.StartsWith("http://") == true)
                {
                    selectedTab.loadUrl(txtAddress.Text);
                }
                else if (txtAddress.Text != "")
                {
                    selectedTab.loadUrl("http://" + txtAddress.Text);
                }
            }
        }
        private void browserWindow_Loaded(object sender, RoutedEventArgs e)
        {
            TabView tab = createTab();

            tab.loadUrl("http://www.google.com");
        }