public void RemovePlayList()
        {
            NeedSave = true;
            InterceptInput.EnableKeyInput = false;
            var idx    = SelectedIndexPlayName;
            var result = MessageBox.Show(Application.Current.MainWindow, $"Are you sure remove a \"{ListPlayListNames[idx]}\"", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question);

            if (result == MessageBoxResult.OK)
            {
                Config.Instance.PlayList.RemoveAt(idx);
                ListPlayListNames.RemoveAt(idx);
                ListCurrentSelectedCommands.Clear();
            }
            InterceptInput.EnableKeyInput = true;
        }
 public string DuplicatePlayList(int srcIndex)
 {
     NeedSave = true;
     if (0 <= srcIndex)
     {
         var copy_name = ListPlayListNames[srcIndex] + "_copy";
         Config.Instance.PlayList.Insert(srcIndex, new PlayData {
             Name = copy_name, Commands = ListCurrentSelectedCommands.ToArray()
         });
         ListPlayListNames.Insert(srcIndex, copy_name);
         SelectedIndexPlayName = srcIndex;
         return(copy_name);
     }
     return(null);
 }
 public string AddNewPlayList()
 {
     NeedSave = true;
     for (int i = 1; i < 100; ++i)
     {
         var name = "new_" + i;
         if (!ListPlayListNames.Contains(name))
         {
             ListPlayListNames.Add(name);
             Config.Instance.PlayList.Add(new PlayData {
                 Name = name
             });
             return(name);
         }
     }
     return(null);
 }
 public void Init()
 {
     if (Config.Instance.PlayList.Any())
     {
         var play_list = Config.Instance.PlayList;
         for (int i = 0; i < play_list.Count; ++i)
         {
             ListPlayListNames.Add(play_list[i].Name);
             foreach (var jj in play_list[i].Commands)
             {
                 ListCurrentSelectedCommands.Add(jj);
             }
         }
     }
     NotifyPropertyChanged(nameof(EnablePlayButton));
     RepeatCount.Subscribe(_ => {
         NotifyPropertyChanged("RepeatIntervalEnabled");
     });
     CaptureInterval.Value = Config.Instance.CaptureInterval;
     //RepeatInterval.Value = Config.Instance.RepeatInterval;
 }