私はクラスの IList を持っていますが、それらを IsolatedStorage に格納しようとすると、組み込みのセラライザーはそれを処理できず、JSON.net も処理できないと表示されます。以下にクラスを配置しましたが、それを保存する方法を考えられる人はいますか?
私が得るエラーは次のとおりです。
型 'System.Windows.UIElement' をシリアル化できません。これを DataContractAttribute 属性でマークし、シリアル化するすべてのメンバーを DataMemberAttribute 属性でマークすることを検討してください。
IList<ScoreWatcher> RecentSessions = new List<ScoreWatcher>();
public class ScoreWatcher
{
public ScoreWatcher() { }
public string SessionName = "";
public DateTime SessionCreationTime;
public DateTime SessionModificationTime;
public int Player1Total = 0;
public int Player1ScoreRollover = 0;
public int Player2Total = 0;
public int Player2ScoreRollover = 0;
public string Player1Name = "";
public string Player2Name = "";
public ListBox scoreListBox;
public string GrabFriendlyGLobal()
{
UpdateModificationTime();
return string.Format("{0}-{1}", Player1Total, Player2Total);
}
public void UpdateModificationTime()
{
SessionModificationTime = DateTime.Now;
}
public void UpdateScoringSystem()
{
UpdateModificationTime();
Player1Total = 0;
Player1ScoreRollover = 0;
Player2Total = 0;
Player2ScoreRollover = 0;
foreach (Match snookerMatch in matches)
{
if (snookerMatch.Player1Score > snookerMatch.Player2Score)
Player1Total++;
else if (snookerMatch.Player1Score == snookerMatch.Player2Score)
{
Player1Total++;
Player2Total++;
}
else
Player2Total++;
// House cleaning
Player1ScoreRollover += snookerMatch.Player1Score;
Player2ScoreRollover += snookerMatch.Player2Score;
}
}
public void LoadMatchesIntoListbox()
{
UpdateModificationTime();
scoreListBox.Items.Clear();
foreach (Match snookerMatch in matches)
scoreListBox.Items.Add(new UserControls.GameHistoryTile(snookerMatch.GlobalScore, snookerMatch.Player1Score, snookerMatch.Player2Score));
}
public List<Match> matches = new List<Match>();
public class Match
{
public int Player1Score = 0;
public int Player2Score = 0;
public string GlobalScore = "0-0";
}
}