Example #1
0
        public async void OfflineAddToJSON(string rand)
        {
            StorageFile sampleFile = await localFolder.GetFileAsync("OfflinePages.json");

            var JSONData = await Windows.Storage.FileIO.ReadTextAsync(sampleFile);

            OfflineClass OfflineListJSON = JsonConvert.DeserializeObject <OfflineClass>(JSONData);
            Uri          ArgsUri         = new Uri(WebWeb.Source.ToString());
            string       host            = ArgsUri.Host;
            string       x;

            x = await WebWeb.InvokeScriptAsync("eval", new string[] { "document.title;" });

            OfflineListJSON.OfflineWebsites.Add(new OfflineJSON()
            {
                FavIconJSON  = " https://icons.duckduckgo.com/ip2/" + host + ".ico",
                ImageUrlJSON = rand + ".jpg",
                HeaderJSON   = x
            });;
            var SerializedObject = JsonConvert.SerializeObject(OfflineListJSON, Formatting.Indented);
            await Windows.Storage.FileIO.WriteTextAsync(sampleFile, SerializedObject);

            var JSONDatas = await FileIO.ReadTextAsync(sampleFile);

            LoadOffline();
        }
Example #2
0
        private void StackPanel_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var            SenderFramework = (FrameworkElement)sender;
            var            DataContext     = SenderFramework.DataContext;
            FavouritesJSON SenderPost      = DataContext as FavouritesJSON;

            WebWeb.Navigate(new Uri(SenderPost.UrlJSON));
        }
Example #3
0
        private async void AddFav(object sender, RoutedEventArgs e)
        {
            if (BoolWeb == true)
            {
                StorageFile sampleFile = await localFolder.GetFileAsync("Favorites.json");

                var JSONData = await Windows.Storage.FileIO.ReadTextAsync(sampleFile);

                FavouritesClass FavouritesListJSON = JsonConvert.DeserializeObject <FavouritesClass>(JSONData);
                Uri             ArgsUri            = new Uri(WebWeb.Source.ToString());
                string          host = ArgsUri.Host;
                string          x    = "";
                try
                {
                    x = await WebWeb.InvokeScriptAsync("eval", new string[] { "document.title;" });
                }
                catch
                {
                    x = WebWeb.Source.ToString();
                }
                FavouritesListJSON.Websites.Add(new FavouritesJSON()
                {
                    FavIconJSON = " https://icons.duckduckgo.com/ip2/" + host + ".ico",
                    UrlJSON     = WebWeb.Source.ToString(),
                    HeaderJSON  = x
                });;
                var SerializedObject = JsonConvert.SerializeObject(FavouritesListJSON, Formatting.Indented);
                await Windows.Storage.FileIO.WriteTextAsync(sampleFile, SerializedObject);

                var JSONDatas = await FileIO.ReadTextAsync(sampleFile);

                LoadFav();
            }
            else
            {
                return;
            }
        }
Example #4
0
        private void Favorites_ItemClick(object sender, ItemClickEventArgs e)
        {
            FavouritesJSON SenderPost = e.ClickedItem as FavouritesJSON;

            WebWeb.Navigate(new Uri(SenderPost.UrlJSON));
        }