private void IMapTextBox_PreviewMouseWheel(object sender, MouseWheelEventArgs args) { if (args != null && args.Delta != 0 && (this.IMActionItems != null && this.IMActionItems.Any <IMActionItem>())) { foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems) { if (imActionItem.ActionItem.StartsWith("Key", StringComparison.InvariantCulture)) { this.Tag = args.Delta < 0 ? (object)"MouseWheelDown" : (object)"MouseWheelUp"; this.SetValueHandling(imActionItem); BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + IMAPKeys.GetStringForUI(this.Tag.ToString())); } if (this.PropertyType.Equals(typeof(bool))) { bool flag = !Convert.ToBoolean(imActionItem.IMAction[imActionItem.ActionItem], (IFormatProvider)CultureInfo.InvariantCulture); this.Tag = (object)flag; IMapTextBox.Setvalue(imActionItem, flag.ToString((IFormatProvider)CultureInfo.InvariantCulture)); BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + this.Tag?.ToString()); args.Handled = true; } } args.Handled = true; } this.SetCaretIndex(); }
void IComponentConnector.Connect(int connectionId, object target) { if (connectionId == 1) { this.mTextBox = (IMapTextBox)target; } else { this._contentLoaded = true; } }
private void SetValueHandling(IMActionItem item) { string str = item.IMAction[item.ActionItem].ToString(); if (this.IsLoaded) { KMManager.CallGamepadHandler(BlueStacksUIUtils.LastActivatedWindow, "true"); } if (this.PropertyType.Equals(typeof(double))) { if (double.TryParse(this.Text, out double _)) { str = this.Text; } else if (!string.IsNullOrEmpty(this.Text)) { this.Text = str; } } else if (this.PropertyType.Equals(typeof(int))) { if (int.TryParse(this.Text, out int _)) { str = this.Text; } else if (!string.IsNullOrEmpty(this.Text)) { this.Text = str; } } else { str = !this.PropertyType.Equals(typeof(bool)) ? this.Tag.ToString() : this.Tag.ToString(); } IMapTextBox.Setvalue(item, str); }
protected override void OnPreviewMouseDown(MouseButtonEventArgs args) { if (args != null) { if (this.IMActionItems != null && this.IMActionItems.Any <IMActionItem>()) { foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems) { if (imActionItem.ActionItem.StartsWith("Key", StringComparison.InvariantCulture)) { if (args.MiddleButton == MouseButtonState.Pressed) { args.Handled = true; this.Tag = (object)"MouseMButton"; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + "MouseMButton"); } else if (args.RightButton == MouseButtonState.Pressed) { args.Handled = true; this.Tag = (object)"MouseRButton"; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + "MouseRButton"); } else if (args.XButton1 == MouseButtonState.Pressed) { args.Handled = true; this.Tag = (object)"MouseXButton1"; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + "MouseXButton1"); } else if (args.XButton2 == MouseButtonState.Pressed) { args.Handled = true; this.Tag = (object)"MouseXButton2"; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + "MouseXButton2"); } } if (this.PropertyType.Equals(typeof(bool))) { bool flag = !Convert.ToBoolean(imActionItem.IMAction[imActionItem.ActionItem], (IFormatProvider)CultureInfo.InvariantCulture); this.Tag = (object)flag; IMapTextBox.Setvalue(imActionItem, flag.ToString((IFormatProvider)CultureInfo.InvariantCulture)); BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + this.Tag?.ToString()); if (imActionItem.IMAction.Type == KeyActionType.EdgeScroll && imActionItem.ActionItem.Equals("EdgeScrollEnabled", StringComparison.InvariantCultureIgnoreCase)) { KMManager.AssignEdgeScrollMode(flag.ToString((IFormatProvider)CultureInfo.InvariantCulture), (TextBox)this); } } } } if (args.LeftButton == MouseButtonState.Pressed && this.IsKeyboardFocusWithin) { args.Handled = true; } this.Focus(); args.Handled = true; } if (this.PropertyType.Equals(typeof(bool))) { KMManager.CheckAndCreateNewScheme(); } this.SetCaretIndex(); base.OnPreviewMouseDown(args); }
protected override void OnPreviewKeyDown(KeyEventArgs args) { if (args != null && args.Key != Key.Escape) { if (this.IMActionItems != null && this.IMActionItems.Any <IMActionItem>()) { foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems) { if (imActionItem.ActionItem.StartsWith("Key", StringComparison.InvariantCulture)) { if (imActionItem.IMAction.Type == KeyActionType.Tap || imActionItem.IMAction.Type == KeyActionType.TapRepeat || imActionItem.IMAction.Type == KeyActionType.Script) { if (args.Key == Key.Back || args.SystemKey == Key.Back) { this.Tag = (object)string.Empty; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + this.Tag?.ToString()); } else if (IMAPKeys.mDictKeys.ContainsKey(args.SystemKey) || IMAPKeys.mDictKeys.ContainsKey(args.Key)) { if (args.SystemKey == Key.LeftAlt || args.SystemKey == Key.RightAlt || args.SystemKey == Key.F10) { this.mKeyList.AddIfNotContain <Key>(args.SystemKey); } else if (args.KeyboardDevice.Modifiers != ModifierKeys.None) { if (args.KeyboardDevice.Modifiers == ModifierKeys.Alt) { this.mKeyList.AddIfNotContain <Key>(args.SystemKey); } else if (args.KeyboardDevice.Modifiers == (ModifierKeys.Alt | ModifierKeys.Shift)) { this.mKeyList.AddIfNotContain <Key>(args.SystemKey); } else { this.mKeyList.AddIfNotContain <Key>(args.Key); } } else { this.mKeyList.AddIfNotContain <Key>(args.Key); } } } else { if (args.Key == Key.System && IMAPKeys.mDictKeys.ContainsKey(args.SystemKey)) { this.Tag = (object)IMAPKeys.GetStringForFile(args.SystemKey); BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + IMAPKeys.GetStringForUI(args.SystemKey)); } else if (IMAPKeys.mDictKeys.ContainsKey(args.Key)) { this.Tag = (object)IMAPKeys.GetStringForFile(args.Key); BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + IMAPKeys.GetStringForUI(args.Key)); } else if (args.Key == Key.Back) { this.Tag = (object)string.Empty; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + string.Empty); } args.Handled = true; } } if (string.Equals(imActionItem.ActionItem, "GamepadStick", StringComparison.InvariantCulture)) { if (args.Key == Key.Back || args.Key == Key.Delete) { this.Tag = (object)string.Empty; BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + string.Empty); } args.Handled = true; } if (this.PropertyType.Equals(typeof(bool))) { bool flag = !Convert.ToBoolean(imActionItem.IMAction[imActionItem.ActionItem], (IFormatProvider)CultureInfo.InvariantCulture); this.Tag = (object)flag; IMapTextBox.Setvalue(imActionItem, flag.ToString((IFormatProvider)CultureInfo.InvariantCulture)); BlueStacksUIBinding.Bind((TextBox)this, Constants.ImapLocaleStringsConstant + this.Tag?.ToString()); if (imActionItem.IMAction.Type == KeyActionType.EdgeScroll && imActionItem.ActionItem.Equals("EdgeScrollEnabled", StringComparison.InvariantCultureIgnoreCase)) { KMManager.AssignEdgeScrollMode(flag.ToString((IFormatProvider)CultureInfo.InvariantCulture), (TextBox)this); } args.Handled = true; } } } this.Focus(); args.Handled = true; } if (this.PropertyType.Equals(typeof(bool))) { KMManager.CheckAndCreateNewScheme(); } this.SetCaretIndex(); base.OnPreviewKeyDown(args); }