私のWPF MVVMアプリケーションでは、インストール後にアプリケーションが最初に実行されるかどうかを確認する必要があります。私はここに彼の言葉を引用Properties.Settings.Default.UpgradeRequiredプロパティを読み書きするにはどうすればよいですか?
// this must happen as soon as your program starts, before
// you do anything else with the settings
if (Properties.Settings.Default.UpgradeRequired)
{
// upgrade FIRST, before doing anything else with the settings
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpgradeRequired = false;
Properties.Settings.Default.Save();
}
:UpgradeRequired 『「私も追加することをお勧め』 how to check whether my c# window app is running first time after installation私は著者がUpgradeRequiredの使用をお勧めします次のコードを発見した - 私はSOでのいくつかの例を検討していたし、そのうちの一つにデフォルト設定ではtrueです。 "しかし、OnStartUpイベントハンドラのApp.xaml.csファイルに同じコードを追加しようとすると、次のエラーが発生しました。" 設定に定義が含まれていませんUpgradeRequired "であり、UpgradeRequiredには赤い波線で下線が引かれています。私は前にProperties.Settingsに直面していない。だから私は知っている:私は自分のアプリケーションに追加する必要があるアセンブリリファレンス? Properties.Settings.Default.UpgradeRequiredにアクセスするにはどうすればよいですか?私たちの助けが大いに評価されるでしょう。
ありがとう、MotKohn。 – Prohor
うまくいけば答えを受け入れてください。 – MotKohn