private void CheckForNewNotifications(object sender, EventArgs e) { var world = WarframeInfoProvider.GetWorldState(); var newAlerts = WarframeInfoProvider.GetAlerts(world); var tmpAlerts = new ObservableCollection <Alert>(); foreach (Alert alert in newAlerts) { if (!(Alerts.Any(x => x._id.oid == alert._id.oid)) && alert != null) { NotificationQueue.Add(alert); } alert.ToNotificationString(); tmpAlerts.Add(alert); } Alerts = tmpAlerts; WarframeInfoProvider.GetInvasions(world); var newInvasions = WarframeInfoProvider.GetInvasions(world); var tmpInvasions = new ObservableCollection <Invasion>(); foreach (Invasion invasion in newInvasions) { if (!(Invasions.Any(x => x._id.oid == invasion._id.oid)) && invasion != null) { NotificationQueue.Add(invasion); } invasion.ToNotificationString(); tmpInvasions.Add(invasion); } Invasions = tmpInvasions; }
public MainWindowViewModel() { NotificationQueue = new List <Notification>(); Alerts = new ObservableCollection <Alert>(); Invasions = new ObservableCollection <Invasion>(); MarketItems = new List <MarketItem>(); SearchResults = new List <MarketItem>(); OpenNotificationWindowCommand = new RelayCommand(OpenNotificationWindow); OpenNotificationPreviewWindowCommand = new RelayCommand(OpenNotificationPreviewWindow); CheckPriceCommand = new RelayCommand(CheckPrice); CheckForNewNotifications(null, EventArgs.Empty); DispatcherTimer newNotificationTimer = new DispatcherTimer(); newNotificationTimer.Interval = TimeSpan.FromSeconds(30); newNotificationTimer.Tick += CheckForNewNotifications; newNotificationTimer.Start(); DispatcherTimer displayNotificationTimer = new DispatcherTimer(); displayNotificationTimer.Interval = TimeSpan.FromSeconds(10); displayNotificationTimer.Tick += DisplayNotification; displayNotificationTimer.Start(); MarketItems = WarframeInfoProvider.GetMarketItems(); var v = WarframeInfoProvider.Factions; }