ソース掲示板




すべてから検索

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

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

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

件名 MainPage.xaml.cs
名前 lightbox
コメント
@DIV
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

//名前空間
namespace LBOX_ListBox
{
	//クラス
	public sealed partial class MainPage : Page
	{
		// ファイルが存在するかどうかを示すフラグ
		private bool bExist = false;


		// *************************************************
		//コンストラクタ
		// *************************************************
		public MainPage()
		{
			this.InitializeComponent();
			Debug.WriteLine("MainPage のコンストラクタが実行されました");

			App.mainPage = this;

			// メインリストボックスにバインド用のメインクラスを設定
			App.listMain = new ListMain();
			this.ListMenu.DataContext = App.listMain;

			// メインリストボックスのデータを追加
			App.listMain.Items.Add(new ListItem2() { id = "Windows Store", name = "Windows8 C# 用テンプレート" });
			App.listMain.Items.Add(new ListItem2() { id = "Windows Phone", name = "Windows Phone C# 用テンプレート" });
			App.listMain.Items.Add(new ListItem2() { id = "Android", name = "ADT 用 テンプレート" });

			// サブリストボックスにバインド用のメインクラスを設定
			App.listChild = new ListMain();
			this.ListMenu_Child.DataContext = App.listChild;

		}

		// *************************************************
		// ページのロード
		// *************************************************
		private async void Page_Loaded(object sender, RoutedEventArgs e)
		{
			Debug.WriteLine("ページがロードされました");

			Package package = Package.Current;
			StorageFolder storageFolder = package.InstalledLocation;
			String output = String.Format("Installed Location: {0}", storageFolder.Path);
			Debug.WriteLine(output);

			// 対象フォルダ( マニフェストで使用宣言が必要 )
			// ※ 対象ファイルの存在チェック
			// StorageFolder storageFolder = KnownFolders.DocumentsLibrary;

			bExist = false;
			try
			{
				StorageFile strageFile = await storageFolder.GetFileAsync("Windows Store.txt");
				bExist = true;
			}
			catch (Exception ex)
			{
				Debug.WriteLine(ex.Message);
			}

			if (bExist)
			{
				Debug.WriteLine("Windows Store.txt は存在します");
			}
			else
			{
				Debug.WriteLine("Windows Store.txt は存在しません");
			}

		}

		// *************************************************
		// このページがフレームに表示されるときに呼び出されます。
		// *************************************************
		protected override void OnNavigatedTo(NavigationEventArgs e)
		{
			Debug.WriteLine("ページがフレームに表示されました");

			// Navigate が実行された時のパラメータを表示しています
			var mp = (App.MyParam)e.Parameter;
			Debug.WriteLine("Title : " + mp.title);
			Debug.WriteLine("Type : " + mp.type);
		}

		// *************************************************
		//設定ボタン
		// *************************************************
		private void SettingButton_Click(object sender, RoutedEventArgs e)
		{
			// 選択されているインデックス
			int idx = this.ListMenu.SelectedIndex;
			App.listMain.Items[idx].name = this.UpdateField.Text;
			//App.listMain.Items[idx].NotifyPropertyChanged("name");

		}

		// *************************************************
		//削除ボタン 
		// *************************************************
		private void DeleteButton_Click(object sender, RoutedEventArgs e)
		{

		}

		// *************************************************
		//お気に入りボタン
		// *************************************************
		private void FavoriteButton_Click(object sender, RoutedEventArgs e)
		{

		}

		// *************************************************
		//保存ボタン
		// *************************************************
		private void SaveButton_Click(object sender, RoutedEventArgs e)
		{

		}

		// *************************************************
		//メールボタン
		// *************************************************
		private void MailButton_Click(object sender, RoutedEventArgs e)
		{

		}

	}
}
@END