/// </summary>
public partial class MainWindow : Window
{
+ System.Threading.CancellationTokenSource cancleTokenSrc = new System.Threading.CancellationTokenSource();
public MainWindow()
{
InitializeComponent();
void MainWindow_Closed(object sender, System.EventArgs e)
{
- this.fooTextBox.Document.Cancel();
+ this.cancleTokenSrc.Cancel();
}
void fooTextBox_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
bool result = (bool)ofd.ShowDialog(this);
if (result == true)
{
- await this.fooTextBox.Document.LoadAsync(ofd.FileName, Encoding.Default);
+ await this.fooTextBox.Document.LoadAsync(ofd.FileName, Encoding.Default,this.cancleTokenSrc);
this.fooTextBox.Refresh();
}
}
bool result = (bool)sfd.ShowDialog(this);
if (result == true)
{
- await this.fooTextBox.Document.SaveAsync(sfd.FileName,Encoding.Default,"\r\n");
+ await this.fooTextBox.Document.SaveAsync(sfd.FileName,Encoding.Default,"\r\n",cancleTokenSrc);
MessageBox.Show("complete");
}
}