blob: 024330116d996aa3520f1794a10d1c285db3d3e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
using System.IO;
using System.Reflection;
using Crow;
namespace Samples {
public static class Extensions {
public static CommandGroup GetCommands (this DirectoryInfo di) =>
new CommandGroup(
new ActionCommand ("Set as root", ()=> {SampleBaseForEditor.CurrentProgramInstance.CurrentDir = di.FullName;})/*,
new ActionCommand ("New Directory", (sender0) => {
Directory.CreateDirectory (Path.Combine (di.FullName, "new directory"));
Widget listContainer = ((sender0 as Widget).LogicalParent as Widget).DataSource as Widget;
})*/
);
public static CommandGroup GetCommands (this FileInfo fi) =>
new CommandGroup(
new ActionCommand ("Delete", (sender0) => {
MessageBox.ShowModal (SampleBaseForEditor.CurrentProgramInstance, MessageBox.Type.YesNo, $"Delete {fi.Name}?").Yes += (sender, e) => {
File.Delete(fi.FullName);
Widget listContainer = ((sender0 as Widget).LogicalParent as Widget).DataSource as Widget;
(listContainer.Parent as Group).RemoveChild(listContainer);
};
})
);
public static Picture GetIcon (this MemberInfo mi)
=> mi is EventInfo ? new BmpPicture("#Icons.event.png") : new BmpPicture("#Icons.property.png");
}
}
|