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; } }
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; }
private void NewProfile_MouseDown(object sender, MouseButtonEventArgs e) { KMManager.AddNewControlSchemeAndSelect(BlueStacksUIUtils.LastActivatedWindow, (IMControlScheme)null, true); KMManager.CanvasWindow.ClearWindow(); }