示例#1
0
        private async void DeleteFavButton_Click(object sender, RoutedEventArgs e)
        {
            StorageFile sampleFile = await localFolder.GetFileAsync("QuickPinWeb.json");

            var            SenderFramework = (FrameworkElement)sender;
            var            DataContext     = SenderFramework.DataContext;
            FavouritesJSON SenderPost      = DataContext as FavouritesJSON;
            var            JSONData        = await Windows.Storage.FileIO.ReadTextAsync(sampleFile);

            FavouritesClass FavouritesListJSON = JsonConvert.DeserializeObject <FavouritesClass>(JSONData);
            FavouritesJSON  FoundItem          = FavouritesListJSON.Websites.Find(x => x.UrlJSON == SenderPost.UrlJSON);

            FavouritesListJSON.Websites.Remove(FoundItem);
            var SerializedObject = JsonConvert.SerializeObject(FavouritesListJSON, Formatting.Indented);
            await Windows.Storage.FileIO.WriteTextAsync(sampleFile, SerializedObject);

            var JSONDatas = await FileIO.ReadTextAsync(sampleFile);

            FavouritesClass FavouritesListsJSON = JsonConvert.DeserializeObject <FavouritesClass>(JSONDatas);

            FavouritesListQuick.Clear();
            foreach (var item in FavouritesListsJSON.Websites)
            {
                FavouritesListQuick.Add(new FavouritesJSON()
                {
                    HeaderJSON  = item.HeaderJSON,
                    UrlJSON     = item.UrlJSON,
                    FavIconJSON = item.FavIconJSON,
                });
            }
            QuickPinnedGridView.ItemsSource = null;
            UnloadObject(QuickPinnedGridView);
            FindName("QuickPinnedGridView");
            QuickPinnedGridView.ItemsSource = FavouritesListQuick;
        }
示例#2
0
        private void QGrid_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var            SenderFramework = (FrameworkElement)sender;
            var            DataContext     = SenderFramework.DataContext;
            FavouritesJSON SenderPost      = DataContext as FavouritesJSON;

            webViewControl.Navigate(new Uri(SenderPost.UrlJSON));
        }
示例#3
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));
        }
示例#4
0
        private async void DeleteFav(object sender, RoutedEventArgs e)
        {
            StorageFile sampleFile = await localFolder.GetFileAsync("Favorites.json");

            var            SenderFramework = (FrameworkElement)sender;
            var            DataContext     = SenderFramework.DataContext;
            FavouritesJSON SenderPost      = DataContext as FavouritesJSON;
            //  List<Favourites> OpenList = Favorites.ItemsSource as List<Favourites>;
            //  OpenList.Remove(SenderPost);
            var JSONData = await Windows.Storage.FileIO.ReadTextAsync(sampleFile);

            FavouritesClass FavouritesListJSON = JsonConvert.DeserializeObject <FavouritesClass>(JSONData);
            //i had a better way to do it before but accidently permanently deleted it and cant remember how. This method is shorter and simpler
            FavouritesJSON FoundItem = FavouritesListJSON.Websites.Find(x => x.UrlJSON == SenderPost.UrlJSON);

            FavouritesListJSON.Websites.Remove(FoundItem);
            var SerializedObject = JsonConvert.SerializeObject(FavouritesListJSON, Formatting.Indented);
            await Windows.Storage.FileIO.WriteTextAsync(sampleFile, SerializedObject);

            var JSONDatas = await FileIO.ReadTextAsync(sampleFile);

            LoadFav();
        }
示例#5
0
        private void QuickPinnedGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            FavouritesJSON SenderPost = e.ClickedItem as FavouritesJSON;

            webViewControl.Navigate(new Uri(SenderPost.UrlJSON));
        }
示例#6
0
        private void Favorites_ItemClick(object sender, ItemClickEventArgs e)
        {
            FavouritesJSON SenderPost = e.ClickedItem as FavouritesJSON;

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