Пример #1
0
 private async void TextUrl_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (sender.Text.StartsWith("https://") == true)
     {
         Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrlBool"] = Option2RadioButton.IsChecked;
         Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrl"]     = args.QueryText;
         FindName("WebViewHome");
         WebViewHome.Navigate(new Uri(args.QueryText));
         Home.Visibility = Visibility.Collapsed;
     }
     else
     {
         int duration = 3000;
         try {
             TabViewPage.InAppNotificationMain.Show("Not a valid url", duration);
         }
         catch
         {
             IncognitoTabView.InAppNotificationMain.Show("Not a valid url", duration);
         }
     }
 }
Пример #2
0
        private void Home_Loaded(object sender, RoutedEventArgs e)
        {
            if (isfirst == true)
            {
                isfirst        = false;
                HomeGrid       = FavouritesGridView;
                webViewControl = WebViewControl;
                try
                {
                    tICO.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"] == true)
                    {
                        icon.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        icon.Visibility = Visibility.Collapsed;
                    }
                    TfAV.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"] == true)
                    {
                        FavouritesGridView.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        FavouritesGridView.Visibility = Visibility.Collapsed;
                    }
                    TqUI.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"] == true)
                    {
                        QuickPinnedGrid.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        QuickPinnedGrid.Visibility = Visibility.Collapsed;
                    }
                    TmOR.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"] == true)
                    {
                        loadcontentmore.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        loadcontentmore.Visibility = Visibility.Collapsed;
                    }
                    TSea.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"] == true)
                    {
                        SearchBox.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        SearchBox.Visibility = Visibility.Collapsed;
                    }
                }
                catch
                {
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"]   = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"]    = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"] = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"]    = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"]   = true;
                    tICO.IsOn = (bool)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"];
                    QuickPinnedGrid.Visibility    = Visibility.Visible;
                    loadcontentmore.Visibility    = Visibility.Visible;
                    FavouritesGridView.Visibility = Visibility.Visible;
                    icon.Visibility      = Visibility.Visible;
                    TfAV.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"];
                    TqUI.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"];
                    TmOR.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"];
                    TSea.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"];
                    SearchBox.Visibility = Visibility.Visible;
                }

                try
                {
                    if ((bool)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrlBool"] == true)
                    {
                        FindName("WebViewHome");
                        WebViewHome.Navigate(new Uri((string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrl"]));
                        Option2RadioButton.IsChecked = true;
                        UnloadObject(Home);
                    }
                    else
                    {
                        Option1RadioButton.IsChecked = true;
                        UnloadObject(WebViewHome);
                        LoadFavorites();
                        LoadQuickPinned();
                    }
                }
                catch
                {
                    Option1RadioButton.IsChecked = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrlBool"] = false;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrl"]     = "";
                    LoadFavorites();
                    LoadQuickPinned();
                    UnloadObject(WebViewHome);
                }
                try
                {
                    if ((bool)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundBool"] == true)
                    {
                        f = true;
                        Imageoption.IsChecked      = true;
                        BackGroundimage.Visibility = Visibility.Visible;
                        BitmapImage bitmapImage = new BitmapImage();                                            // dimension, so long as one dimension measurement is provided
                        bitmapImage.UriSource  = new Uri((string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundPath"]);
                        BackGroundimage.Source = bitmapImage;
                        f = false;
                    }
                    else
                    {
                        DefaultacrylicOption.IsChecked = true;
                        BackGroundimage.Visibility     = Visibility.Collapsed;
                        DefaultacrylicOption.IsChecked = true;
                    }
                }
                catch
                {
                    DefaultacrylicOption.IsChecked = true;
                    BackGroundimage.Visibility     = Visibility.Collapsed;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundBool"] = false;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundPath"] = "";
                }
            }
        }