998503668c442135f9cb086cf641f8468bd295f2
[CSharpForFun/.git] / MonoDevelop / addins / MonoDevelop.HelloWorld / MonoDevelop.HelloWorld / Commands.cs
1 using System.Linq;
2 using MonoDevelop.Components.Commands;
3 using MonoDevelop.Ide;
4 using MonoDevelop.Projects;
5
6
7 namespace MonoDevelop.HelloWorld
8 {
9         public enum Commands
10         {
11                 ShowFiles,
12         }
13
14         public class ShowFilesCommandHandler : CommandHandler
15         {
16                 protected override void Run()
17                 {
18                         var proj = IdeApp.Workspace.GetAllProjects ().FirstOrDefault ();
19                         if (proj != null)
20                         {
21                                 var dlg = new ShowFilesDialog (proj);
22                                 MessageService.ShowCustomDialog (dlg);
23                         }
24                 }
25
26                 protected override void Update (CommandInfo info)
27                 {
28                         var proj = IdeApp.Workspace.GetAllProjects ().FirstOrDefault ();
29                         if (proj != null) {
30                                 info.Enabled = true;
31                                 info.Visible = true;
32                         } else {
33                                 info.Enabled = false;
34                                 info.Visible = true;
35                         }
36                 }
37         }
38 }
39