예제 #1
0
        private void OnDecrease(object sender, RoutedEventArgs e)
        {
            string s = this.Text.Replace(',', '.');
            double result1;

            if ((object)this.PropertyType == (object)typeof(double) && double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, (IFormatProvider)NumberFormatInfo.InvariantInfo, out result1) && result1 > 0.0)
            {
                if (this.CanDecrease(result1, 0.05))
                {
                    this.Text = (result1 - 0.05).ToString((IFormatProvider)CultureInfo.CurrentCulture);
                    KMManager.CheckAndCreateNewScheme();
                }
            }
            else
            {
                int result2;
                if ((object)this.PropertyType == (object)typeof(int) && int.TryParse(s, out result2) && (result2 > 0 && this.CanDecrease((double)result2, 1.0)))
                {
                    --result2;
                    this.Text = result2.ToString((IFormatProvider)CultureInfo.CurrentCulture);
                    KMManager.CheckAndCreateNewScheme();
                }
            }
            foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems)
            {
                this.SetValueHandling(imActionItem);
            }
        }
예제 #2
0
 private void GameGuide_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (!this.ParentWindow.mCommonHandler.ToggleGamepadAndKeyboardGuidance("gamepad", false))
     {
         KMManager.HandleInputMapperWindow(this.ParentWindow, "gamepad");
     }
     ClientStats.SendMiscellaneousStatsAsync("topbar", RegistryManager.Instance.UserGuid, "gameGuide", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab?.PackageName, (string)null, "Android");
 }
예제 #3
0
 private void OpenGameGuide()
 {
     BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)MainWindow.SettingsWindow);
     if (!this.mParentWindow.mCommonHandler.ToggleGamepadAndKeyboardGuidance("gamepad", false))
     {
         KMManager.HandleInputMapperWindow(this.mParentWindow, "gamepad");
     }
     ClientStats.SendMiscellaneousStatsAsync("game_setting", RegistryManager.Instance.UserGuid, "gameGuide", "MouseClick", RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, RegistryManager.Instance.Oem, this.PackageName, (string)null, "Android");
 }
예제 #4
0
 private void Canvas_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (CanvasElement.sFocusedTextBox != null)
     {
         WpfUtils.FindVisualParent <CanvasElement>(CanvasElement.sFocusedTextBox as DependencyObject).TxtBox_LostFocus(CanvasElement.sFocusedTextBox, new RoutedEventArgs());
     }
     else
     {
         if (double.IsNaN(this.CanvasWindowLeft) && double.IsNaN(this.CanvasWindowTop))
         {
             this.CanvasWindowLeft     = this.Left;
             this.CanvasWindowTop      = this.Top;
             this.mMousePointForNewTap = Mouse.GetPosition((IInputElement)this.mCanvas);
         }
         KeymapCanvasWindow.sIsDirty = true;
         try
         {
             this.DragMove();
         }
         catch (Exception ex)
         {
         }
         if (Math.Abs(this.CanvasWindowLeft - this.Left) < 2.0 && Math.Abs(this.CanvasWindowTop - this.Top) < 2.0)
         {
             if (KMManager.sIsInScriptEditingMode && this.mIsExtraSettingsPopupOpened)
             {
                 return;
             }
             Tap tap = new Tap();
             tap.Type = KeyActionType.Tap;
             IMAction imAction = (IMAction)tap;
             if (this.ParentWindow.SelectedConfig.ControlSchemes.Count == 0 && CanvasElement.sFocusedTextBox != null)
             {
                 WpfUtils.FindVisualParent <CanvasElement>(CanvasElement.sFocusedTextBox as DependencyObject).TxtBox_LostFocus(CanvasElement.sFocusedTextBox, new RoutedEventArgs());
             }
             else
             {
                 if (this.ParentWindow.SelectedConfig.ControlSchemes.Count == 0)
                 {
                     KMManager.AddNewControlSchemeAndSelect(this.ParentWindow, (IMControlScheme)null, false);
                 }
                 else if (this.ParentWindow.SelectedConfig.SelectedControlScheme.BuiltIn)
                 {
                     KMManager.CheckAndCreateNewScheme();
                 }
                 this.ParentWindow.SelectedConfig.SelectedControlScheme.GameControls.Add(imAction);
                 List <CanvasElement> source = this.AddCanvasElementsForAction(imAction, false);
                 source.First <CanvasElement>().SetMousePoint(this.mMousePointForNewTap);
                 source.First <CanvasElement>().IsRemoveIfEmpty = true;
                 source.First <CanvasElement>().ShowTextBox((object)source.First <CanvasElement>().dictTextElemets.First <KeyValuePair <Positions, BlueStacks.Common.Tuple <string, TextBox, TextBlock, List <IMAction> > > >().Value.Item3);
             }
         }
         this.CanvasWindowLeft = double.NaN;
         this.CanvasWindowTop  = double.NaN;
     }
 }
