2013-01-25 28 views
0

我在圖像的manipulationStarted事件(或Tap Event)中顯示了一個MessageBox,導致App在我們執行V2012中的存儲監視測試時響應性較差。wp7中的應用程序響應不佳

的Xaml圖片控制 -

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

事件代碼 -

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; 
    } 
} 

當我執行在開放儲存測試試劑盒用於上面的示例代碼「自動測試」,它是導致響應性差而引起當我們上傳應用程序市場時認證失敗。以下是具體步驟 - 在解決方案上的應用程序名稱

  1. 右鍵單擊資源管理器在Visual Studio 2012

  2. 打開存儲測試套件 - >自動測試 - >啓動的Windows Phone分析 - >選擇應用分析 - >點擊開始會話(應用程序將啓動)

  3. 應用程序將開始運行

  4. 圖像上進行點擊事件,消息框就會出現,然後單擊確定。

  5. 單擊V2012中的結束會話(應用程序將退出)。

  6. 應用程序分析的結果將顯示在摘要中。在該摘要中,您可以看到響應能力前面的紅線意味着應用程序響應能力差,導致認證失敗。

我的要求是這樣的只有。我有一個圖像(作爲一個按鈕),點擊即點擊我想做一些操作。

注 - 構建針對WP7,但應用程序在WP8仿真器上運行。

問候

穆克什·夏爾馬

回答

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> 
    } 
} 
+0

我試過上述方法,但沒有奏效。請讓我知道我們如何手動禁用圖像處理,還有一個問題:劑量應用程序響應速度慢導致應用程序認證失敗,同時我們將應用程序上傳到市場。 –