public static void ToggleEnableDisable(this EventActionId id) { var pair = id.GetPair(); if (pair == null) { return; } pair.Disabled = !pair.Disabled; pair.Refresh(); }
public static EventActionPair Clone(this EventActionId id) { var newPair = SettingsHelper.CloneObject(id.GetPair()) as EventActionPair; if (newPair != null) { newPair.Identifier.GenerateNewGuid(); newPair.Add(); } return(newPair); }
public static void Remove(this EventActionId id) { if (Popup.Show("Are you sure you want to delete this event and action pair?", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes) == MessageBoxResult.No) { return; } foreach (var pair in App.WidgetsSettingsStore.EventActionPairs.Where(x => x.Identifier.Guid == id.Guid).ToList()) { App.WidgetsSettingsStore.EventActionPairs.Remove(pair); if (pair.Event is HotkeyEvent hotkeyEvent) { HotkeyStore.RemoveHotkey(hotkeyEvent.Hotkey); } } }
public static EventActionPair MoveDown(this EventActionId id) { var pair = id.GetPair(); return(pair == null ? null : App.WidgetsSettingsStore.EventActionPairs.MoveDown(pair)); }
public static void Edit(this EventActionId id) { id.GetPair()?.Edit(); }
private static EventActionPair GetPair(this EventActionId id) { return(App.WidgetsSettingsStore.EventActionPairs.FirstOrDefault(x => x?.Identifier?.Guid == id?.Guid)); }