예제 #5
0
 private void mKeyTextBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (!this.IsLoaded)
     {
         return;
     }
     KMManager.sGamepadDualTextbox = this;
     KMManager.pressedGamepadKeyList.Clear();
     KMManager.CallGamepadHandler(this.ParentWindow, "true");
 }
 private void TranslucentControlsButton_PreviewMouseLeftButtonUp(
     object sender,
     MouseButtonEventArgs e)
 {
     RegistryManager.Instance.ShowKeyControlsOverlay        = true;
     RegistryManager.Instance.OverlayAvailablePromptEnabled = false;
     KMManager.ShowOverlayWindow(this.ParentWindow, true, true);
     this.mChangeTransparencyPopup.PlacementTarget = (UIElement)this.mTranslucentControlsButtonFullScreen;
     this.mChangeTransparencyPopup.IsOpen          = true;
 }
예제 #7
0
 private void Canvas_MouseEnter(object sender, MouseEventArgs e)
 {
     if (!KMManager.IsDragging)
     {
         return;
     }
     this.isNewElementAdded      = true;
     KeymapCanvasWindow.sIsDirty = true;
     this.AddNewCanvasElement(KMManager.ClearElement(), false);
     this.StartMoving(this.mCanvasElement, e.GetPosition((IInputElement)this));
 }
예제 #8
0
 private void ResizeIcon_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     KMManager.CheckAndCreateNewScheme();
     this.mCanvasElement = WpfUtils.FindVisualParent <CanvasElement>(sender as DependencyObject);
     this.mCanvasElement.mResizeIcon.Focus();
     this.startPoint = e.GetPosition((IInputElement)this);
     this.mCanvas.PreviewMouseMove += new MouseEventHandler(this.CanvasResizeExistingElement_MouseMove);
     KeymapCanvasWindow.sIsDirty    = true;
     e.Handled = true;
     Mouse.Capture((IInputElement)this.mCanvas);
 }
예제 #9
0
 internal void ReloadCanvasWindow()
 {
     this.mCurrentTapElementDisplayRow = 0;
     this.mCurrentTapElementDisplayCol = 0;
     if (this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab != null)
     {
         KMManager.LoadIMActions(this.ParentWindow, this.ParentWindow.mTopBar.mAppTabButtons.SelectedTab.PackageName);
     }
     this.mCanvas.Children.Clear();
     this.Init();
 }
예제 #10
0
 protected override void OnGotFocus(RoutedEventArgs e)
 {
     base.OnGotFocus(e);
     KMManager.CurrentIMapTextBox = this;
     KMManager.pressedGamepadKeyList.Clear();
     KMManager.CallGamepadHandler(BlueStacksUIUtils.LastActivatedWindow, "true");
     this.TextChanged       -= new TextChangedEventHandler(this.IMapTextBox_TextChanged);
     this.TextChanged       += new TextChangedEventHandler(this.IMapTextBox_TextChanged);
     this.PreviewMouseWheel -= new MouseWheelEventHandler(this.IMapTextBox_PreviewMouseWheel);
     this.PreviewMouseWheel += new MouseWheelEventHandler(this.IMapTextBox_PreviewMouseWheel);
     this.SetCaretIndex();
 }
 private void SetStopMobaDpadValue(bool isChecked)
 {
     this.mCanvasElement.MOBASkillSettingsMoreInfoPopup.IsOpen = false;
     this.mCanvasElement.MOBAOtherSettingsMoreInfoPopup.IsOpen = false;
     KMManager.CheckAndCreateNewScheme();
     this.mStopMovementCheckbox.IsChecked = new bool?(isChecked);
     if (this.mCanvasElement.ListActionItem.First <IMAction>().Type == KeyActionType.MOBASkill)
     {
         ((MOBASkill)this.mCanvasElement.ListActionItem.First <IMAction>()).StopMOBADpad = isChecked;
     }
     KeymapCanvasWindow.sIsDirty = true;
 }
