示例#1
0
 public void AddKey(Key k)
 {
     if (!HotKeys.ContainsKey(k.KeyName))
     {
         HotKeys.Add(k.KeyName, k);
     }
 }
示例#2
0
        void Reset()
        {
            HotKeys.Clear();

            foreach (HotKeyBinding item in HotKeysMapping.Load())
            {
                HotKeys.Add(item);
            }
        }
示例#3
0
        public void Add()
        {
            var newBinding = new HotKeyBinding {
                Name = "New Binding"
            };

            HotKeys.Add(newBinding);
            SelectedHotKey = newBinding;
        }
示例#4
0
 public void AddHotKey(HotKey hotKey, string actionName, bool save = true)
 {
     RemoveHotKey(hotKey, false);
     HotKeys.Add(new HotKeyConfigItem(hotKey, actionName));
     if (save)
     {
         Save();
     }
 }
示例#5
0
        private static void SetDefault()
        {
            if (string.IsNullOrWhiteSpace(CaptureSaveDirectory) || !Directory.Exists(CaptureSaveDirectory))
            {
                CaptureSaveDirectory = Path.Combine(Application.StartupPath, "Capture");
            }
            if (string.IsNullOrWhiteSpace(SaveImageFormat))
            {
                SaveImageFormat = ImageFormats[0];
            }
            if (GifFPS == 0)
            {
                GifFPS = 15;
            }
            if (VideoFPS == 0)
            {
                VideoFPS = 30;
            }
            if (string.IsNullOrWhiteSpace(AudioSource))
            {
                AudioSource = FFmpeg.DefaultAudioSource;
            }
            if (string.IsNullOrWhiteSpace(RecordSaveDirectory) || !Directory.Exists(RecordSaveDirectory))
            {
                RecordSaveDirectory = Path.Combine(Application.StartupPath, "Capture");
            }

            if (HotKeys == null)
            {
                HotKeys = new Dictionary <CaptureMode, HotKey>();
            }
            foreach (CaptureMode mode in Enum.GetValues(typeof(CaptureMode)))
            {
                if (!HotKeys.ContainsKey(mode))
                {
                    HotKeys.Add(mode, HotKey.CreateDefault(mode));
                    RegisterHotKey(mode);
                }
            }

            // 설정된 핫키 등록
            foreach (var mode in HotKeys.Keys)
            {
                RegisterHotKey(mode);
            }

            if (EditLineColor == Color.Empty)
            {
                EditLineColor = Color.Red;
            }
            if (EditLineSize == 0)
            {
                EditLineSize = 10;
            }
        }
示例#6
0
        private void SaveHotKey(ConfiguredHotKeyViewModel vm)
        {
            if (vm.IsNew)
            {
                HotKeys.Add(vm);
                vm.IsNew = false;
                OnPropertyChanged("HotKeys");
            }

            ReloadHotKeys();
            SaveHotKeysToFile();
        }
示例#7
0
        /// <inheritdoc />
        public override void RegisterNewHotkey(VirtualKeys key, Modifiers modifiers, EventHandler <HotKeyPressedEventArgs> handler)
        {
            int id = GetGenerateId();

            try
            {
                HotKey hotkey = HotKey.RegisterHotKey(IntPtr.Zero, key, modifiers, id);
                hotkey.HotKeyPressedEvent += handler;
                // remove no repeat before adding to list to avoid getting different hash
                modifiers = (Modifiers)((uint)modifiers & 0xF);
                HotKeys.Add(new KeyModifierCombination(key, modifiers), hotkey);
                HotKeysId.Add(id);
            }
            catch (HotKeyException e)
            {
                Logger.Warn("Failed to register hotKey : {0}", e.Message);
                throw;
            }
        }
示例#8
0
        /// <summary>
        /// Called when loading a settings file to iterate through new dynamic properties (such as Hotkeys)
        /// which may have changed and would otherwise be hidden from the user
        /// </summary>
        private void CheckForNewSettings()
        {
            foreach (var defaultHotkey in _defaultHotKeys)
            {
                bool found = false;
                foreach (var hotkey in HotKeys)
                {
                    if (hotkey.Action == defaultHotkey.Action)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    HotKeys.Add(defaultHotkey.Clone());
                }
            }
        }
示例#9
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            #region 保存热键
            HotKeys.Clear();
            foreach (var child in this.yy.Children)
            {
                if (child is HotKeySettingControl)
                {
                    HotKeySettingControl setting = child as HotKeySettingControl;
                    if (setting.HotKey != null)
                    {
                        HotKeys.Add(setting.Command, setting.HotKey);
                    }
                }
            }
            #endregion

            #region 类型关联
            List <string> fileTypes = new List <string>();
            //foreach (DataItem d in Items)
            //{
            //    if (d.IsEnabled) { fileTypes.Add(d.Name.Substring(d.Name.IndexOf('(').TrimEnd(')'))); }
            //}
            string dir = AppDomain.CurrentDomain.BaseDirectory;
            fileTypes.AddRange(Items.Where(item => item.IsEnabled).Select(ss => ss.Name.Substring(ss.Name.IndexOf('(') + 1).Trim(')')));
            TypeRegsiter.Regsiter(dir + "\\Player.exe", dir + "Resouce\\Symbian_Anna.dll", fileTypes);
            //  TypeRegsiter.Regsiter(fileTypes);  //TODO
            FileRegisterSave();
            #endregion
            this.Close();

            if (SettingReloadHandler != null)
            {
                SettingReloadHandler(HotKeys);
            }
        }
 public void AddHotKey(String ThisKey)
 {
     HotKeys.Add(ThisKey);
 }