Exemple #1
0
 public NavCategoryInitializer(
     ViewMode mode,
     int id,
     string name,
     string nameKey,
     string glyph,
     CategoryGroupType group,
     MyVirtualKey vKey,
     bool categorySupportsNegative)
 {
     this.viewMode         = mode;
     this.serializationId  = id;
     this.friendlyName     = name;
     this.nameResourceKey  = nameKey;
     this.glyph            = glyph;
     this.groupType        = group;
     this.virtualKey       = vKey;
     this.supportsNegative = categorySupportsNegative;
 }
Exemple #2
0
            private static void OnVirtualKeyPropertyChanged(DependencyObject target, MyVirtualKey oldValue, MyVirtualKey newValue)
            {
                // Writer lock for the static maps
                lock (s_keyboardShortcutMapLockMutex)
                {
                    var button = ((ButtonBase)target);

                    int viewId = Utilities.GetWindowId();

                    // Check if the View Id has already been registered
                    if (s_virtualKey.TryGetValue(viewId, out var iterViewMap))
                    {
                        Insert(iterViewMap, newValue, new WeakReference(button));
                    }
                    else
                    {
                        // If the View Id is not already registered, then register it and make the entry
                        s_virtualKey.Add(viewId, new SortedDictionary <MyVirtualKey, List <WeakReference> >());
                        Insert(s_virtualKey[viewId], newValue, new WeakReference(button));
                    }
                }
            }
Exemple #3
0
            private static void OnVirtualKeyControlChordPropertyChanged(DependencyObject target, MyVirtualKey oldValue, MyVirtualKey newValue)
            {
                // Writer lock for the static maps
                lock (s_keyboardShortcutMapLockMutex)
                {
                    Control control = (target as ButtonBase);

                    if (control == null)
                    {
                        // Handling Ctrl+E shortcut for Date Calc, target would be NavigationView^ in that case
                        control = (target as MUXC.NavigationView);
                    }

                    int viewId = Utilities.GetWindowId();

                    // Check if the View Id has already been registered
                    if (s_VirtualKeyControlChordsForButtons.TryGetValue(viewId, out var iterViewMap))
                    {
                        Insert(iterViewMap, newValue, new WeakReference(control));
                    }
                    else
                    {
                        // If the View Id is not already registered, then register it and make the entry
                        s_VirtualKeyControlChordsForButtons.Add(viewId, new SortedDictionary <MyVirtualKey, List <WeakReference> >());
                        Insert(s_VirtualKeyControlChordsForButtons[viewId], newValue, new WeakReference(control));
                    }
                }
            }
Exemple #4
0
 public static void SetVirtualKeyControlShiftChord(DependencyObject target, MyVirtualKey value)
 {
     target.SetValue(VirtualKeyControlShiftChordProperty, value);
 }
Exemple #5
0
 public static void SetVirtualKey(DependencyObject target, MyVirtualKey value)
 {
     target.SetValue(VirtualKeyProperty, value);
 }
Exemple #6
0
 public static void SetVirtualKeyControlInverseChord(DependencyObject obj, MyVirtualKey value) => obj.SetValue(VirtualKeyControlInverseChordProperty, value);
Exemple #7
0
 public static void SetVirtualKeyShiftChord(DependencyObject obj, MyVirtualKey value) => obj.SetValue(VirtualKeyShiftChordProperty, value);
Exemple #8
0
            ViewMode GetViewModeForVirtualKey(MyVirtualKey virtualKey)
            {
                var iter = s_categoryManifest.FirstOrDefault(initializer => initializer.Value.virtualKey == virtualKey);

                return((iter != null) ? iter.Value.viewMode : ViewMode.None);
            }