//打开文件 public void Open() { OpenFileDialog odf = new OpenFileDialog(); odf.Filter = "csharp files (*.cs)|*.cs|All files (*.*)|*.*"; if (odf.ShowDialog().Value) { string fileName = odf.FileName; string content = File.ReadAllText(fileName, Encoding.UTF8); string documentTitle = System.IO.Path.GetFileName(fileName); var doc = this.newDocument(content, documentTitle, false); doc.Title = documentTitle; OpenDocuments.Add(doc); mv.AddDocument(doc); } }
public override async void OnLoad() { mv = this.View as IMainView; Formatter = mv.Formatter; ApplicationService.Services.Add <Editor.ObjectFormatter>(Formatter); string docTitle = "New Document.cs"; CurrentDocument = this.newDocument(null, docTitle); OpenDocuments.Add(CurrentDocument); mv.AddDocument(CurrentDocument); }