private void DealsLoader_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            int percent = e.ProgressPercentage;
            DealsProgress.Value = percent;
            OwnerWindow.TaskbarItemInfo.ProgressValue = percent / 100.0;

            List<ItemSale> sales = e.UserState as List<ItemSale>;

            DealsResults.Clear();
            foreach (ItemSale s in sales)
            {
                SaleViewModel vm = new SaleViewModel(s);
                DealsResults.Add(vm);
            }

            if (DealsResults.HasItems())
            {
                SaleViewModel last = DealsResults.Last();
                DealsResultsList.ScrollIntoView(last);
            }
        }
        private void DealsLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            DealsFilters filters = e.Argument as DealsFilters;

            var flagged = DealFinder.FindDealsFlagged(Settings.Instance.HomeSteamID64, filters);

            List<ItemSale> results = new List<ItemSale>(flagged.Result);
            results.Sort((a, b) => b.Profit.TotalRefined.CompareTo(a.Profit.TotalRefined));

            var excluded = flagged.Flags;
            excluded.Sort((a, b) => a.Value.CompareTo(b.Value));

            DealsResultsList.Dispatcher.Invoke(() => {
                DealsResults.Clear();
                foreach (ItemSale s in results)
                {
                    SaleViewModel vm = new SaleViewModel(s);
                    DealsResults.Add(vm);
                }
            });

            DealsExcludedList.Dispatcher.Invoke(() => {
                DealsExcluded.Clear();
                foreach (var kvp in excluded)
                {
                    DealExclusionViewModel vm = new DealExclusionViewModel(kvp.Key, kvp.Value);
                    DealsExcluded.Add(vm);
                }
            });
        }