private static void OnMouse(int button, int wheel) { MouseOptions mouse = MouseOptions.None; if (button > 0) { mouse = SDLKeys.MouseButtonToMouseOptions(button); } if (wheel != 0) { mouse = wheel < 0 ? MouseOptions.MouseWheelDown : MouseOptions.MouseWheelUp; if (Options.CurrentOptions.LimitMouseWheelTrigger) { TimeSpan diff = DateTime.Now - _lastMouseAction[(int)mouse]; if (diff < TimeSpan.FromMilliseconds(Options.CurrentOptions.LimitMouseWheelTriggerMS)) { return; } } _lastMouseAction[(int)mouse] = DateTime.Now; } HotkeyManager.GetInstance().OnMouseAction(mouse); }
public VMMain() { Model = new MMain(); AppWindowVisibility = Visibility.Hidden; MainWindowWidth = SDSystem.WindowWidth; HotkeyManager.GetInstance().RegisterHotKey("ShowWindow", LKey.None, RKey.F2, ShowWindow); Swatches = new SwatchesProvider().Swatches; Window win = Application.Current.MainWindow; PresentationSource source = PresentationSource.FromVisual(win); Matrix matrix = source.CompositionTarget.TransformFromDevice; double widthRatio = matrix.M11; double heightRatio = matrix.M22; double screenWidth = SystemParameters.PrimaryScreenWidth * widthRatio; double screenHeight = SystemParameters.PrimaryScreenHeight * heightRatio; MainWindowHeight = SystemParameters.WorkArea.Size.Height * heightRatio; MainWindowLeft = screenWidth - MainWindowWidth; MessageBoxMessage = "Are you sure delete this desktop page?"; DesktopWindowManager.GetInstance().ThemeDark = DesktopWindowManager.GetInstance().ThemeDark; DesktopWindowManager.GetInstance().ThemeColor = DesktopWindowManager.GetInstance().ThemeColor; IsThemeDark = DesktopWindowManager.GetInstance().ThemeDark; }
public static void Hotkeys(string onOff = "toggle") { HotkeyManager manager = HotkeyManager.GetInstance(); switch (onOff.Trim().ToLower()) { case "on": { manager.Enabled = true; break; } case "off": { manager.Enabled = false; break; } default: { manager.Enabled = !manager.Enabled; break; } } UOC.SystemMessage(manager.Enabled ? Strings.Hotkeys_enabled___ : Strings.Hotkeys_disabled___, manager.Enabled ? 0x3F : 36); }
private void Window_Loaded(object sender, RoutedEventArgs e) { ViewModel = new VMMain(); this.DataContext = ViewModel; AppManager.GetInstance().SelectAppNotify += SelectApp; HotkeyManager.GetInstance().StartListen(); }
private static bool OnHotkeyPressed(int key, int mod, bool pressed) { Key keys = SDLKeys.SDLKeyToKeys(key); bool pass = HotkeyManager.GetInstance().OnHotkeyPressed(keys); return(!pass); }
public static void Hotkeys() { HotkeyManager manager = HotkeyManager.GetInstance(); manager.Enabled = !manager.Enabled; UOC.SystemMessage(manager.Enabled ? Strings.Hotkeys_enabled___ : Strings.Hotkeys_disabled___, 0x3F); }
protected HotkeySettableViewModel(string name) { _name = name; _category = new HotkeyEntry(_name, true); HotkeyManager hotkey = HotkeyManager.GetInstance(); hotkey.AddCategory(_category); Items.CollectionChanged += OnCollectionChanged; _category.Children = new ObservableCollectionEx <HotkeySettable>(); }
public void WontDuplicateSkillsCategory() { AppDomain appDomain = AppDomain.CreateDomain("WontThrowExceptionOnDeserializeNullConfig", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation); appDomain.DoCallBack(() => { const string localPath = @"C:\Users\johns\Desktop\KvG Client 2.0"; if (!Directory.Exists(localPath)) { Debug.WriteLine("Not running test, requires Cliloc.enu"); return; } SkillsTabViewModel vm = new SkillsTabViewModel(); Options options = Options.CurrentOptions; Skills.Initialize(localPath); JObject json = new JObject { { "Skills", new JArray { new JObject { { "Name", "Hiding" }, { "Keys", new JObject { { "Keys", 94 }, { "SDLModifier", 0 }, { "Mouse", 7 } } }, { "PassToUO", false } } } } }; vm.Deserialize(json, options); vm.Deserialize(json, options); HotkeyManager hotkeys = HotkeyManager.GetInstance(); int count = hotkeys.Items.Count(hk => hk.IsCategory && hk.Name == Strings.Skills); Assert.AreEqual(1, count); }); }
protected HotkeyEntryViewModel(string name) { _category = new HotkeyCommand { Name = name, IsCategory = true }; HotkeyManager hotkey = HotkeyManager.GetInstance(); hotkey.AddCategory(_category); Items.CollectionChanged += OnCollectionChanged; _category.Children = new ObservableCollectionEx <HotkeyEntry>(); }
private static bool OnHotkeyPressed(int key, int mod, bool pressed) { Key keys = SDLKeyToKeys(key); if (pressed) { HotkeyPressedEvent?.Invoke(key, mod, keys, IntToModKey(mod)); bool pass = HotkeyManager.GetInstance().OnHotkeyPressed(keys, IntToModKey(mod)); return(!pass); } return(true); }
public HotkeysTabViewModel() { _hotkeyManager = HotkeyManager.GetInstance(); _hotkeyManager.ClearAllHotkeys = ClearAllHotkeys; }
private void Button_Click(object sender, RoutedEventArgs e) { HotkeyManager.GetInstance().RegisterHotKey("Test", LKey.Ctrl, RKey.D0, HotKey); }
public HotkeysTabViewModel() { _hotkeyManager = HotkeyManager.GetInstance(); }