質問するのは些細なことに聞こえるかもしれませんが、私は記事で提案されているのと同じことをしていますが、期待どおりには機能しません。誰かが私を正しい方向に向けてくれることを願っています。
AppSettings ごとにユーザー設定を保存したいと思います。
Winform が閉じられたら、これをトリガーします。
conf.Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (ConfigurationManager.AppSettings["IntegrateWithPerforce"] != null)
ConfigurationManager.AppSettings["IntegrateWithPerforce"] =
e.Payload.IntegrateCheckBox.ToString();
else
config.AppSettings.Settings.Add("IntegrateWithPerforce",
e.Payload.IntegrateCheckBox.ToString());
config.Save(ConfigurationSaveMode.Modified);
そのため、エントリがまだ存在しない場合は、単純に作成されます。それ以外の場合は、既存のエントリが変更されます。ただし、これは保存されません。
1) 私は何を間違っていますか?
2) アプリ設定のユーザー設定が再び保存される場所はどこですか? Debug フォルダにありますか、それとも C:\Documents and Settings\USERNAME\Local Settings\Application Data フォルダにありますか?