public XnaInputManager(Game game, Core.IO.IGameDescriptor gameDesc) { _game = game; _width = gameDesc.Width; _height = gameDesc.Height; _window = game.Window; _mousePosition = new Core.Graphics.Point(); TouchPanel.EnableMouseGestures = true; TouchPanel.EnabledGestures = GestureType.Hold | GestureType.Tap; TouchPanel.EnableMouseTouchPoint = true; #if WINDOWS_UWP var view = SystemNavigationManager.GetForCurrentView(); view.BackRequested += HardwareButtons_BackPressed; bool isHardwareButtonsApiPresent = Windows.Foundation.Metadata.ApiInformation.IsTypePresent (typeof(Windows.Phone.UI.Input.HardwareButtons).FullName); if (isHardwareButtonsApiPresent) { Windows.Phone.UI.Input.HardwareButtons.CameraPressed += HardwareButtons_CameraPressed; } _inputPane = InputPane.GetForCurrentView(); _currentWindow = CoreWindow.GetForCurrentThread(); _currentWindow.KeyDown += XnaInputManager_KeyDown; _currentWindow.KeyUp += XnaInputManager_KeyUp; #endif }
public void Attach(DependencyObject associatedObject) { if ((associatedObject != AssociatedObject) && !DesignMode.DesignModeEnabled) { if (AssociatedObject != null) throw new InvalidOperationException("Cannot attach behavior multiple times."); AssociatedObject = associatedObject; var control = AssociatedObject as FrameworkElement; if (control == null) { throw new InvalidOperationException("Cannot attach behavior you must have Control."); } popupInputPane = InputPane.GetForCurrentView(); popupInputPane.Showing += popupInputPane_Showing; popupInputPane.Hiding += popupInputPane_Hiding; Window.Current.SizeChanged += Current_SizeChanged; var popup = ((FrameworkElement) AssociatedObject).Parent as Popup; if (popup == null) return; //키보드가 보인다는 이야기 orignalRect = new Rect { X = popup.HorizontalOffset, Y = popup.VerticalOffset, Width = ((FrameworkElement) AssociatedObject).Width, Height = ((FrameworkElement) AssociatedObject).Height }; resizePopup(); } }
private void HidingHandler(InputPane sender, InputPaneVisibilityEventArgs e) { if (hidingHandlerDelegate != null) { hidingHandlerDelegate(sender, e); } lastFocusedElement = null; }
private void ShowingHandler(InputPane sender, InputPaneVisibilityEventArgs e) { if (lastFocusedElement != null && handlerMap.Count > 0) { handlerMap[lastFocusedElement](lastFocusedElement, e); } lastFocusedElement = null; }
private void InputPane_Hiding(InputPane sender, InputPaneVisibilityEventArgs args) { if (MainGrid.RowDefinitions != null && MainGrid.RowDefinitions.Count > 1) { MainGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star); MainGrid.InvalidateArrange(); } }
private void OnInputPaneHiding(Windows.UI.ViewManagement.InputPane sender, Windows.UI.ViewManagement.InputPaneVisibilityEventArgs args) { // if the ihm occluded something and we had to move, we need to adjust back if (_ihmFocusMoved) { _hostPopup.VerticalOffset += _ihmOccludeHeight; // ensure defaults back to normal _ihmFocusMoved = false; } }
private void InputPane_Showing(InputPane sender, InputPaneVisibilityEventArgs args) { Rect coveredArea = sender.OccludedRect; if (MainGrid.RowDefinitions != null && MainGrid.RowDefinitions.Count > 1) { MainGrid.RowDefinitions[1].Height = new GridLength(InstantMessagingHistory.ActualHeight - coveredArea.Height); MainGrid.InvalidateArrange(); } }
public void Detach() { if (AssociatedObject != null) { Window.Current.SizeChanged -= Current_SizeChanged; popupInputPane.Showing -= popupInputPane_Showing; popupInputPane.Hiding -= popupInputPane_Hiding; } AssociatedObject = null; popupInputPane = null; }
/// <summary> /// Inputs the pane_ hiding. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="InputPaneVisibilityEventArgs"/> instance containing the event data.</param> void InputPane_Hiding(Windows.UI.ViewManagement.InputPane sender, InputPaneVisibilityEventArgs args) { inputPaneGrid.Height = 0; if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons") && !sender.Visible) { ribbon.HideRibbonTabPanel(); SetReadOnlyForRichTextBox(true); richTextBox.PageFitCommand.Execute(PageFitType.FitPageWidth); ZoomFactor = richTextBox.ZoomFactor; } }
public ProductsItemPage() : base() { this.InitializeComponent(); unitsComboBox.ItemsSource = Enum.GetValues(typeof(UnitOfMeasurement)); ingredientComboBox.ItemsSource = App.DataModel.Ingredients; _inputPane = InputPane.GetForCurrentView(); _inputPane.Showing += _inputPane_Showing; _inputPane.Hiding += _inputPane_Hiding; ingredientsPivotItem.Tag = PivotItemType.Ingredients; informationPivotItem.Tag = PivotItemType.Information; }
void input_Showing(InputPane sender, InputPaneVisibilityEventArgs e) { inputPaneHeight = Window.Current.Content.RenderSize.Height - (AppBar1.IsOpen ? AppBar1.ActualHeight : 0) - saveFeedPage.ActualHeight - e.OccludedRect.Height; //Storyboard sb = new Storyboard(); //DoubleAnimation an = new DoubleAnimation(); //an.Duration = TimeSpan.FromMilliseconds(733); //an.From = saveFeedPagePop.VerticalOffset; //an.To = inputPaneHeight; //sb.Children.Add(an); //Storyboard.SetTarget(an, this.saveFeedPagePop); //Storyboard.SetTargetProperty(an, "VerticalOffset"); //sb.Begin(); saveFeedPagePop.VerticalOffset = inputPaneHeight; }
public IngredientsItemPage() : base() { this.InitializeComponent(); unitsComboBox.ItemsSource = Enum.GetValues(typeof(UnitOfMeasurement)); _inputControls = new List<Control>() { titleTextBox, countTextBox, priceTextBox }; _inputPane = InputPane.GetForCurrentView(); _inputPane.Showing += inputPane_Showing; _inputPane.Hiding += IngredientsItemPage_Hiding; }
private void control_Loaded(object sender, RoutedEventArgs e) { // Register for keyboard events Window.Current.CoreWindow.KeyDown += KeyDown_UIThread; #if WINDOWS_PHONE_APP || WINDOWS_UWP var keyboardCaps = new Windows.Devices.Input.KeyboardCapabilities(); if (keyboardCaps.KeyboardPresent == 0) { // If we don't have a keyboard show the input pane (aka the on-screen keyboard). inputPane = InputPane.GetForCurrentView(); inputPane.TryShow(); inputPane.Showing += inputPane_Showing; inputPane.Hiding += inputPane_Hiding; } #endif }
private void InputPane_Showing(InputPane sender, InputPaneVisibilityEventArgs args) { if (Visibility != Visibility.Visible) return; Rect coveredArea = sender.OccludedRect; var value = MainGrid.ActualHeight - coveredArea.Height; if (MainGrid.RowDefinitions != null && MainGrid.RowDefinitions.Count >= 1 && coveredArea.Height > 0 && value > 0) { MainGrid.RowDefinitions[0].Height = new GridLength(value); MainGrid.InvalidateArrange(); } args.EnsuredFocusedElementInView = true; }
private void OnInputPaneShowing(Windows.UI.ViewManagement.InputPane sender, Windows.UI.ViewManagement.InputPaneVisibilityEventArgs args) { FrameworkElement focusedItem = FocusManager.GetFocusedElement() as FrameworkElement; if (focusedItem != null) { // if the focused item is within height - occludedrect height - buffer(50) // then it doesn't need to be changed GeneralTransform gt = focusedItem.TransformToVisual(Window.Current.Content); Point focusedPoint = gt.TransformPoint(new Point(0.0, 0.0)); if (focusedPoint.Y > (_windowBounds.Height - args.OccludedRect.Height - 50)) { _ihmFocusMoved = true; _ihmOccludeHeight = args.OccludedRect.Height; _hostPopup.VerticalOffset -= (int)args.OccludedRect.Height; } } }
/// <summary> /// Initializes a new instance of the <see cref="DocumentEditor"/> class. /// </summary> public DocumentEditor() { this.InitializeComponent(); Stream inputStream = GetManifestResourceStream("GettingStarted.docx"); this.Loaded += DocumentEditor_Loaded; this.Unloaded += DocumentEditor_Unloaded; this.richTextBox.SelectionChanged += RichTextBox_SelectionChanged; this.richTextBox.ContentChanged += RichTextBox_ContentChanged; this.richTextBox.RequestNavigate += RichTextBoxAdv_RequestNavigate; this.richTextBox.PrintCompleted += RichTextBoxAdv_PrintCompleted; if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { statusBar = StatusBar.GetForCurrentView(); inputPane = Windows.UI.ViewManagement.InputPane.GetForCurrentView(); HardwareButtons.BackPressed += HardwareButtons_BackPressed; richTextBox.IsTextPredictionEnabled = true; richTextBox.GripperSize = 16; richTextBox.GotFocus += RichTextBox_GotFocus; richTextBox.Tapped += RichTextBox_Tapped; richTextBox.ZoomFactorChanged += RichTextBox_ZoomFactorChanged; inputPane.Showing += InputPane_Showing; inputPane.Hiding += InputPane_Hiding; inputStream = GetManifestResourceStream("GettingStarted_Phone.docx"); ribbon.RibbonTabPanelOpened += Ribbon_RibbonTabPanelOpened; ribbon.RibbonTabPanelClosed += Ribbon_RibbonTabPanelClosed; } else { this.highlightcolorpicker.HighlightColorGridView.SetBinding(GridView.SelectedIndexProperty, new Binding() { Source = richTextBox, Path = new PropertyPath("Selection.CharacterFormat.HighlightColor"), Mode = BindingMode.TwoWay, Converter = new HighlightColorConverter() }); this.highlightcolorpicker.HighlightColorGridView.SelectionChanged += HighlightColorGridView_SelectionChanged; } ribbon.BackStageOpened += Ribbon_BackStageOpened; ribbon.BackStageClosed += Ribbon_BackStageClosed; //Adding the language dictionary to spellchecker. this.richTextBox.SpellChecker.Dictionaries.Add("ms-appx:///RTE/Assets/en_US.dic"); this.richTextBox.Load(inputStream, FormatType.Docx); this.richTextBox.DocumentTitle = "Getting Started"; }
/// <summary> /// Occurs when the input pane (on-screen keyboard) is about to be hidden by sliding out of view. /// </summary> /// <param name="sender">The event source.</param> /// <param name="e">The event data.</param> private void InputPaneHiding(InputPane sender, InputPaneVisibilityEventArgs e) { this.ContentGrid.VerticalAlignment = VerticalAlignment.Stretch; this.ContentGrid.Height = Double.NaN; // Be careful with this property. Once it has been set, the framework will not change // any layouts in response to the keyboard coming up e.EnsuredFocusedElementInView = true; }
private void InputDialod_Hiding(InputPane sender, InputPaneVisibilityEventArgs args) { TranslateStripeTo(0); }
// Adjust the name/password textboxes for the virtual keyuboard private void OnInputShowing(InputPane sender, InputPaneVisibilityEventArgs args) { var child = _popup.Child as FrameworkElement; if (child == null) return; var transform = _buttonPanel.TransformToVisual(child); var topLeft = transform.TransformPoint(new Point(0, 0)); // Need to be able to view the entire textblock (plus a little more) var buffer = 20; if ((topLeft.Y - buffer) > sender.OccludedRect.Top) { var margin = topLeft.Y - sender.OccludedRect.Top; margin -= buffer; child.Margin = new Thickness(0, -margin, 0, 0); } }
public async void Dispose() { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { statusBar.BackgroundOpacity = 0; this.statusBar = null; HardwareButtons.BackPressed -= HardwareButtons_BackPressed; this.inputPane.Showing -= InputPane_Showing; this.inputPane.Hiding -= InputPane_Hiding; this.inputPane = null; richTextBox.GotFocus -= RichTextBox_GotFocus; richTextBox.Tapped -= RichTextBox_Tapped; richTextBox.ZoomFactorChanged -= RichTextBox_ZoomFactorChanged; ribbon.RibbonTabPanelOpened -= Ribbon_RibbonTabPanelOpened; ribbon.RibbonTabPanelClosed -= Ribbon_RibbonTabPanelClosed; } ribbon.BackStageOpened -= Ribbon_BackStageOpened; ribbon.BackStageClosed -= Ribbon_BackStageClosed; this.Unloaded -= DocumentEditor_Unloaded; this.Loaded -= DocumentEditor_Loaded; if (highlightcolorpicker != null) { this.highlightcolorpicker.HighlightColorGridView.SelectionChanged -= HighlightColorGridView_SelectionChanged; this.highlightcolorpicker.HighlightColorGridView.SetBinding(GridView.SelectedIndexProperty, new Binding()); } this.highlightcolorpicker = null; //Handled to cancel the asynchronous load operation. if (loadAsync != null && !loadAsync.IsCompleted && !loadAsync.IsFaulted && cancellationTokenSource != null) { cancellationTokenSource.Cancel(); try { await loadAsync; } catch { } } this.richTextBox.PrintCompleted -= RichTextBoxAdv_PrintCompleted; this.richTextBox.RequestNavigate -= RichTextBoxAdv_RequestNavigate; this.richTextBox.SelectionChanged -= RichTextBox_SelectionChanged; this.richTextBox.ContentChanged -= RichTextBox_ContentChanged; //Disposes the SfRichTextBoxAdv contents explicitly. this.richTextBox.Dispose(); printDocumentSource = null; this.richTextBox = null; //Un hook backstage events if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { if (newBackStageTabItem != null) { //Clears the backstage tab item buttons. newDocument.Click -= BlankDocumentButton_Click; HelperMethods.DisposeButton(newDocument); newDocument = null; takeATour.Click -= TakeATourButton_Click; HelperMethods.DisposeButton(takeATour); takeATour = null; letter.Click -= LetterTemplateButton_Click; HelperMethods.DisposeButton(letter); letter = null; title.Click -= TitleTemplateButton_Click; HelperMethods.DisposeButton(title); title = null; fax.Click -= FaxTemplateButton_Click; HelperMethods.DisposeButton(fax); fax = null; toDoList.Click -= ToDoListTemplateButton_Click; HelperMethods.DisposeButton(toDoList); toDoList = null; } } printBackStageButton.Click -= PrintDocument_OnClick; printBackStageButton.Dispose(); openBackStageButton.Click -= WordImport_Click; openBackStageButton.Dispose(); openBackStageButton = null; saveAsBackStageButton.Click -= WordExport_Click; saveAsBackStageButton.Dispose(); saveAsBackStageButton = null; helpBackaStageButton.Click -= HelpButton_Clicked; helpBackaStageButton.Dispose(); helpBackaStageButton = null; exitBackStageButton.Click -= ExitButton_Click; exitBackStageButton.Dispose(); exitBackStageButton = null; //Disposing the BackStage this.ribbon.BackStage.Dispose(); //Disposing the QAT this.ribbon.QuickAccessToolBar.Dispose(); //Disposing the Ribbon. this.ribbon.Dispose(); //Disposing the RibbonPage if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { this.ribbonPage.Dispose(); } mainGrid.Resources.Clear(); mainGrid.Resources = null; this.Resources.Clear(); this.Resources = null; busy.ClearValue(ProgressBar.IsIndeterminateProperty); busy.ClearValue(ProgressBar.ForegroundProperty); busy.ClearValue(ProgressBar.VerticalAlignmentProperty); UnlinkChildrens(this); UnlinkChildrens(this.ribbon.BackStage); }
/// <summary> /// Inputs the pane_ showing. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="InputPaneVisibilityEventArgs"/> instance containing the event data.</param> void InputPane_Showing(Windows.UI.ViewManagement.InputPane sender, InputPaneVisibilityEventArgs args) { inputPaneGrid.Height = sender.OccludedRect.Height; }
void input_Hiding(InputPane sender, InputPaneVisibilityEventArgs e) { inputPaneHeight = Window.Current.Content.RenderSize.Height - (AppBar1.IsOpen ? AppBar1.ActualHeight : 0) - saveFeedPage.ActualHeight; saveFeedPagePop.VerticalOffset = inputPaneHeight; }
private void HidingHandler(InputPane sender, InputPaneVisibilityEventArgs args) { _messageInputTextBox.Margin = new Thickness(20); }
private void ShowingHandler(InputPane sender, InputPaneVisibilityEventArgs args) { args.EnsuredFocusedElementInView = true; _messageInputTextBox.Margin = new Thickness(20, 20, 20, args.OccludedRect.Height + 20); }
void inputPane_Hiding(InputPane sender, InputPaneVisibilityEventArgs args) { // When the input pane rescale the game to fit RowObscuredByInputPane.Height = new GridLength(0); }
private async void MainPage_KeyboardShowing(InputPane sender, InputPaneVisibilityEventArgs args) { if (!args.EnsuredFocusedElementInView) args.EnsuredFocusedElementInView = true; if (_bIsKeyboardPresent) return; _bIsKeyboardPresent = true; await WebViewControl.InvokeScriptAsync("eval", new[] { "Appverse.OnWPKeyboardShow();" }); }
private void _inputPane_Showing(InputPane sender, InputPaneVisibilityEventArgs args) { _isKeyboardVisible = true; }
private void _inputPane_Hiding(InputPane sender, InputPaneVisibilityEventArgs args) { _isKeyboardVisible = false; }
private void OnInputPaneHiding(InputPane sender, InputPaneVisibilityEventArgs args) { //UpdatePanelLayout(args.OccludedRect.Height); }
void InputPaneHiding(InputPane sender, InputPaneVisibilityEventArgs args) { ButtonsDown(); if (_isEmojiActivated) { EmojiPanelShowing(); } }
void InputDialog_Showing(Windows.UI.ViewManagement.InputPane sender, Windows.UI.ViewManagement.InputPaneVisibilityEventArgs args) { TranslateStripeTo(args.OccludedRect.Height / -2); }
private void InputPaneShowing(InputPane sender, InputPaneVisibilityEventArgs args) { if (_isEmojiActivated) { EmojiPanelHiding(); ButtonsUp(args); _isEmojiActivated = false; } else { ButtonsUp(args); } }
// When the InputPane (ie on-screen keyboard) is shown then we arrange // so that the animated control is not obscured. void inputPane_Showing(InputPane sender, InputPaneVisibilityEventArgs args) { RowObscuredByInputPane.Height = new GridLength(args.OccludedRect.Height); }
public CustomEditControl() { this.InitializeComponent(); // The CoreTextEditContext processes text input, but other keys are // the apps's responsibility. _coreWindow = CoreWindow.GetForCurrentThread(); _coreWindow.KeyDown += CoreWindow_KeyDown; _coreWindow.PointerPressed += CoreWindow_PointerPressed; // Create a CoreTextEditContext for our custom edit control. CoreTextServicesManager manager = CoreTextServicesManager.GetForCurrentView(); _editContext = manager.CreateEditContext(); // Get the Input Pane so we can programmatically hide and show it. _inputPane = InputPane.GetForCurrentView(); // For demonstration purposes, this sample sets the Input Pane display policy to Manual // so that it can manually show the software keyboard when the control gains focus and // dismiss it when the control loses focus. If you leave the policy as Automatic, then // the system will hide and show the Input Pane for you. Note that on Desktop, you will // need to implement the UIA text pattern to get expected automatic behavior. _editContext.InputPaneDisplayPolicy = CoreTextInputPaneDisplayPolicy.Manual; // Set the input scope to Text because this text box is for any text. // This also informs software keyboards to show their regular // text entry layout. There are many other input scopes and each will // inform a keyboard layout and text behavior. _editContext.InputScope = CoreTextInputScope.Text; // The system raises this event to request a specific range of text. _editContext.TextRequested += EditContext_TextRequested; // The system raises this event to request the current selection. _editContext.SelectionRequested += EditContext_SelectionRequested; // The system raises this event when it wants the edit control to remove focus. _editContext.FocusRemoved += EditContext_FocusRemoved; // The system raises this event to update text in the edit control. _editContext.TextUpdating += EditContext_TextUpdating; // The system raises this event to change the selection in the edit control. _editContext.SelectionUpdating += EditContext_SelectionUpdating; // The system raises this event when it wants the edit control // to apply formatting on a range of text. _editContext.FormatUpdating += EditContext_FormatUpdating; // The system raises this event to request layout information. // This is used to help choose a position for the IME candidate window. _editContext.LayoutRequested += EditContext_LayoutRequested; // The system raises this event to notify the edit control // that the string composition has started. _editContext.CompositionStarted += EditContext_CompositionStarted; // The system raises this event to notify the edit control // that the string composition is finished. _editContext.CompositionCompleted += EditContext_CompositionCompleted; // The system raises this event when the NotifyFocusLeave operation has // completed. Our sample does not use this event. // _editContext.NotifyFocusLeaveCompleted += EditContext_NotifyFocusLeaveCompleted; // Set our initial UI. UpdateTextUI(); UpdateFocusUI(); }
private void popupInputPane_Hiding(InputPane sender, InputPaneVisibilityEventArgs args) { resizePopup(); }
private void OnKeyboardShowing(InputPane sender, InputPaneVisibilityEventArgs args) { Element?.ForceLayout(); }
private void OnInputHiding(InputPane sender, InputPaneVisibilityEventArgs args) { var child = _popup.Child as FrameworkElement; if (child == null) return; child.Margin = new Thickness(0); }