//evolucionBrowserDataContext context = new evolucionBrowserDataContext(ConnectionString); protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string texto = ""; string texto1 = ""; if (NavigationContext.QueryString.TryGetValue("name", out texto)) this.name = texto; if (NavigationContext.QueryString.TryGetValue("uri", out texto1)) this.uri = texto1; //--------------------------------------------------------------------------------------------------------- using (evolucionBrowserDataContext context = new evolucionBrowserDataContext(ConnectionString)) { if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(uri)){ Favorite fav = new Favorite { Name = name, Uri = uri }; context.Favorites.InsertOnSubmit(fav); context.SubmitChanges(); } // Define query to fetch all customers in database. var favv = from Favorite todo in context.Favorites select todo; // Execute query and place results into a collection. aux = new ObservableCollection<Favorite>(favv); listBox.ItemsSource = aux.ToList(); } }
private void ApplicationBarIconButton_Click(object sender, EventArgs e) { MessageBoxResult result = MessageBox.Show("Are you sure you want to delete the history","Warning", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { using (evolucionBrowserDataContext context = new evolucionBrowserDataContext(ConnectionString)) { var a = from x in context.Histories select x; context.Histories.DeleteAllOnSubmit(a); context.SubmitChanges(); listBox1.ItemsSource = null; } } }
private void image1_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MessageBoxResult result = MessageBox.Show("Are you sure you want to delete the element?", "Warning", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { using (evolucionBrowserDataContext context = new evolucionBrowserDataContext(ConnectionString)) { var aux = (from Favorite x in context.Favorites where x.Id == Int32.Parse(((Image)sender).Tag.ToString()) select x).Single(); context.Favorites.DeleteOnSubmit(aux); context.SubmitChanges(); // NavigationService.Navigate(new Uri("/favorite.xaml",UriKind.Relative)); } reloadList(); } }
private void webBrowser4_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { _navigationStack4.Push(e.Uri); if (webBrowser4.Source != null && webBrowser4.Source != new Uri("/app.html", UriKind.Relative) && webBrowser4.Source != new Uri("/source.html", UriKind.Relative) && webBrowser4.Source != new Uri("about:blank", UriKind.Absolute)) textBox4.Text = webBrowser4.Source.ToString(); saveAllinBrowser(); ProgBar4.Visibility = Visibility.Collapsed; setImageBackgroundButton(button4, "Images/reload.jpg"); button4.Click += new RoutedEventHandler(button4_Click); string tit = ""; try { tit = (string)webBrowser4.InvokeScript("eval", "document.title.toString()"); } catch { } if (pivot1.SelectedIndex == 3 ) { using (evolucionBrowserDataContext context = new evolucionBrowserDataContext(ConnectionString)) { History aux = new History { Name = tit, Uri = (textBox4.Text.Length > 1000) ? textBox4.Text.Substring(0, 999) : textBox4.Text }; context.Histories.InsertOnSubmit(aux); context.SubmitChanges(); } } }