ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文

  メンテナンス 前画面に戻る

対象スレッド 件名: Class1.cs
名前: lightbox
処理選択
パスワード

件名 Class1.cs
名前 lightbox
コメント
@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.ComponentModel;
using System.Diagnostics;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace PhoneApp7
{
	public class Class1 : INotifyPropertyChanged
	{

		// チェックボックス用プロパティ
		// ※ TwoWay でセットされる様子をチェックする為にコードを記述しています
		private bool _CheckBoxSetting;
		public bool CheckBoxSetting {
			get {
				return _CheckBoxSetting;
			}
			set {
				_CheckBoxSetting = value;
				Debug.WriteLine("CheckBoxSetting にデータがセットされました" + value);
			} 
		}

		public Class1()
		{
			WebClient webClient = new WebClient();

			webClient.DownloadStringCompleted += 
				new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
			// 外部サービスから文字列を取得
			// {"CheckBoxSetting": true, "ListBoxSetting": 2}
			webClient.DownloadStringAsync(new System.Uri("http://textt.net/sworc/20120929111044.txt"));
		}

		protected virtual void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
		{
			if (e.Error != null)
			{
				Deployment.Current.Dispatcher.BeginInvoke(() =>
				{
					Debug.WriteLine(e.Error.Message);
				});
			}
			else
			{
				Debug.WriteLine("オーバーライド元を実行");

			}
		}

		public event PropertyChangedEventHandler PropertyChanged;
		public void NotifyPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this,
					new PropertyChangedEventArgs(propertyName));
			}
		}
	}

}
@END