Skip to content

Commit 0ff2b5c

Browse files
author
Ahmad Noman Musleh
committed
Fixed Blazor sample issues with .NET 6.0
1 parent 28c811e commit 0ff2b5c

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/Blazor.WebSocket.Sample/Blazor.WebSocket.Sample.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
</ItemGroup>
3535

3636
<ItemGroup>
37-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.10" />
38-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.10" PrivateAssets="all" />
39-
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
37+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
38+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.1" PrivateAssets="all" />
39+
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
4040
</ItemGroup>
4141

4242
<ItemGroup>

src/Blazor.WebSocket.Sample/Pages/Index.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@
427427
await Task.Delay(1000);
428428

429429
await ApiCredentialsModal.Open();
430+
431+
ApiService.Error += exception => Console.Error.WriteLine($"API Service Exception: {exception}");
430432
}
431433

432434
private async Task Connect()

src/OpenAPI.Net/Helpers/ApiInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static class ApiInfo
77

88
public const int Port = 5035;
99

10-
public const string AuthUrl = "https://connect.spotware.com/apps/";
10+
public const string AuthUrl = "https://openapi.ctrader.com/apps/";
1111

1212
public static string GetHost(Mode mode) => mode == Mode.Live ? LiveHost : DemoHost;
1313
}

src/Samples.Shared/Services/TradingAccountsService.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,15 @@ public async Task<IEnumerable<ProtoOACtidTraderAccount>> GetAccounts(string acce
162162

163163
await LogoutAccounts(accounts.Where(iAccount => _accounts.ContainsKey(Convert.ToInt64(iAccount.CtidTraderAccountId))));
164164

165-
await AuthorizeAccounts(accounts, accessToken);
165+
foreach (var account in accounts)
166+
{
167+
var accountId = Convert.ToInt64(account.CtidTraderAccountId);
168+
169+
await _apiService.AuthorizeAccount(accountId, account.IsLive, accessToken);
170+
171+
_accounts.TryAdd(accountId, account);
172+
_accountIds.TryAdd(account.TraderLogin, accountId);
173+
}
166174

167175
return accounts;
168176
}
@@ -644,16 +652,6 @@ private void OnExecutionEvent(ProtoOAExecutionEvent executionEvent)
644652
}
645653
}
646654

647-
private Task AuthorizeAccounts(IEnumerable<ProtoOACtidTraderAccount> accounts, string accessToken) => Task.WhenAll(accounts.Select(async account =>
648-
{
649-
var accountId = Convert.ToInt64(account.CtidTraderAccountId);
650-
651-
await _apiService.AuthorizeAccount(accountId, account.IsLive, accessToken);
652-
653-
_accounts.TryAdd(accountId, account);
654-
_accountIds.TryAdd(account.TraderLogin, accountId);
655-
}).ToArray());
656-
657655
private Task LogoutAccounts(IEnumerable<ProtoOACtidTraderAccount> accounts) => Task.WhenAll(accounts.Select(async account =>
658656
{
659657
var accountId = Convert.ToInt64(account.CtidTraderAccountId);

0 commit comments

Comments
 (0)