private void Grid_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { ArbitrageBet bet = lstwForks.SelectedItem as ArbitrageBet; if (bet == null) { return; } PlacedBets.AddBet(bet); } }
public void GetForks() { if (locked) { return; } foreach (var pair in parsersDict) { pair.Value.BetList = new List <Bet>(); } SyncMatchBrowsers(); ParseBets(); locked = true; Task.Delay(3000).ContinueWith((n) => { var forks = arbitrageFinder.GetForks(); forks = forks.Where((e) => FilterSettings.Sports.Contains(e.Sport) && e.Profit >= FilterSettings.MinProfit && !PlacedBets.Contains(e)).ToList(); Application.Current.Dispatcher.Invoke(() => { foreach (var tab in Tabs) { var tabForks = forks.Where((fork) => fork.MainBet.BetUrl == tab.Control.matchUrl).ToList(); tab.Control.SetForks(tabForks); if (tabForks.Count > 0) { tab.Color = "Blue"; System.Media.SystemSounds.Beep.Play(); } else if (tab.Color != "Red") { tab.Color = "Black"; } } }); locked = false; }); }