コメント |
@DIV
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 S130510_LBOX_StoreBlank
{
//クラス
public sealed partial class MainPage : Page
{
// ファイルが存在するかどうかを示すフラグ
private bool bExist = false;
//コンストラクタ
public MainPage()
{
this.InitializeComponent();
Debug.WriteLine("MainPage のコンストラクタが実行されました");
}
// *************************************************
// ページのロード
// *************************************************
private async void Page_Loaded(object sender, RoutedEventArgs e)
{
Debug.WriteLine("ページがロードされました");
// 対象フォルダ( マニフェストで使用宣言が必要 )
// ※ 対象ファイルの存在チェック
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
try
{
StorageFile strageFile = await storageFolder.GetFileAsync("text.txt");
bExist = true;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
if (bExist)
{
Debug.WriteLine("対象ファイルは存在します");
}
else
{
Debug.WriteLine("対象ファイルは存在しません");
}
// XAML で使用不可にしているので、保存ボタンを使用可能にします
SaveButton.IsEnabled = true;
}
// *************************************************
// このページがフレームに表示されるときに呼び出されます。
// *************************************************
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)
{
}
// *************************************************
//削除ボタン
// *************************************************
private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
}
// *************************************************
//お気に入りボタン
// *************************************************
private void FavoriteButton_Click(object sender, RoutedEventArgs e)
{
}
// *************************************************
//保存ボタン
// *************************************************
private void SaveButton_Click(object sender, RoutedEventArgs e)
{
MsgBox.ShowAsync(this, "OK", "Cancel", "データを保存しますか?", this.CommandInvokedHandler);
}
// *************************************************
//メールボタン
// *************************************************
private void MailButton_Click(object sender, RoutedEventArgs e)
{
}
}
}
@END
|