0

I am showing one MessageBox inside manipulationStarted event(or Tap Event ) of an image and that is causing App poor responsiveness when we perform store monitoring test in V2012.

Xaml Image control -

 <Image HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" 
        Width="104" Margin="90,60,0,0" Grid.Row="1"  
        ManipulationStarted="Image_ManipulationStarted_1" 
        Source="Background.png"/ >

Event Code –</p>

private void Image_ManipulationStarted_1(object sender, 
                                         ManipulationStartedEventArgs e)
{
    var m = MessageBox.Show("The file will be saved here.", "File Save", MessageBoxButton.OKCancel);

    if (m == MessageBoxResult.OK)
    {
        int temp = 10;
    }
}

When I perform "Automated tests" in open store test kit for above sample code, it is causing poor responsiveness and that cause to certification failure when we upload app the the market place. Here are the steps -

  1. Right click on Application Name in the solution explore in Visual Studio 2012

  2. Open store test kit -> Automated test -> Start Windows Phone Analysis -> Select App Analysis -> Click on Start Session (App will start)

  3. Application Will start running

  4. Perform the Tap event on the image, MessageBox will appear and click OK.

  5. Click on End Session (App Will Exit) in V2012.

  6. The result of App Analysis will be shown in Summary. In that summary you can see the Red Line in front of Responsiveness means the application responsiveness is poor which causes certification failure.

My requirement is like that only. I have one image (As a Button) and on click i.e Tap i want to do some operation.

Note – Build is targeted to WP7 but application is running on WP8 emulator.

Regards

Mukesh Sharma

4

1 回答 1

0

在事件处理程序中放置一个模态对话框将锁定调用线程,直到对话框被关闭。这可能会给出较差的响应评级。

您可能想要尝试的是在事件处理程序中禁用图像以进行操作并将 MessageBox 分派到事件处理程序返回后的某个时间,例如(未经测试的);

private void Image_ManipulationStarted_1(object sender, 
                                         ManipulationStartedEventArgs e)
{
    // <disable image manipulation here>
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {
        var m = MessageBox.Show("The file will be saved here.", 
                               "File Save", MessageBoxButton.OKCancel);

        if (m == MessageBoxResult.OK)
        {
            int temp = 10;
        }
        // <enable image manipulation again>
    }
}
于 2013-01-25T07:22:30.910 回答