Issue #262: function GetQuotes load data from MT instead of using cached quotes

This commit is contained in:
Viacheslav Demydiuk
2025-12-05 23:43:27 +02:00
parent 0c874773e5
commit 249b0f9fbb
8 changed files with 88 additions and 60 deletions
@@ -166,6 +166,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Quotes" Background="LightYellow" />
<ListView Grid.Row="1" Margin="2"
@@ -181,6 +182,7 @@
</GridView>
</ListView.View>
</ListView>
<Button Grid.Row="2" Content="Refresh Quotes" Margin="2" Command="{Binding RefreshQuotesCommand}"/>
</Grid>
</Border>
</Grid>
+16
View File
@@ -162,6 +162,7 @@ namespace MtApi5TestClient
public DelegateCommand UnlockTicksCommand { get; private set; }
public DelegateCommand GetSymbolsCommand { get; private set; }
public DelegateCommand RefreshQuotesCommand { get; private set; }
#endregion
#region Properties
@@ -492,6 +493,7 @@ namespace MtApi5TestClient
UnlockTicksCommand = new DelegateCommand(ExecuteUnlockTicks);
GetSymbolsCommand = new DelegateCommand(ExecuteGetSymbols);
RefreshQuotesCommand = new DelegateCommand(ExecuteRefreshQuotes);
}
private bool CanExecuteConnect(object o)
@@ -1756,6 +1758,20 @@ namespace MtApi5TestClient
Symbols = result;
});
}
private async void ExecuteRefreshQuotes(object o)
{
_quotesMap.Clear();
Quotes.Clear();
var quotes = await Execute(() => _mtApiClient.GetQuotes());
if (quotes != null)
{
foreach (var quote in quotes)
{
AddQuote(quote);
}
}
}
private static void RunOnUiThread(Action action)
{