public void ReloadFeedConfigItems(bool clearall) { if (Dispatcher.Thread != Thread.CurrentThread) { Log.Debug("Received request to Reload FeedConfigItems - thread miss, reinvoking"); var d = new ReloadFeedConfigItemsCallBack(ReloadFeedConfigItems); Dispatcher.Invoke(d, new object[] { clearall }); } else { Log.Debug("Received request to Reload FeedConfigItems"); try { feedlistbox.Items.Clear(); LoadFeedSettings(); foreach (var fci in FeedConfigItems.Items) { feedlistbox.Items.Add(fci); } feedexportbtn.IsEnabled = (feedlistbox.Items.Count > 0); if (clearall) { foreach (FeedWin fw in windowlist.Values) { fw.Close(); } windowlist.Clear(); } foreach (var fw in from fci in FeedConfigItems.Items where !windowlist.ContainsKey(fci.Guid) select new FeedWin(fci)) { fw.LocationChanged += fw_LocationChanged; fw.SizeChanged += fw_SizeChanged; fw.Show(); windowlist.Add(fw.FeedConfig.Guid, fw); } } catch (Exception ex) { Log.Error("Exception thrown when trying to reload the FeedConfigItems", ex); throw; } } }
public void ReloadFeedConfigItems(bool clearall) { if (Dispatcher.Thread != Thread.CurrentThread) { Log.Debug("Received request to Reload FeedConfigItems - thread miss, reinvoking"); var d = new ReloadFeedConfigItemsCallBack(ReloadFeedConfigItems); Dispatcher.Invoke(d, new object[] { clearall }); } else { Log.Debug("Received request to Reload FeedConfigItems"); try { feedlistbox.Items.Clear(); LoadFeedSettings(); foreach (var fci in FeedConfigItems.Items) { feedlistbox.Items.Add(fci); } feedexportbtn.IsEnabled = (feedlistbox.Items.Count > 0); if (clearall) { foreach (FeedWin fw in windowlist.Values) { fw.Close(); } windowlist.Clear(); } foreach (var fw in from fci in FeedConfigItems.Items where !windowlist.ContainsKey(fci.Guid) select new FeedWin(fci)) { fw.LocationChanged += fw_LocationChanged; fw.SizeChanged += fw_SizeChanged; fw.Show(); windowlist.Add(fw.FeedConfig.Guid, fw); } } catch (Exception ex) { Log.Error("Exception thrown when trying to reload the FeedConfigItems", ex); throw; } } }