Exemple #1
0
        public static void ToggleEnableDisable(this EventActionId id)
        {
            var pair = id.GetPair();

            if (pair == null)
            {
                return;
            }
            pair.Disabled = !pair.Disabled;
            pair.Refresh();
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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);
         }
     }
 }
Exemple #4
0
        public static EventActionPair MoveDown(this EventActionId id)
        {
            var pair = id.GetPair();

            return(pair == null ? null : App.WidgetsSettingsStore.EventActionPairs.MoveDown(pair));
        }
Exemple #5
0
 public static void Edit(this EventActionId id)
 {
     id.GetPair()?.Edit();
 }
Exemple #6
0
 private static EventActionPair GetPair(this EventActionId id)
 {
     return(App.WidgetsSettingsStore.EventActionPairs.FirstOrDefault(x => x?.Identifier?.Guid == id?.Guid));
 }