public void DeactivateAlert(string uniqueName) { try { var itemCollection = (ObservableCollection <Item>)_itemsView.SourceCollection; var item = itemCollection.FirstOrDefault(i => i.UniqueName == uniqueName); if (item == null) { return; } item.IsAlertActive = false; Remove(item.UniqueName); _mainWindow.Dispatcher?.Invoke(() => { _itemsView.Refresh(); }); } catch (Exception e) { ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, e); Log.Error(MethodBase.GetCurrentMethod().DeclaringType, e); } }
private void ActivateAlert(string uniqueName, int minSellUndercutPrice) { try { var itemCollection = (ObservableCollection <Item>)_itemsView.SourceCollection; var item = itemCollection.FirstOrDefault(i => i.UniqueName == uniqueName); if (item == null) { return; } item.IsAlertActive = true; item.AlertModeMinSellPriceIsUndercutPrice = minSellUndercutPrice; Add(item, item.AlertModeMinSellPriceIsUndercutPrice); _mainWindow.Dispatcher?.Invoke(() => { _itemsView.Refresh(); }); } catch (Exception e) { ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, e); Log.Error(MethodBase.GetCurrentMethod().DeclaringType, e); } }