예제 #12
0
 private void IMapTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (this.IMActionItems != null && this.IMActionItems.Any <IMActionItem>())
     {
         foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems)
         {
             this.SetValueHandling(imActionItem);
         }
         KMManager.CheckAndCreateNewScheme();
     }
     this.SetCaretIndex();
 }
예제 #13
0
 private void UserControl_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (!(this.mPictureBox.ImageName == "radio_unselected"))
     {
         return;
     }
     foreach (SchemeBookmarkControl child in this.mParentWindow.mSidebar.mBookmarkedSchemesStackPanel.Children)
     {
         child.mPictureBox.ImageName = "radio_unselected";
     }
     this.mPictureBox.ImageName = "radio_selected";
     KMManager.SelectSchemeIfPresent(this.mParentWindow, this.mSchemeName.Text, "bookmark", true);
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is IEnumerable <string> strings))
            {
                return((object)string.Empty);
            }
            List <string> stringList = new List <string>();

            foreach (string text in strings)
            {
                stringList.Add(KMManager.GetKeyUIValue(text));
            }
            return((object)string.Join(" / ", stringList.ToArray()));
        }
예제 #15
0
        private void CreateGameControlCopy(IMAction originalAction, Point point, bool isNewScheme = true)
        {
            IMAction imAction = originalAction.DeepCopy <IMAction>();

            imAction.PositionX = originalAction.PositionX + 1.0;
            List <CanvasElement> source = this.AddCanvasElementsForAction(imAction, false);

            if (isNewScheme)
            {
                KMManager.CheckAndCreateNewScheme();
            }
            this.ParentWindow.SelectedConfig.SelectedControlScheme.GameControls.Add(imAction);
            this.StartMoving(source.First <CanvasElement>(), point);
        }
예제 #16
0
 protected override void OnPreviewTextInput(TextCompositionEventArgs args)
 {
     if (args != null)
     {
         string s;
         if (this.SelectionLength > 0)
         {
             StringBuilder stringBuilder = new StringBuilder(this.Text);
             stringBuilder.Remove(this.SelectionStart, this.SelectionLength);
             stringBuilder.Insert(this.SelectionStart, args.Text);
             s = stringBuilder.ToString();
         }
         else
         {
             s = this.Text.Insert(this.SelectionStart, args.Text);
         }
         if ((object)this.PropertyType == (object)typeof(int))
         {
             int result;
             args.Handled = !int.TryParse(s, out result) || (double)result <this.MinValue || (double)result> this.MaxValue;
         }
         else if ((object)this.PropertyType == (object)typeof(double))
         {
             string str = s.Replace(',', '.');
             double result;
             if (double.TryParse(str, NumberStyles.Float | NumberStyles.AllowThousands, (IFormatProvider)NumberFormatInfo.InvariantInfo, out result))
             {
                 args.Handled = this.MinValue > result || result > this.MaxValue;
             }
             else
             {
                 if (string.Equals(str, ".", StringComparison.InvariantCultureIgnoreCase))
                 {
                     this.Text = "0.";
                     KMManager.CheckAndCreateNewScheme();
                     if (this.IMActionItems != null && this.IMActionItems.Any <IMActionItem>())
                     {
                         foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems)
                         {
                             this.SetValueHandling(imActionItem);
                         }
                     }
                     this.CaretIndex = this.Text.Length;
                 }
                 args.Handled = true;
             }
         }
     }
     base.OnPreviewTextInput(args);
 }
