@@ -4,26 +4,29 @@ public static class PredefinedCodes
44{
55 public static string Windows11ContextMenuInitializer =
66""""
7- ContextMenuItem menu = new ContextMenuItem
7+ if (RuntimeHelper.IsPackaged())
88{
9- Title = "Open $projectname$ Here",
10- Param = @"""{path}""",
11- AcceptFileFlag = (int)FileMatchFlagEnum.All,
12- AcceptDirectoryFlag = (int)(DirectoryMatchFlagEnum.Directory | DirectoryMatchFlagEnum.Background | DirectoryMatchFlagEnum.Desktop),
13- AcceptMultipleFilesFlag = (int)FilesMatchFlagEnum.Each,
14- Index = 0,
15- Enabled = true,
16- Icon = ProcessInfoHelper.GetFileVersionInfo().FileName,
17- Exe = "$projectname$.exe"
18- };
9+ ContextMenuItem menu = new ContextMenuItem
10+ {
11+ Title = "Open $projectname$ Here",
12+ Param = @"""{path}""",
13+ AcceptFileFlag = (int)FileMatchFlagEnum.All,
14+ AcceptDirectoryFlag = (int)(DirectoryMatchFlagEnum.Directory | DirectoryMatchFlagEnum.Background | DirectoryMatchFlagEnum.Desktop),
15+ AcceptMultipleFilesFlag = (int)FilesMatchFlagEnum.Each,
16+ Index = 0,
17+ Enabled = true,
18+ Icon = ProcessInfoHelper.GetFileVersionInfo().FileName,
19+ Exe = "$projectname$.exe"
20+ };
1921
20- ContextMenuService menuService = new ContextMenuService();
21- await menuService.SaveAsync(menu);
22+ ContextMenuService menuService = new ContextMenuService();
23+ await menuService.SaveAsync(menu);
24+ }
2225"""" ;
2326 public static string Windows11ContextMenuMVVMInitializer =
2427""""
2528var menuService = GetService<ContextMenuService>();
26- if (menuService != null)
29+ if (menuService != null && RuntimeHelper.IsPackaged() )
2730{
2831 ContextMenuItem menu = new ContextMenuItem
2932 {
0 commit comments