@@ -45,13 +45,14 @@ public event Action WindowAllClosed
4545
4646 BridgeConnector . Socket . Emit ( "register-app-window-all-closed" , GetHashCode ( ) ) ;
4747 }
48+
4849 _windowAllClosed += value ;
4950 }
5051 remove
5152 {
5253 _windowAllClosed -= value ;
5354
54- if ( _windowAllClosed == null )
55+ if ( _windowAllClosed == null )
5556 BridgeConnector . Socket . Off ( "app-window-all-closed" + GetHashCode ( ) ) ;
5657 }
5758 }
@@ -117,6 +118,7 @@ public event Func<QuitEventArgs, Task> BeforeQuit
117118
118119 BridgeConnector . Socket . Emit ( "register-app-before-quit" , GetHashCode ( ) ) ;
119120 }
121+
120122 _beforeQuit += value ;
121123 }
122124 remove
@@ -168,6 +170,7 @@ public event Func<QuitEventArgs, Task> WillQuit
168170
169171 BridgeConnector . Socket . Emit ( "register-app-will-quit" , GetHashCode ( ) ) ;
170172 }
173+
171174 _willQuit += value ;
172175 }
173176 remove
@@ -194,7 +197,7 @@ public event Func<Task> Quitting
194197 {
195198 BridgeConnector . Socket . On ( "app-will-quit" + GetHashCode ( ) + "quitting" , async ( ) =>
196199 {
197- if ( _willQuit == null )
200+ if ( _willQuit == null )
198201 {
199202 await this . _quitting ( ) . ConfigureAwait ( false ) ;
200203 Exit ( ) ;
@@ -203,6 +206,7 @@ public event Func<Task> Quitting
203206
204207 BridgeConnector . Socket . Emit ( "register-app-will-quit" , GetHashCode ( ) + "quitting" ) ;
205208 }
209+
206210 _quitting += value ;
207211 }
208212 remove
@@ -276,11 +280,11 @@ public event Action<bool> AccessibilitySupportChanged
276280 /// <summary>
277281 /// Emitted when the application has finished basic startup.
278282 /// </summary>
279- public event Action Ready
283+ public event Action Ready
280284 {
281285 add
282286 {
283- if ( IsReady )
287+ if ( IsReady )
284288 {
285289 value ( ) ;
286290 }
@@ -298,19 +302,23 @@ public event Action Ready
298302 /// <summary>
299303 /// Application host fully started.
300304 /// </summary>
301- public bool IsReady
302- {
303- get { return _isReady ; }
305+ public bool IsReady
306+ {
307+ get
308+ {
309+ return _isReady ;
310+ }
304311 internal set
305312 {
306313 _isReady = value ;
307314
308- if ( value )
315+ if ( value )
309316 {
310317 _ready ? . Invoke ( ) ;
311318 }
312319 }
313320 }
321+
314322 private bool _isReady = false ;
315323
316324 /// <summary>
@@ -379,7 +387,7 @@ public Task<string> NameAsync
379387 }
380388
381389
382- internal App ( )
390+ internal App ( )
383391 {
384392 CommandLine = new CommandLine ( ) ;
385393 }
@@ -392,7 +400,7 @@ internal static App Instance
392400 {
393401 lock ( _syncRoot )
394402 {
395- if ( _app == null )
403+ if ( _app == null )
396404 {
397405 _app = new App ( ) ;
398406 }
@@ -541,7 +549,7 @@ public async Task<string> GetPathAsync(PathName pathName, CancellationToken canc
541549 cancellationToken . ThrowIfCancellationRequested ( ) ;
542550
543551 var taskCompletionSource = new TaskCompletionSource < string > ( ) ;
544- using ( cancellationToken . Register ( ( ) => taskCompletionSource . TrySetCanceled ( ) ) )
552+ using ( cancellationToken . Register ( ( ) => taskCompletionSource . TrySetCanceled ( ) ) )
545553 {
546554 BridgeConnector . Socket . On ( "appGetPathCompleted" , ( path ) =>
547555 {
@@ -554,7 +562,7 @@ public async Task<string> GetPathAsync(PathName pathName, CancellationToken canc
554562
555563 return await taskCompletionSource . Task
556564 . ConfigureAwait ( false ) ;
557- }
565+ }
558566 }
559567
560568 /// <summary>
@@ -715,7 +723,7 @@ public async Task<bool> SetAsDefaultProtocolClientAsync(string protocol, string
715723 BridgeConnector . Socket . On ( "appSetAsDefaultProtocolClientCompleted" , ( success ) =>
716724 {
717725 BridgeConnector . Socket . Off ( "appSetAsDefaultProtocolClientCompleted" ) ;
718- taskCompletionSource . SetResult ( ( bool ) success ) ;
726+ taskCompletionSource . SetResult ( ( bool ) success ) ;
719727 } ) ;
720728
721729 BridgeConnector . Socket . Emit ( "appSetAsDefaultProtocolClient" , protocol , path , args ) ;
@@ -760,7 +768,7 @@ public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, stri
760768 /// <param name="cancellationToken">The cancellation token.</param>
761769 /// <returns>Whether the call succeeded.</returns>
762770 public async Task < bool > RemoveAsDefaultProtocolClientAsync ( string protocol , string path , string [ ] args , CancellationToken cancellationToken = default )
763- {
771+ {
764772 cancellationToken . ThrowIfCancellationRequested ( ) ;
765773
766774 var taskCompletionSource = new TaskCompletionSource < bool > ( ) ;
@@ -769,7 +777,7 @@ public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, stri
769777 BridgeConnector . Socket . On ( "appRemoveAsDefaultProtocolClientCompleted" , ( success ) =>
770778 {
771779 BridgeConnector . Socket . Off ( "appRemoveAsDefaultProtocolClientCompleted" ) ;
772- taskCompletionSource . SetResult ( ( bool ) success ) ;
780+ taskCompletionSource . SetResult ( ( bool ) success ) ;
773781 } ) ;
774782
775783 BridgeConnector . Socket . Emit ( "appRemoveAsDefaultProtocolClient" , protocol , path , args ) ;
@@ -841,7 +849,7 @@ public async Task<bool> IsDefaultProtocolClientAsync(string protocol, string pat
841849 BridgeConnector . Socket . On ( "appIsDefaultProtocolClientCompleted" , ( success ) =>
842850 {
843851 BridgeConnector . Socket . Off ( "appIsDefaultProtocolClientCompleted" ) ;
844- taskCompletionSource . SetResult ( ( bool ) success ) ;
852+ taskCompletionSource . SetResult ( ( bool ) success ) ;
845853 } ) ;
846854
847855 BridgeConnector . Socket . Emit ( "appIsDefaultProtocolClient" , protocol , path , args ) ;
@@ -869,7 +877,7 @@ public async Task<bool> SetUserTasksAsync(UserTask[] userTasks, CancellationToke
869877 BridgeConnector . Socket . On ( "appSetUserTasksCompleted" , ( success ) =>
870878 {
871879 BridgeConnector . Socket . Off ( "appSetUserTasksCompleted" ) ;
872- taskCompletionSource . SetResult ( ( bool ) success ) ;
880+ taskCompletionSource . SetResult ( ( bool ) success ) ;
873881 } ) ;
874882
875883 BridgeConnector . Socket . Emit ( "appSetUserTasks" , JArray . FromObject ( userTasks , _jsonSerializer ) ) ;
@@ -1066,7 +1074,7 @@ public async Task<int> ImportCertificateAsync(ImportCertificateOptions options,
10661074 BridgeConnector . Socket . On ( "appImportCertificateCompleted" , ( result ) =>
10671075 {
10681076 BridgeConnector . Socket . Off ( "appImportCertificateCompleted" ) ;
1069- taskCompletionSource . SetResult ( ( int ) result ) ;
1077+ taskCompletionSource . SetResult ( ( int ) result ) ;
10701078 } ) ;
10711079
10721080 BridgeConnector . Socket . Emit ( "appImportCertificate" , JObject . FromObject ( options , _jsonSerializer ) ) ;
@@ -1122,7 +1130,7 @@ public async Task<bool> SetBadgeCountAsync(int count, CancellationToken cancella
11221130 BridgeConnector . Socket . On ( "appSetBadgeCountCompleted" , ( success ) =>
11231131 {
11241132 BridgeConnector . Socket . Off ( "appSetBadgeCountCompleted" ) ;
1125- taskCompletionSource . SetResult ( ( bool ) success ) ;
1133+ taskCompletionSource . SetResult ( ( bool ) success ) ;
11261134 } ) ;
11271135
11281136 BridgeConnector . Socket . Emit ( "appSetBadgeCount" , count ) ;
@@ -1183,7 +1191,7 @@ public async Task<LoginItemSettings> GetLoginItemSettingsAsync(LoginItemSettings
11831191 {
11841192 BridgeConnector . Socket . Off ( "appGetLoginItemSettingsCompleted" ) ;
11851193
1186- var result = ( ( JObject ) loginItemSettings ) . ToObject < LoginItemSettings > ( ) ;
1194+ var result = ( ( JObject ) loginItemSettings ) . ToObject < LoginItemSettings > ( ) ;
11871195
11881196 taskCompletionSource . SetResult ( result ) ;
11891197 } ) ;
@@ -1310,27 +1318,31 @@ internal void PreventQuit()
13101318 private bool _preventQuit = false ;
13111319
13121320 private const string ModuleName = "app" ;
1321+
13131322 /// <summary>
13141323 /// Subscribe to an unmapped event on the <see cref="App"/> module.
13151324 /// </summary>
13161325 /// <param name="eventName">The event name</param>
13171326 /// <param name="action">The handler</param>
13181327 public void On ( string eventName , Action action )
13191328 => Events . Instance . On ( ModuleName , eventName , action ) ;
1329+
13201330 /// <summary>
13211331 /// Subscribe to an unmapped event on the <see cref="App"/> module.
13221332 /// </summary>
13231333 /// <param name="eventName">The event name</param>
13241334 /// <param name="action">The handler</param>
13251335 public async Task On ( string eventName , Action < object > action )
13261336 => await Events . Instance . On ( ModuleName , eventName , action ) . ConfigureAwait ( false ) ;
1337+
13271338 /// <summary>
13281339 /// Subscribe to an unmapped event on the <see cref="App"/> module once.
13291340 /// </summary>
13301341 /// <param name="eventName">The event name</param>
13311342 /// <param name="action">The handler</param>
13321343 public void Once ( string eventName , Action action )
13331344 => Events . Instance . Once ( ModuleName , eventName , action ) ;
1345+
13341346 /// <summary>
13351347 /// Subscribe to an unmapped event on the <see cref="App"/> module once.
13361348 /// </summary>
@@ -1339,4 +1351,4 @@ public void Once(string eventName, Action action)
13391351 public async Task Once ( string eventName , Action < object > action )
13401352 => await Events . Instance . Once ( ModuleName , eventName , action ) . ConfigureAwait ( false ) ;
13411353 }
1342- }
1354+ }
0 commit comments