예제 #17
0
        internal void ImportSchemes(
            List <IMControlScheme> toCopyFromSchemes,
            Dictionary <string, Dictionary <string, string> > stringsToImport)
        {
            bool flag1 = false;
            bool flag2 = false;

            KMManager.MergeConflictingGuidanceStrings(this.ParentWindow.SelectedConfig, toCopyFromSchemes, stringsToImport);
            if (this.ParentWindow.SelectedConfig.ControlSchemes.Count > 0)
            {
                flag1 = true;
            }
            foreach (IMControlScheme toCopyFromScheme in toCopyFromSchemes)
            {
                IMControlScheme imControlScheme = toCopyFromScheme.DeepCopy();
                if (flag1)
                {
                    imControlScheme.Selected = false;
                }
                imControlScheme.BuiltIn      = false;
                imControlScheme.IsBookMarked = false;
                this.CanvasWindow.SidebarWindow.mSchemeComboBox.mName.Text = imControlScheme.Name;
                this.ParentWindow.SelectedConfig.ControlSchemes.Add(imControlScheme);
                this.ParentWindow.SelectedConfig.ControlSchemesDict.Add(imControlScheme.Name, imControlScheme);
                ComboBoxSchemeControl boxSchemeControl = new ComboBoxSchemeControl(this.CanvasWindow, this.ParentWindow);
                boxSchemeControl.mSchemeName.Text = LocaleStrings.GetLocalizedString(imControlScheme.Name, "");
                boxSchemeControl.IsEnabled        = true;
                BlueStacksUIBinding.BindColor((DependencyObject)boxSchemeControl, Control.BackgroundProperty, "ComboBoxBackgroundColor");
                this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children.Add((UIElement)boxSchemeControl);
            }
            if (flag1)
            {
                return;
            }
            foreach (IMControlScheme controlScheme in this.ParentWindow.SelectedConfig.ControlSchemes)
            {
                if (controlScheme.Selected)
                {
                    flag2 = true;
                    break;
                }
            }
            if (flag2)
            {
                return;
            }
            this.ParentWindow.SelectedConfig.ControlSchemes[0].Selected = true;
        }
예제 #18
0
 private void Image_PreviewMouseUp(object sender, MouseButtonEventArgs e)
 {
     this.mouseReleasedPosition = new Point?(e.GetPosition((IInputElement)this));
     if (this.mousePressedPosition.Equals((object)this.mouseReleasedPosition))
     {
         EventHandler tap = this.Tap;
         if (tap != null)
         {
             tap((object)this, (EventArgs)null);
         }
     }
     else
     {
         KMManager.ClearElement();
     }
     this.ReatchedMouseMove();
 }
 private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     KMManager.ChangeTransparency(this.ParentWindow, this.transSlider.Value);
     if (this.transSlider.Value == 0.0)
     {
         if (!RegistryManager.Instance.ShowKeyControlsOverlay)
         {
             KMManager.ShowOverlayWindow(this.ParentWindow, false, false);
         }
         this.ParentWindow.mCommonHandler.OnOverlayStateChanged(false);
     }
     else
     {
         KMManager.ShowOverlayWindow(this.ParentWindow, true, false);
         this.ParentWindow.mCommonHandler.OnOverlayStateChanged(true);
     }
     this.lastSliderValue = this.transSlider.Value;
 }
        private void CopyImg_MouseDown(object sender, MouseButtonEventArgs e)
        {
            bool flag = false;

            foreach (ComboBoxSchemeControl child in this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children)
            {
                if (!child.mSchemeName.IsReadOnly)
                {
                    this.HandleNameEdit(child);
                    flag      = true;
                    e.Handled = true;
                    break;
                }
            }
            if (!flag)
            {
                KMManager.AddNewControlSchemeAndSelect(this.ParentWindow, this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text], true);
            }
            e.Handled = true;
        }
