private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var lisbox = sender as ListBox; var picure = lisbox.SelectedItem as Picture; var account = "*****@*****.**"; var password = "******"; GooglePicasaService service = new GooglePicasaService(); service.Login(account, password, (authResult) => { WebClient client = new WebClient(); client.Headers["Authorization"] = String.Format("GoogleLogin auth={0}", authResult); client.Headers["Content-Type"] = "image/jpeg"; client.Headers["Slug"] = picure.Name; Stream picStream = picure.GetImage(); UploadFile(client, picStream, account); }); }