11/19/2023
创建
|
{
ShortcutKeys = Keys.Control | Keys.O;
SmallImage = ImageResource.folder_page;
}
/// <summary>Execute the command.</summary>
public override void Execute()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
openFileDialog.Filter = Settings.DefaultFileFilter;
openFileDialog.CheckFileExists = true;
if (openFileDialog.ShowDialog(HostWindow.Instance) == DialogResult.OK)
{
// todo: check for file exist file in open windows;
IFileEditorResolver resolver = Services.Resolve<IFileEditorResolver>();
var fileName = openFileDialog.FileName;
IEditor editor = resolver.ResolveEditorInstance(fileName);
editor.FileName = fileName;
editor.LoadFile();
HostWindow.DisplayDockedForm(editor as DockContent);
Services.Resolve<IMostRecentFilesService>().Register(fileName);
}
}
}
}
|