예제 #21
0
 private void KeyTextBox_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (this.ActionItemProperty.StartsWith("Key", StringComparison.InvariantCultureIgnoreCase))
     {
         if (e.MiddleButton == MouseButtonState.Pressed)
         {
             e.Handled            = true;
             this.mKeyTextBox.Tag = (object)"MouseMButton";
             BlueStacksUIBinding.Bind(this.mKeyTextBox, Constants.ImapLocaleStringsConstant + "MouseMButton");
         }
         else if (e.RightButton == MouseButtonState.Pressed)
         {
             e.Handled            = true;
             this.mKeyTextBox.Tag = (object)"MouseRButton";
             BlueStacksUIBinding.Bind(this.mKeyTextBox, Constants.ImapLocaleStringsConstant + "MouseRButton");
         }
         else if (e.XButton1 == MouseButtonState.Pressed)
         {
             e.Handled            = true;
             this.mKeyTextBox.Tag = (object)"MouseXButton1";
             BlueStacksUIBinding.Bind(this.mKeyTextBox, Constants.ImapLocaleStringsConstant + "MouseXButton1");
         }
         else if (e.XButton2 == MouseButtonState.Pressed)
         {
             e.Handled            = true;
             this.mKeyTextBox.Tag = (object)"MouseXButton2";
             BlueStacksUIBinding.Bind(this.mKeyTextBox, Constants.ImapLocaleStringsConstant + "MouseXButton2");
         }
     }
     if (!this.PropertyType.Equals(typeof(bool)))
     {
         return;
     }
     this.mKeyTextBox.Tag = (object)!Convert.ToBoolean(this.lstActionItem.First <IMAction>()[this.ActionItemProperty], (IFormatProvider)CultureInfo.InvariantCulture);
     BlueStacksUIBinding.Bind(this.mKeyTextBox, Constants.ImapLocaleStringsConstant + this.mKeyTextBox.Tag?.ToString());
     if (this.lstActionItem.First <IMAction>().Type != KeyActionType.EdgeScroll || !this.ActionItemProperty.Equals("EdgeScrollEnabled", StringComparison.InvariantCultureIgnoreCase))
     {
         return;
     }
     KMManager.AssignEdgeScrollMode(this.mKeyTextBox.Tag.ToString(), this.mKeyTextBox);
 }
        private void DeleteControlScheme()
        {
            if (!this.ParentWindow.SelectedConfig.ControlSchemesDict.ContainsKey(this.mSchemeName.Text) || this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text].BuiltIn)
            {
                return;
            }
            if (this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text].Selected)
            {
                this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text].Selected = false;
                if (this.ParentWindow.SelectedConfig.ControlSchemes.Count > 1)
                {
                    this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem = !(this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem == (this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children[0] as ComboBoxSchemeControl).mSchemeName.Text.ToString((IFormatProvider)CultureInfo.InvariantCulture)) ? (this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children[0] as ComboBoxSchemeControl).mSchemeName.Text.ToString((IFormatProvider)CultureInfo.InvariantCulture) : (this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children[1] as ComboBoxSchemeControl).mSchemeName.Text.ToString((IFormatProvider)CultureInfo.InvariantCulture);
                    this.ParentWindow.SelectedConfig.ControlSchemesDict[this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem].Selected = true;
                    this.CanvasWindow.SidebarWindow.mSchemeComboBox.mName.Text = this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem;
                    this.ParentWindow.SelectedConfig.SelectedControlScheme     = this.ParentWindow.SelectedConfig.ControlSchemesDict[this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem];
                    this.CanvasWindow.SidebarWindow.ProfileChanged();
                }
                else
                {
                    this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem = (string)null;
                    BlueStacksUIBinding.Bind(this.CanvasWindow.SidebarWindow.mSchemeComboBox.mName, "Custom", "");
                }
            }
            this.ParentWindow.SelectedConfig.ControlSchemes.Remove(this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text]);
            this.ParentWindow.SelectedConfig.ControlSchemesDict.Remove(this.mSchemeName.Text);
            ComboBoxSchemeControl schemeControlFromName = KMManager.GetComboBoxSchemeControlFromName(this.mSchemeName.Text);

            if (schemeControlFromName != null)
            {
                this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children.Remove((UIElement)schemeControlFromName);
            }
            KeymapCanvasWindow.sIsDirty = true;
            this.CanvasWindow.SidebarWindow.FillProfileCombo();
            if (this.ParentWindow.SelectedConfig.ControlSchemes.Count != 0)
            {
                return;
            }
            this.CanvasWindow.ClearWindow();
        }
