private void getFiles(String parameters) { try { //Get All Device Contacts Microsoft.Phone.Tasks.PhotoChooserTask task = new Microsoft.Phone.Tasks.PhotoChooserTask(); task.Completed += (sender, e) => { //serialize the contacts in json format string jsonPhoto = JsonConvert.SerializeObject(e.OriginalFileName); //call the callback executeCallback(jsonPhoto); }; //Search the phone for contacts task.Show(); } catch (Exception e) { e.ToString(); System.Diagnostics.Debugger.Break(); } }
private void SelectAndUploadFile() { #if SILVERLIGHT OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Pictures|*.jpeg;*.jpg;*.png"; bool?fileSelected = dialog.ShowDialog(); if (fileSelected.HasValue && fileSelected.Value) { // Load the file into the image control using (FileStream fileStream = dialog.File.OpenRead()) { BitmapImage image = new BitmapImage(); image.SetSource(fileStream); _imageControl.Source = image; fileStream.Close(); } // Now upload the file to the server immediately using (FileStream fileStream = dialog.File.OpenRead()) { UploadFile(fileStream); } } #elif WPF OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Pictures|*.jpeg;*.jpg;*.png"; bool?fileSelected = dialog.ShowDialog(); if (fileSelected.HasValue && fileSelected.Value) { // Load the file into the image control BitmapImage image = new BitmapImage(new Uri(dialog.FileName, UriKind.Absolute)); _imageControl.Source = image; //image. //using (FileStream fileStream = dialog.File.OpenRead()) //{ // BitmapImage image = new BitmapImage(); // image.SetSource(fileStream); // _imageControl.Source = image; // fileStream.Close(); //} // Now upload the file to the server immediately using (FileStream stream = new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { UploadFile(stream); } } #elif WINDOWS_PHONE var photoChooser = new Microsoft.Phone.Tasks.PhotoChooserTask(); photoChooser.ShowCamera = true; photoChooser.Completed += new EventHandler <Microsoft.Phone.Tasks.PhotoResult>(photoChooser_Completed); photoChooser.Show(); #endif }
private void changeOrSet_Click(object sender, RoutedEventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask phcht = new Microsoft.Phone.Tasks.PhotoChooserTask(); phcht.PixelHeight = 512; phcht.PixelWidth = 512; phcht.Show(); phcht.Completed += new EventHandler <Microsoft.Phone.Tasks.PhotoResult>(phcht_Completed); }
private void Button_Click_2(object sender, RoutedEventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask t = new Microsoft.Phone.Tasks.PhotoChooserTask(); t.Show(); t.Completed += t_Completed; }
private void SelectAndUploadFile() { #if SILVERLIGHT OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Pictures|*.jpeg;*.jpg;*.png"; bool? fileSelected = dialog.ShowDialog(); if (fileSelected.HasValue && fileSelected.Value) { // Load the file into the image control using (FileStream fileStream = dialog.File.OpenRead()) { BitmapImage image = new BitmapImage(); image.SetSource(fileStream); _imageControl.Source = image; fileStream.Close(); } // Now upload the file to the server immediately using (FileStream fileStream = dialog.File.OpenRead()) { UploadFile(fileStream); } } #elif WPF OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Pictures|*.jpeg;*.jpg;*.png"; bool? fileSelected = dialog.ShowDialog(); if (fileSelected.HasValue && fileSelected.Value) { // Load the file into the image control BitmapImage image = new BitmapImage(new Uri(dialog.FileName, UriKind.Absolute)); _imageControl.Source = image; //image. //using (FileStream fileStream = dialog.File.OpenRead()) //{ // BitmapImage image = new BitmapImage(); // image.SetSource(fileStream); // _imageControl.Source = image; // fileStream.Close(); //} // Now upload the file to the server immediately using (FileStream stream = new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { UploadFile(stream); } } #elif WINDOWS_PHONE var photoChooser = new Microsoft.Phone.Tasks.PhotoChooserTask(); photoChooser.ShowCamera = true; photoChooser.Completed += new EventHandler<Microsoft.Phone.Tasks.PhotoResult>(photoChooser_Completed); photoChooser.Show(); #endif }
/// <summary> /// Handles the Click event of the BrowserLib control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BrowserLib_Click(object sender, EventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask pct = new Microsoft.Phone.Tasks.PhotoChooserTask(); pct.Completed += new EventHandler<Microsoft.Phone.Tasks.PhotoResult>(pct_Completed); pct.Show(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask t = new Microsoft.Phone.Tasks.PhotoChooserTask(); t.PixelHeight = (int)ResolutionSize.Height; t.PixelWidth = (int)ResolutionSize.Width; t.ShowCamera = true; t.Completed += t_Completed; t.Show(); }
private async void SelectLockScreenImage(object sender, RoutedEventArgs e) { var isProvider = await Utility.RequestLockAccess(); UpdateLockScreenStatus(); Microsoft.Phone.Tasks.PhotoChooserTask picker = new Microsoft.Phone.Tasks.PhotoChooserTask(); picker.Completed += picker_Completed; picker.Show(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask t = new Microsoft.Phone.Tasks.PhotoChooserTask(); t.Show(); t.Completed += t_Completed; }
private void btnChoose_Click(object sender, RoutedEventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask t = new Microsoft.Phone.Tasks.PhotoChooserTask(); t.Completed += new EventHandler <Microsoft.Phone.Tasks.PhotoResult>(t_Completed); t.Show(); }
private void button1_Click(object sender, RoutedEventArgs e) { Microsoft.Phone.Tasks.PhotoChooserTask t = new Microsoft.Phone.Tasks.PhotoChooserTask(); t.Show(); t.Completed += new EventHandler<Microsoft.Phone.Tasks.PhotoResult>(t_Completed); }