@@ -581,7 +581,7 @@ public void Relaunch()
581581 /// <param name="relaunchOptions">Options for the relaunch.</param>
582582 public void Relaunch ( RelaunchOptions relaunchOptions )
583583 {
584- BridgeConnector . EmitSync ( "appRelaunch" , relaunchOptions ) ;
584+ BridgeConnector . EmitSync ( "appRelaunch" , JObject . FromObject ( relaunchOptions , _jsonSerializer ) ) ;
585585 }
586586
587587 /// <summary>
@@ -601,7 +601,7 @@ public void Focus()
601601 /// </summary>
602602 public void Focus ( FocusOptions focusOptions )
603603 {
604- BridgeConnector . Emit ( "appFocus" , focusOptions ) ;
604+ BridgeConnector . Emit ( "appFocus" , JObject . FromObject ( focusOptions , _jsonSerializer ) ) ;
605605 }
606606
607607 /// <summary>
@@ -891,7 +891,7 @@ public async Task<bool> IsDefaultProtocolClientAsync(string protocol, string pat
891891 /// <param name="userTasks">Array of <see cref="UserTask"/> objects.</param>
892892 /// <param name="cancellationToken">The cancellation token.</param>
893893 /// <returns>Whether the call succeeded.</returns>
894- public Task < bool > SetUserTasksAsync ( UserTask [ ] userTasks , CancellationToken cancellationToken = default ) => BridgeConnector . OnResult < bool > ( "appSetUserTasks" , "appSetUserTasksCompleted" , cancellationToken , userTasks ) ;
894+ public Task < bool > SetUserTasksAsync ( UserTask [ ] userTasks , CancellationToken cancellationToken = default ) => BridgeConnector . OnResult < bool > ( "appSetUserTasks" , "appSetUserTasksCompleted" , cancellationToken , JArray . FromObject ( userTasks , _jsonSerializer ) ) ;
895895
896896 /// <summary>
897897 /// Jump List settings for the application.
@@ -918,7 +918,7 @@ public async Task<bool> IsDefaultProtocolClientAsync(string protocol, string pat
918918 /// <param name="categories">Array of <see cref="JumpListCategory"/> objects.</param>
919919 public void SetJumpList ( JumpListCategory [ ] categories )
920920 {
921- BridgeConnector . Emit ( "appSetJumpList" , categories ) ;
921+ BridgeConnector . Emit ( "appSetJumpList" , JArray . FromObject ( categories , _jsonSerializer ) ) ;
922922 }
923923
924924 /// <summary>
@@ -1054,7 +1054,7 @@ public void SetAppUserModelId(string id)
10541054 /// <param name="options"></param>
10551055 /// <param name="cancellationToken">The cancellation token.</param>
10561056 /// <returns>Result of import. Value of 0 indicates success.</returns>
1057- public Task < int > ImportCertificateAsync ( ImportCertificateOptions options , CancellationToken cancellationToken = default ) => BridgeConnector . OnResult < int > ( "appImportCertificate" , "appImportCertificateCompleted" , cancellationToken , options ) ;
1057+ public Task < int > ImportCertificateAsync ( ImportCertificateOptions options , CancellationToken cancellationToken = default ) => BridgeConnector . OnResult < int > ( "appImportCertificate" , "appImportCertificateCompleted" , cancellationToken , JObject . FromObject ( options , _jsonSerializer ) ) ;
10581058
10591059 /// <summary>
10601060 /// Memory and cpu usage statistics of all the processes associated with the app.
@@ -1120,7 +1120,7 @@ public async Task<LoginItemSettings> GetLoginItemSettingsAsync(CancellationToken
11201120 /// <param name="cancellationToken">The cancellation token.</param>
11211121 public Task < LoginItemSettings > GetLoginItemSettingsAsync ( LoginItemSettingsOptions options , CancellationToken cancellationToken = default ) =>
11221122 options is null ? BridgeConnector . OnResult < LoginItemSettings > ( "appGetLoginItemSettings" , "appGetLoginItemSettingsCompleted" , cancellationToken )
1123- : BridgeConnector . OnResult < LoginItemSettings > ( "appGetLoginItemSettings" , "appGetLoginItemSettingsCompleted" , cancellationToken , options ) ;
1123+ : BridgeConnector . OnResult < LoginItemSettings > ( "appGetLoginItemSettings" , "appGetLoginItemSettingsCompleted" , cancellationToken , JObject . FromObject ( options , _jsonSerializer ) ) ;
11241124
11251125 /// <summary>
11261126 /// Set the app's login item settings.
@@ -1130,7 +1130,7 @@ public Task<LoginItemSettings> GetLoginItemSettingsAsync(LoginItemSettingsOption
11301130 /// <param name="loginSettings"></param>
11311131 public void SetLoginItemSettings ( LoginSettings loginSettings )
11321132 {
1133- BridgeConnector . Emit ( "appSetLoginItemSettings" , loginSettings ) ;
1133+ BridgeConnector . Emit ( "appSetLoginItemSettings" , JObject . FromObject ( loginSettings , _jsonSerializer ) ) ;
11341134 }
11351135
11361136 /// <summary>
@@ -1179,7 +1179,7 @@ public void ShowAboutPanel()
11791179 /// <param name="options">About panel options.</param>
11801180 public void SetAboutPanelOptions ( AboutPanelOptions options )
11811181 {
1182- BridgeConnector . Emit ( "appSetAboutPanelOptions" , options ) ;
1182+ BridgeConnector . Emit ( "appSetAboutPanelOptions" , JObject . FromObject ( options , _jsonSerializer ) ) ;
11831183 }
11841184
11851185 /// <summary>
@@ -1243,5 +1243,10 @@ internal void PreventQuit()
12431243 /// <param name="eventName">The event name</param>
12441244 /// <param name="fn">The handler</param>
12451245 public void Once ( string eventName , Action < object > fn ) => Events . Instance . Once ( ModuleName , eventName , fn ) ;
1246+
1247+ private readonly JsonSerializer _jsonSerializer = new JsonSerializer ( )
1248+ {
1249+ ContractResolver = new CamelCasePropertyNamesContractResolver ( )
1250+ } ;
12461251 }
12471252}
0 commit comments