Exemplo n.º 1
0
        private void bookmarkList_ItemClick(object sender, ItemClickEventArgs e)
        {
            BookmarkItem b = (BookmarkItem)e.ClickedItem;

            if (b.PageUrl == null)
            {
                this.Frame.Navigate(typeof(MainPage));
            }
            else
            {
                this.Frame.Navigate(typeof(MainPage), b.PageUrl.AbsoluteUri);
            }
        }
        private async void AppBarButtonBookmarks_Click(object sender, RoutedEventArgs e)
        {
            InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream();

            await CurrentWebView().CapturePreviewToStreamAsync(ms);

            //Create a small thumbnail
            int    longlength = 180, width = 0, height = 0;
            double srcwidth = CurrentWebView().ActualWidth, srcheight = CurrentWebView().ActualHeight;
            double factor = srcwidth / srcheight;

            if (factor < 1)
            {
                height = longlength;
                width  = (int)(longlength * factor);
            }
            else
            {
                width  = longlength;
                height = (int)(longlength / factor);
            }
            BitmapSource small = await resize(width, height, ms);

            BookmarkItem item = new BookmarkItem();

            item.Title = CurrentWebView().DocumentTitle;

            try
            {
                item.PageUrl = new Uri(TextBoxUrl.Text);
            }
            catch
            {
            }
            //item.PageUrl = CurrentWebView().Source;

            item.Preview = small;

            bookmarks.Add(item);
        }
        private async void AppBarButtonBookmarks_Click(object sender, RoutedEventArgs e)
        {
            InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream();
            await CurrentWebView().CapturePreviewToStreamAsync(ms);

            //Create a small thumbnail
            int longlength = 180, width = 0, height = 0;
            double srcwidth = CurrentWebView().ActualWidth, srcheight = CurrentWebView().ActualHeight;
            double factor = srcwidth / srcheight;
            if (factor < 1)
            {
                height = longlength;
                width = (int)(longlength * factor);
            }
            else
            {
                width = longlength;
                height = (int)(longlength / factor);
            }
            BitmapSource small = await resize(width, height, ms);

            BookmarkItem item = new BookmarkItem();
            item.Title = CurrentWebView().DocumentTitle;

            try
            {
                item.PageUrl = new Uri(TextBoxUrl.Text);
            }
            catch
            {

            }
            //item.PageUrl = CurrentWebView().Source;
            
            item.Preview = small;

            bookmarks.Add(item);
        }