private static void LoadView(this WidgetId id, bool systemStartup = false) { WidgetView widgetView = null; try { foreach (var view in App.WidgetViews.Where(view => view.Id == id).ToList()) { view.Close(); } widgetView = new WidgetView(id, id.GetNewViewModel(), id.GetNewControlView(), systemStartup); App.WidgetViews.Add(widgetView); widgetView.Show(); } catch (Exception ex) { widgetView?.Close(); var name = id.GetName(); Popup.ShowAsync($"{name} failed to load.\n\n{ex.Message}", image: MessageBoxImage.Error); } }