2016年2月17日水曜日

ファイルを指定する(FileOpenPicker)

ボタンハンドラで FileOpenPicker を使用してファイルを指定する。


  private async void OpenFile_Click(object sender, RoutedEventArgs e)
  {
   FileOpenPicker openPicker = new FileOpenPicker();

   // 表示モードはリスト形式
   openPicker.ViewMode = PickerViewMode.List;
   // デフォルトフォルダ
   //openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
   // 拡張子
   openPicker.FileTypeFilter.Add("*");


   // ファイルオープンピッカーを起動する
   StorageFile file = await openPicker.PickSingleFileAsync();
   if (file != null) {
    // ファイル処理
   }
  }

2016年2月11日木曜日

デバッグ時に表示されている左上のカウンタを消す

ここに表示されているのはフレームレートとCPU使用量。
これは、デフォルトで App クラスの OnLaunched メンバの最初で表示されるように設定されている。

if (System.Diagnostics.Debugger.IsAttached)
{
    this.DebugSettings.EnableFrameRateCounter = true;
}
これを false にするか、コメントアウトすればよい。