mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-15 03:38:09 +00:00
Issue #262: function GetQuotes load data from MT instead of using cached quotes
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user