예제 #23
0
 internal void AppUninstalled(string package)
 {
     this.ParentWindow.mWelcomeTab.mHomeAppManager.RemoveAppAfterUninstall(package);
     this.ParentWindow.mTopBar.mAppTabButtons.CloseTab(package, false, false, true, false, "");
     if (!AppConfigurationManager.Instance.VmAppConfig[this.ParentWindow.mVmName].ContainsKey(package))
     {
         return;
     }
     if (AppConfigurationManager.Instance.VmAppConfig[this.ParentWindow.mVmName][package].IsForcedLandscapeEnabled)
     {
         Utils.SetCustomAppSize(this.ParentWindow.mVmName, package, ScreenMode.original);
         KMManager.SelectSchemeIfPresent(this.ParentWindow, "Portrait", "appuninstalled", false);
         AppConfigurationManager.Instance.VmAppConfig[this.ParentWindow.mVmName][package].IsForcedLandscapeEnabled = false;
     }
     if (!AppConfigurationManager.Instance.VmAppConfig[this.ParentWindow.mVmName][package].IsForcedPortraitEnabled)
     {
         return;
     }
     Utils.SetCustomAppSize(this.ParentWindow.mVmName, package, ScreenMode.original);
     KMManager.SelectSchemeIfPresent(this.ParentWindow, "Landscape", "appuninstalled", false);
     AppConfigurationManager.Instance.VmAppConfig[this.ParentWindow.mVmName][package].IsForcedPortraitEnabled = false;
 }
        private void ComboBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
        {
            bool flag = false;

            foreach (ComboBoxSchemeControl child in this.CanvasWindow.SidebarWindow.mSchemeComboBox.Items.Children)
            {
                if (!child.mSchemeName.IsReadOnly)
                {
                    this.HandleNameEdit(child);
                    flag      = true;
                    e.Handled = true;
                    break;
                }
            }
            if (flag)
            {
                return;
            }
            if (this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem == this.mSchemeName.Text)
            {
                this.CanvasWindow.SidebarWindow.mSchemeComboBox.mItems.IsOpen = false;
            }
            else
            {
                if (this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem != null)
                {
                    this.ParentWindow.SelectedConfig.ControlSchemesDict[this.CanvasWindow.SidebarWindow.mSchemeComboBox.SelectedItem].Selected = false;
                }
                this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text].Selected = true;
                this.ParentWindow.SelectedConfig.ControlSchemesDict[this.ParentWindow.SelectedConfig.SelectedControlScheme.Name].Selected = false;
                this.ParentWindow.SelectedConfig.SelectedControlScheme = this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text];
                this.CanvasWindow.SidebarWindow.FillProfileCombo();
                this.CanvasWindow.SidebarWindow.ProfileChanged();
                this.CanvasWindow.SidebarWindow.mSchemeComboBox.mItems.IsOpen = false;
                KeymapCanvasWindow.sIsDirty = true;
                KMManager.SendSchemeChangedStats(this.ParentWindow, "controls_editor");
            }
        }
        internal void Init()
        {
            try
            {
                this.mNumberOfSchemesSelectedForExport = 0;
                this.ParentWindow.OriginalLoadedConfig.ControlSchemes.Where <IMControlScheme>((Func <IMControlScheme, bool>)(scheme => scheme.BuiltIn)).ToList <IMControlScheme>().ForEach((System.Action <IMControlScheme>)(scheme => AddSchemeToExportCheckbox(scheme)));
                this.ParentWindow.OriginalLoadedConfig.ControlSchemes.Where <IMControlScheme>((Func <IMControlScheme, bool>)(scheme => !scheme.BuiltIn)).ToList <IMControlScheme>().ForEach((System.Action <IMControlScheme>)(scheme =>
                {
                    if (this.dict.Keys.Contains <string>(scheme.Name.ToLower(CultureInfo.InvariantCulture).Trim()))
                    {
                        scheme.Name += " (Edited)";
                        scheme.Name  = KMManager.GetUniqueName(scheme.Name, (IEnumerable <string>) this.ParentWindow.OriginalLoadedConfig.ControlSchemesDict.Keys);
                    }
                    AddSchemeToExportCheckbox(scheme);
                }));
            }
            catch (Exception ex)
            {
                Logger.Error("Error in export window init err: " + ex.ToString());
            }

            void AddSchemeToExportCheckbox(IMControlScheme scheme)
            {
                this.dict.Add(scheme.Name.ToLower(CultureInfo.InvariantCulture).Trim(), scheme);
                CustomCheckbox customCheckbox1 = new CustomCheckbox();

                customCheckbox1.Content      = (object)scheme.Name;
                customCheckbox1.TextFontSize = 14.0;
                customCheckbox1.ImageMargin  = new Thickness(2.0);
                customCheckbox1.Margin       = new Thickness(0.0, 1.0, 0.0, 1.0);
                customCheckbox1.MaxHeight    = 20.0;
                CustomCheckbox customCheckbox2 = customCheckbox1;

                customCheckbox2.Checked   += new RoutedEventHandler(this.Box_Checked);
                customCheckbox2.Unchecked += new RoutedEventHandler(this.Box_Unchecked);
                this.mSchemesStackPanel.Children.Add((UIElement)customCheckbox2);
            }
        }
