简体   繁体   English

Windows Phone芒果选择器

[英]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. 不幸的是,我尝试一切时没有尝试过的唯一一件事就是从运行Tap事件的文本框中删除IsReadOnly。

So this is a Microsoft bug :/ 所以这是一个微软的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. Windows Phone 7.1: 当您从具有IsReadOnly True的文本框的Tap事件中运行选择器时,选择器不起作用。

I'll leave it here so it might help others. 我会留在这里,这样可以帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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