aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/DebugLogAnalyzer/src/Extensions.cs
blob: 6086384c5d2a1b8314490122e6e50e7f1b53c10f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using Crow;

namespace DebugLogAnalyzer {
	public static class Extensions {

		public static CommandGroup GetCommands (this System.IO.DirectoryInfo di) =>
			new CommandGroup(
				new Command ("Set as root", ()=> {Program.CurrentProgramInstance.CurrentDir = di.FullName;}));		
		public static CommandGroup GetCommands (this System.IO.FileInfo fi) =>
			new CommandGroup(
				new Command ("Delete", (sender0) => {
					MessageBox.ShowModal (Program.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);
					};
				})
			);		

	}
}