Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9010865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:34:38+00:00 2026-06-16T02:34:38+00:00

I want to return a photo using PhotoChooserTask like this: private void getimage_Click(object sender,

  • 0

I want to return a photo using PhotoChooserTask like this:

 private void getimage_Click(object sender, EventArgs e)
     {
         photoChooserTask = new PhotoChooserTask();
         photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);

         try
         {
             photoChooserTask.Show();
         }
         catch (System.InvalidOperationException ex)
         {
             MessageBox.Show("An error occurred.");
         }

     }
     void photoChooserTask_Completed(object sender, PhotoResult ee)
     {
         if (ee.TaskResult == TaskResult.OK)
         {

             BitmapImage bmp = new BitmapImage();
             bmp.SetSource(ee.ChosenPhoto);

             if (ee.TaskResult == TaskResult.OK && ee.Error == null)
             {

                     WriteableBitmap wb = new WriteableBitmap(bmp);

                     notes.Add(new chatinfo() { sendimage = bmp });
                     noteListBox.ItemsSource = null;
                     noteListBox.ItemsSource = notes;
             }
           }

       }

but everytime the program arrived here:”bmp.SetSource(ee.ChosenPhoto);” A SocketException will be called.

private void OnRecieveFrom()
     {
         var receiveArgs = new SocketAsyncEventArgs();
         receiveArgs.RemoteEndPoint = this.IPEndPoint;
         receiveArgs.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
         var strBdr = new StringBuilder();
         receiveArgs.Completed += (__, result) =>
         {

             string message = CreateMessage(result);

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     this.RaiseReceived(message);

                 });
                 socket.ReceiveFromAsync(receiveArgs);    



         };

             socket.ReceiveFromAsync(receiveArgs);


     }

The SocketException is called by ” socket.ReceiveFromAsync(receiveArgs);”
I just want to get a photo from the phone,and there is not send or recieve operation.I don’t know why receive function was called.

Would the app lose the socket communication when it jumps to the photo album (the value “RemoteEndPoint” of socket change to null)? p.s. “socket” is an object of class “Socket”.
If so, should I recreate the “socket” every time the app jumps out?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:34:39+00:00Added an answer on June 16, 2026 at 2:34 am

    Once the PhotoChooserTask is called your app will be Fast App Switched (or maybe even Tombstoned).

    Either way your socket will be closed. You’ll have to reopen your socket when your app is Activated again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to return a private field from a remoted object but i get
I want to read an image from a this URL photo and I'm using
I want to return a simple json result, something like: { 12323: true }
I want to return some files in a HttpResponse and I'm using the following
I want to add images from photo library or by using camera to my
I would like to know how to lookup contact photo URI using the lookup
I want to display this image and upload it to a server. I'm using
I am using a file upload in my Django model like this : def
I want to return a specific message on error of an ajax request. [WebMethod]
I want to return a set of values from function till the point they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.