public static void UnregisterChordsConsumer(int index) { if (0 > index || index >= ChordMessageFilter.Current.chordsConsumers.Count) { return; } ChordMessageFilter.UnregisterChordsConsumer(ChordMessageFilter.Current.chordsConsumers[index]); }
public static bool UnregisterInstance() { if (ChordMessageFilter.filterInstances.ContainsKey(Thread.CurrentThread.ManagedThreadId)) { return(ChordMessageFilter.UnregisterInstance(ChordMessageFilter.filterInstances[Thread.CurrentThread.ManagedThreadId])); } return(false); }
bool IMessageFilter.PreFilterMessage(ref Message msg) { if (msg.Msg < 256 || msg.Msg > 264) { return(false); } int wparam = (int)msg.WParam; this.SetModifiers(wparam, true); if (msg.Msg == 256 || msg.Msg == 260) { if ((msg.LParam.ToInt32() >> 16 & (int)ushort.MaxValue & 16384) <= 0 && !ChordMessageFilter.constants.Contains(wparam)) { Keys keys = ChordMessageFilter.IsValidKey((Keys)wparam); this.stack.Push(keys); if (this.keyMapActivated) { this.tipsStack.Push(keys); } } if (this.IsRuntimeChord()) { if (this.ProccessChord()) { this.keyMapActivatedInstance = (IComponentTreeHandler)null; this.stack.Clear(); ChordMessageFilter.previousKeyCode = wparam; return(true); } } else if (wparam == 18 || wparam == 121) { this.isAltKeyDown = true; } } if (msg.Msg == 257 || msg.Msg == 261) { if ((wparam == 18 || wparam == 121) && (this.stack.Count == 0 && this.isAltKeyDown)) { this.InvokeKeyMaps(); } this.isAltKeyDown = false; this.SetModifiers(wparam, false); if (!this.chordModifier.ShiftModifier && !this.chordModifier.ControlModifier && !this.chordModifier.AltModifier) { this.chordModifier = (ChordModifier)null; this.stack.Clear(); if ((wparam == 18 || wparam == 121) && ChordMessageFilter.previousKeyCode != 17) { ChordMessageFilter.previousKeyCode = wparam; return(this.ProccessKeyMaps()); } } } ChordMessageFilter.previousKeyCode = wparam; return(false); }
/// <summary> /// Initializes a new instance of the ChordMessageFilter class. /// </summary> /// <returns>Instance of the ChordMessageFilter class</returns> public static ChordMessageFilter CreateInstance() { if (!InstanceCreated) { ChordMessageFilter.filterInstance = new ChordMessageFilter(); InstanceCreated = true; } return(ChordMessageFilter.filterInstance); }
internal virtual void RemoveShortcutsSupport() { if (this.chordMessageFilter == null) { return; } ChordMessageFilter.UnregisterChordsConsumer(this); this.chordMessageFilter = (ChordMessageFilter)null; }
internal virtual void AddShortcutsSupport() { try { this.chordMessageFilter = ChordMessageFilter.CreateInstance(); ChordMessageFilter.RegisterChordsConsumer(this); } finally { } }
public static void UnregisterChordsConsumer(Shortcuts consumer) { if (ChordMessageFilter.Current.chordsConsumers.Contains(consumer)) { ChordMessageFilter.Current.chordsConsumers.Remove(consumer); } if (ChordMessageFilter.Current.chordsConsumers.Count != 0) { return; } ChordMessageFilter.UnregisterInstance(); }
public static void RegisterChordsConsumer(Shortcuts consumer) { if (Current.chordsConsumers.Count == 0) { ChordMessageFilter.RegisterInstance(); } if (!Current.chordsConsumers.Contains(consumer)) { Current.chordsConsumers.Add(consumer); } }
internal virtual void RemoveShortcutsSupport() { try { if (this.chordMessageFilter != null) { ChordMessageFilter.UnregisterChordsConsumer(this); this.chordMessageFilter = null; } } finally { } }
public static ChordMessageFilter CreateInstance() { if (ChordMessageFilter.filterInstances == null) { ChordMessageFilter.filterInstances = new Dictionary <int, ChordMessageFilter>(); } if (ChordMessageFilter.filterInstances.ContainsKey(Thread.CurrentThread.ManagedThreadId)) { return(ChordMessageFilter.filterInstances[Thread.CurrentThread.ManagedThreadId]); } ChordMessageFilter chordMessageFilter = new ChordMessageFilter(); ChordMessageFilter.filterInstances.Add(Thread.CurrentThread.ManagedThreadId, chordMessageFilter); return(chordMessageFilter); }
public static bool UnregisterInstance(ChordMessageFilter filterInstance) { try { if (!ChordMessageFilter.registeredFilters.Contains(filterInstance)) { return(false); } ChordMessageFilter.registeredFilters.Remove(filterInstance); Application.RemoveMessageFilter((IMessageFilter)filterInstance); return(true); } catch (Exception ex) { throw new ApplicationException("Error while unregistering ChordMessageFilter instance", ex); } }
internal static bool RegisterInstance(ChordMessageFilter filterInstance) { try { if (ChordMessageFilter.registeredFilters.Contains(filterInstance)) { return(false); } ChordMessageFilter.registeredFilters.Add(filterInstance); Application.AddMessageFilter((IMessageFilter)filterInstance); return(true); } catch (Exception ex) { throw new ApplicationException("Error while registering ChordMessageFilter instance", ex); } }
public static void ClearChordsConsumers() { ChordMessageFilter.Current.chordsConsumers.Clear(); ChordMessageFilter.UnregisterInstance(); }