1

最近、wp7 用のアプリケーションを作成しました。これで、アプリの更新を送信する準備が整いました。私は UserControl ページ (ダイアログ ボックスを含む) を追加しました。MainPage.xaml またはアプリの起動時に表示したいのですが、最初のアプリの起動時のみです。初めて MessageBox を表示する方法は知っていますが、xaml ページを表示する方法がわかりません。

if (!IsolatedStorageSettings.ApplicationSettings.Contains("IsFourthLaunchDone"))
{
   MessageBox.Show("To Enable Full screen mode, go to settings and select Full Screen Browsing.");
   IsolatedStorageSettings.ApplicationSettings["IsFourthLaunchDone"] = true;
}

誰でもこれで私を助けることができますか? よろしくお願いします。

4

1 に答える 1

2

これが MessageBox で適切に行われる方法のアイデアを次に示します。アプリ.xaml.cs:

public static bool IsFourthLaunch = false;

ApplicationLaunching(){

if (!IsolatedStorageSettings.ApplicationSettings.Contains("IsFourthLaunchDone"))
{
     IsFourthLaunch = true;
}

}

MainPage.xaml.cs:

MainPage()
{
   if (App.isFourthLaunch)
    {
       Loaded += OnFourthLaunch;
    }
}

public void OnFourthLaunch(object sender, RoutedEventArgs e)
{
    Loaded -= OnFourthLaunch;
    if (App.IsFourthLaunch)
     {
       MessageBox.Show("To Enable Full screen mode, go to settings and select Full Screen Browsing.");
       IsolatedStorageSettings.ApplicationSettings["IsFourthLaunchDone"] = true;
       App.IsFourthLaunch = false;

     }

}

UserControl を使用してこれを行うには、最初は折りたたみ表示でコントロールをページに追加します。表示するシナリオで、可視性を Visible に変更します。コントロールをどのように動作させたいかを理解する必要があり、おそらく OnBackKeyPress をオーバーライドして、ユーザーがコントロールを閉じるための論理的な方法を提供する必要があります。

protected override void OnBackKeyPress( System.ComponentModel.CancelEventArgs e )
{    
   if (myControl.Visibility == Visibility.Visible)
   {
      e.Cancel = true;
      myControl.Visibility = Visibility.Collapsed;
      }        

}
于 2012-06-24T17:27:53.383 に答える