public static void CloseView(this WidgetId id, bool reload = false) { try { var view = id.GetView(); if (view == null) { id.LoadView(); return; } if (reload) { view.CloseAction = () => { id.LoadView(); }; } view.CloseAnimation(); } catch (Exception ex) { var name = id.GetName(); Popup.ShowAsync($"{name} failed to close.\n\n{ex.Message}", image: MessageBoxImage.Error); } }
public static void Enable(this WidgetId id) { var settings = id.GetSettings(); if (settings == null || !settings.Disabled) { return; } settings.Disabled = false; id.LoadView(); foreach (var eventPair in App.WidgetsSettingsStore.EventActionPairs) { var evnt = eventPair.Event as WidgetEnableEvent; if (evnt == null || eventPair.Disabled || evnt.WidgetId?.Guid != id?.Guid) { continue; } eventPair.Action.Execute(); } }