public MainWindow() { InitializeComponent(); SidePaneWidth = 480; Browser.NavigateToString("<html><head><style>img{position: absolute; top: 50%; left: 50%; width: 400px; height: 140px; margin-top: -65.5px; margin-left: -200px;}</style></head><body><img src=\"https://www.google.co.in/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png\"></body></html>"); LeftArrow.Text = ""; RightArrow.Text = ""; Browser.Visibility = System.Windows.Visibility.Visible; ResizeMode = System.Windows.ResizeMode.NoResize; dynamic activeX = Browser.GetType().InvokeMember("ActiveXInstance", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, Browser, new object[] { }); activeX.Silent = true; SearchResultCard defaultcard = new SearchResultCard() { Title = "Nothing Here", Link = "Start your new search now.\nType in you query in the\ntext box at the top", MouseOverBrush = new SolidColorBrush(Color.FromArgb(10, 0, 0, 0)), TitleForeground = new SolidColorBrush(Colors.Gray), LinkForeground = new SolidColorBrush(Color.FromArgb(255, 74, 49, 211)), Width = SidePaneWidth - 28, Margin = new Thickness(2, 0, 2, 0), Name = "DefaultCard" }; defaultcard.MouseDoubleClick += defaultcard_MouseDoubleClick; ResultPaneStack.Children.Add(defaultcard); Settings.Opacity = 0.0; }
public void LoadFullPage() { ResultPaneStack.Children.Clear(); for (int i = 0; i < gsrm.ResultCount; i++) { SearchResultCard card = new SearchResultCard() { Title = HtmlRemoval.StripTagsRegexCompiled(gsrm.SearchResults[i]), Link = gsrm.SearchResultsLinks[i], MouseOverBrush = new SolidColorBrush(Color.FromArgb(10, 0, 0, 0)), TitleForeground = new SolidColorBrush(Colors.Gray), LinkForeground = new SolidColorBrush(Color.FromArgb(255, 74, 49, 211)), Width = SidePaneWidth - 28, Margin = new Thickness(2, 0, 2, 0) }; Tag = i; card.MouseDoubleClick += card_MouseDoubleClick; ResultPaneStack.Children.Add(card); } LeftArrow.Text = left; RightArrow.Text = right; SearchBox.Text = HtmlRemoval.StripTagsRegexCompiled(gsrm.SearchResults[0]); UpdateStatus(gsrm.SearchResultsLinks[0]); Browser.Navigate(gsrm.SearchResultsLinks[0]); Progress.IsIndeterminate = true; }
void card_MouseDoubleClick(object sender, MouseButtonEventArgs e) { SearchResultCard card = (SearchResultCard)sender; CurrentLink = (int)Tag; Browser.Navigate((string)card.Link); Progress.IsIndeterminate = true; SearchBox.Text = ((string)card.Title); UpdateStatus(gsrm.SearchResultsLinks[CurrentLink]); }