简体   繁体   中英

Windows Phone Mango choosers

I have a problem with using the various choosers. When I launch one of them at the moment it should return to my application all I get is a "resuming" screen with the progressbar animated indefinetely. Pressing back or the start button does nothing and after a while it gets to the home screen. And the launch of the app again is sluggish.

choosers problematic

This happens on the emulator as well as on the mobile itself.

An example of my class that uses a chooser that fails to come back is:

public partial class Add : PhoneApplicationPage
    {
        GameInviteTask gameInviteTask;

        public Add()
        {
            InitializeComponent();
            gameInviteTask = new GameInviteTask();
            gameInviteTask.Completed += new EventHandler<TaskEventArgs>(gameInviteTask_Completed);
        }

        private void TextBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                gameInviteTask.SessionId = "<my session id>";
                gameInviteTask.Show();
            }
            catch (System.InvalidOperationException ex)
            {
                MessageBox.Show("An error occurred when choosing an email contact.");
            }
        }

        void gameInviteTask_Completed(object sender, TaskEventArgs e)
        {
            switch (e.TaskResult)
            {
                //Game logic for when the invite was sent successfully
                case TaskResult.OK:
                    MessageBox.Show("Game invitation sent.");
                    break;

                //Game logic for when the invite is cancelled by the user
                case TaskResult.Cancel:
                    MessageBox.Show("Game invitation cancelled.");
                    break;

                // Game logic for when the invite could not be sent
                case TaskResult.None:
                    MessageBox.Show("Game invitation could not be sent.");
                    break;
            }
        }

    } 

This happens with all choosers. I uses the main page to navigate to this one using the navigation service.

What could be the problem?!

I have found the problem...

unfortunately the only thing I did not try when trying everything was to remove IsReadOnly from the textbox that runs the Tap event.

So this is a Microsoft bug :/

Windows phone 7.1: Choosers do not work when you run them from a Tap event of a textbox that has the IsReadOnly True.

I'll leave it here so it might help others.

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