provide a way to open embedded files with the default editor now that we're Accessor-agnostic
This commit is contained in:
parent
de3279201f
commit
3d1c95aca3
@ -43,6 +43,7 @@ namespace UniversalEditor.Editors.FileSystem
|
||||
this.tv.SelectionMode = SelectionMode.Multiple;
|
||||
this.tv.Model = this.tmTreeView;
|
||||
|
||||
Context.AttachCommandEventHandler("FileSystemContextMenu_Open", FileSystemContextMenu_Open_Click);
|
||||
Context.AttachCommandEventHandler("FileSystemContextMenu_Add_ExistingItem", FileAddExistingItem_Click);
|
||||
Context.AttachCommandEventHandler("FileSystemContextMenu_Add_ExistingFolder", FileAddExistingFolder_Click);
|
||||
Context.AttachCommandEventHandler("FileSystemContextMenu_Add_FilesFromFolder", FileAddItemsFromFolder_Click);
|
||||
|
||||
@ -29,6 +29,7 @@ using MBS.Framework.UserInterface.DragDrop;
|
||||
using MBS.Framework.UserInterface.Input.Keyboard;
|
||||
using MBS.Framework.UserInterface.Input.Mouse;
|
||||
using UniversalEditor.Editors.FileSystem.Dialogs;
|
||||
using UniversalEditor.Accessors;
|
||||
|
||||
namespace UniversalEditor.Editors.FileSystem
|
||||
{
|
||||
@ -168,6 +169,25 @@ namespace UniversalEditor.Editors.FileSystem
|
||||
return f;
|
||||
}
|
||||
|
||||
private void FileSystemContextMenu_Open_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (tv.SelectedRows.Count < 1)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < tv.SelectedRows.Count; i++)
|
||||
{
|
||||
IFileSystemObject fso = tv.SelectedRows[i].GetExtraData<IFileSystemObject>("item");
|
||||
if (fso is File)
|
||||
{
|
||||
File f = (fso as File);
|
||||
|
||||
MemoryAccessor ma = new MemoryAccessor(f.GetData(), f.Name);
|
||||
Document doc = new Document(ma);
|
||||
HostApplication.CurrentWindow.OpenFile(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new folder in the current directory of the currently-loaded <see cref="FileSystemObjectModel"/>.
|
||||
/// </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user