예제 #26
0
 protected override void OnKeyUp(KeyEventArgs args)
 {
     if (args != null)
     {
         if (this.IMActionItems != null && this.IMActionItems.Any <IMActionItem>())
         {
             foreach (IMActionItem imActionItem in (Collection <IMActionItem>) this.IMActionItems)
             {
                 if (imActionItem.IMAction.Type == KeyActionType.Tap || imActionItem.IMAction.Type == KeyActionType.TapRepeat || imActionItem.IMAction.Type == KeyActionType.Script)
                 {
                     if (this.mKeyList.Count >= 2)
                     {
                         string str = IMAPKeys.GetStringForUI(this.mKeyList.ElementAt <Key>(this.mKeyList.Count - 2)) + " + " + IMAPKeys.GetStringForUI(this.mKeyList.ElementAt <Key>(this.mKeyList.Count - 1));
                         this.Tag  = (object)(IMAPKeys.GetStringForFile(this.mKeyList.ElementAt <Key>(this.mKeyList.Count - 2)) + " + " + IMAPKeys.GetStringForFile(this.mKeyList.ElementAt <Key>(this.mKeyList.Count - 1)));
                         this.Text = str;
                         this.SetValueHandling(imActionItem);
                     }
                     else if (this.mKeyList.Count == 1)
                     {
                         string stringForUi = IMAPKeys.GetStringForUI(this.mKeyList.ElementAt <Key>(0));
                         this.Tag  = (object)IMAPKeys.GetStringForFile(this.mKeyList.ElementAt <Key>(0));
                         this.Text = stringForUi;
                         this.SetValueHandling(imActionItem);
                     }
                     this.mKeyList.Clear();
                 }
             }
         }
         args.Handled = true;
     }
     if (this.PropertyType.Equals(typeof(bool)))
     {
         KMManager.CheckAndCreateNewScheme();
     }
     this.SetCaretIndex();
     base.OnKeyUp(args);
 }
예제 #27
0
        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);
        }
예제 #28
0
 private void CanvasMoveExistingElement_MouseMove(object sender, MouseEventArgs e)
 {
     KMManager.CheckAndCreateNewScheme();
     this.Focus();
     this.MoveElement(e.GetPosition((IInputElement)this));
 }
예제 #29
0
 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);
 }
예제 #30
0
 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);
 }