File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 44using System . Threading . Tasks ;
55using PluginCore ;
66using Windows . Management . Deployment ;
7+ using Core . Services ;
8+ using Serilog ;
9+ using Serilog . Core ;
710
811namespace Core . Window ;
912
1013public class ExplorerContextMenuService : IExplorerContextMenuService
1114{
15+ private ILogger Logger = LogManager . Logger . ForContext < IExplorerContextMenuService > ( ) ;
1216 public async Task < bool > RegisterAsync ( )
1317 {
1418 try
@@ -37,8 +41,9 @@ public async Task<bool> RegisterAsync()
3741 var result = await packageManager . RegisterPackageByUriAsync ( new Uri ( manifestPath ) , options ) ;
3842 return result . ExtendedErrorCode == null ;
3943 }
40- catch ( Exception )
44+ catch ( Exception e )
4145 {
46+ Logger . Error ( e , "ExplorerContextMenuService" ) ;
4247 return false ;
4348 }
4449 }
Original file line number Diff line number Diff line change @@ -258,10 +258,17 @@ public static void OnStartup(string[] arg)
258258 // Since we are here, we are the only instance. We should process args locally.
259259 MqttManager . ProcessLocalArgs ( arg ) . GetAwaiter ( ) . GetResult ( ) ;
260260
261- ServiceManager . Services . GetService < IExplorerContextMenuService > ( ) ! . RegisterAsync ( )
261+ if ( ServiceManager . Services . GetService < IExplorerContextMenuService > ( ) ! . RegisterAsync ( )
262262 . GetAwaiter ( )
263- . GetResult ( ) ;
264- Logger . Information ( "资源管理器右键菜单注册完成" ) ;
263+ . GetResult ( ) )
264+ {
265+ Logger . Information ( "资源管理器右键菜单注册完成" ) ;
266+ }
267+ else
268+ {
269+ Logger . Warning ( "资源管理器右键菜单注册失败" ) ;
270+ }
271+
265272
266273
267274 switch ( ConfigManger . Config . themeChoice )
You can’t perform that action at this time.
0 commit comments