private void Window_Loaded(object sender, RoutedEventArgs e) { XDocument xdoc = XDocument.Load("weatherdata.xml"); proc = new XMLProcessor(xdoc); Task.Run(() => CheckXMLForUpdate()); }
private void CheckXMLForUpdate() { while (true) { xdoc = XDocument.Load("weatherdata.xml"); proc = new XMLProcessor(xdoc); regionDataList = proc.GetRegionData(); Dispatcher.Invoke(() => listbox.ItemsSource = regionDataList); Thread.Sleep(1000); } }