aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/common/src/Extensions.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-06-07 15:05:30 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-06-07 15:05:30 +0200
commit263de03914a3de5d55c4508c322e32d36caf2a87 (patch)
treec279464365fd7683744fa59d01b242e4b3ab17b9 /Samples/common/src/Extensions.cs
parentf738cf0f78c57750cce8fd5744825b0591f24bb8 (diff)
suggestion in IML editor, editor base classe for ShowCase and LogAnalyzerSimplifiedTabView
Diffstat (limited to 'Samples/common/src/Extensions.cs')
-rw-r--r--Samples/common/src/Extensions.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Samples/common/src/Extensions.cs b/Samples/common/src/Extensions.cs
new file mode 100644
index 00000000..b4b0a1e5
--- /dev/null
+++ b/Samples/common/src/Extensions.cs
@@ -0,0 +1,27 @@
+
+
+using System.Reflection;
+using Crow;
+
+namespace Samples {
+ public static class Extensions {
+
+ public static CommandGroup GetCommands (this System.IO.DirectoryInfo di) =>
+ new CommandGroup(
+ new Command ("Set as root", ()=> {SampleBaseForEditor.CurrentProgramInstance.CurrentDir = di.FullName;})
+ );
+ public static CommandGroup GetCommands (this System.IO.FileInfo fi) =>
+ new CommandGroup(
+ new Command ("Delete", (sender0) => {
+ MessageBox.ShowModal (SampleBaseForEditor.CurrentProgramInstance, MessageBox.Type.YesNo, $"Delete {fi.Name}?").Yes += (sender, e) => {
+ System.IO.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");
+
+ }
+} \ No newline at end of file