OSDN Git Service

ドキュメントをクリアしたときにメモリーを開放するようにした
[fooeditengine/FooEditEngine.git] / WPF / Test / MainWindow.xaml.cs
index 468242b..98bf3b9 100644 (file)
@@ -124,7 +124,11 @@ namespace Test
             if (result == true)
             {
                 this.fooTextBox.IsEnabled = false;
-                await this.fooTextBox.LoadFileAsync(ofd.FileName, Encoding.Default,this.cancleTokenSrc);
+                System.IO.FileStream file = System.IO.File.Open(ofd.FileName,System.IO.FileMode.Open);
+                System.IO.StreamReader sr = new System.IO.StreamReader(file, Encoding.Default);
+                await this.fooTextBox.Document.LoadAsync(sr, this.cancleTokenSrc, (int)file.Length);
+                sr.Close();
+                file.Close();
                 this.fooTextBox.IsEnabled = true;
                 this.fooTextBox.Refresh();
             }