private void DtwSaveToFile(object sender, RoutedEventArgs e)
{
Microsoft.Win32.SaveFileDialog saveDlg = new Microsoft.Win32.SaveFileDialog();
// Set filter for file extension and default file extension
saveDlg.DefaultExt = ".txt";
saveDlg.Filter = "Text documents (.txt)|*.txt";
saveDlg.InitialDirectory = GestureSaveFileLocation;
Nullable<bool> result = saveDlg.ShowDialog();
if (result == true)
{
//第一參數為儲存檔案的名稱,二為檔案內容
System.IO.File.WriteAllText(saveDlg.FileName,contents);
}
}
全站熱搜
留言列表