简体   繁体   中英

Download images using web browser control

In my web browser app for windows phone 7, am able to just see the images, but i want to download images from the web pages(using context menu) and save it to media library. My web browser control is named as browsers . Can anyone help me? Thanks in advance for your help? There are errors in the below codes- In "uri" and in "e" .

private void MenuItem_Click(object sender, RoutedEventArgs e)
    {
        HttpWebRequest WebRequest = HttpWebRequest.CreateHttp(uri);>>>Error in "uri"
        WebRequest.BeginGetResponse((asyncCallback) =>
        {
            try
            {
                MediaLibrary library = new MediaLibrary();
                library.SavePicture(imageName, WebRequest.EndGetResponse(asyncCallback).GetResponseStream());
            }
            catch (Exception e)>>>>>Error in "e"
            {}
        }, WebRequest); 
    }

public string imageName { get; set; }

在浏览器控件中按住Tab键并按住该图像...您是否获得了用于保存图像的上下文菜单?

HttpWebRequest WebRequest = HttpWebRequest.CreateHttp(uri);
WebRequest.BeginGetResponse((asyncCallback) =>
{
    try
    {            
        MediaLibrary library = new MediaLibrary();
        library.SavePicture(imageName, WebRequest.EndGetResponse(asyncCallback).GetResponseStream());
    }
    catch (Exception e) { }
}, WebRequest);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM