コメント |
@DIV
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Diagnostics;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace PhoneApp7
{
public class Class2 : Class1
{
public int ListBoxSetting { get; set; }
public string[] ListBoxContent { get; set; }
public bool RadioButton1Setting { get; set; }
public bool RadioButton2Setting { get; set; }
public bool RadioButton3Setting { get; set; }
public Class2()
{
// 3つ入る場所を確保(中は null)
ListBoxContent = new string[3];
}
protected override void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
// オーバーライド元を実行
base.webClient_DownloadStringCompleted(sender, e);
if (e.Error != null)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Debug.WriteLine(e.Error.Message);
});
}
else
{
// デシリアライズ
JsonData jsonObject = JsonConvert.DeserializeObject<JsonData>(e.Result);
// プロパティにセット
this.CheckBoxSetting = jsonObject.CheckBoxSetting;
this.ListBoxSetting = jsonObject.ListBoxSetting;
this.ListBoxContent[0] = jsonObject.ListBoxContent[0];
this.ListBoxContent[1] = jsonObject.ListBoxContent[1];
this.ListBoxContent[2] = jsonObject.ListBoxContent[2];
this.RadioButton1Setting = jsonObject.RadioButton1Setting;
this.RadioButton2Setting = jsonObject.RadioButton2Setting;
this.RadioButton3Setting = jsonObject.RadioButton3Setting;
// 全てセットした事を通知
NotifyPropertyChanged(String.Empty);
}
}
}
}
@END |