Example #1
0
        public Scenario3()
        {
            this.InitializeComponent();

            // Retrieve information about whether or not a keyboard is present
            Windows.Devices.Input.KeyboardCapabilities kbdCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
            keyboardText.Text = "Keyboard present = " + kbdCapabilities.KeyboardPresent.ToString();

            // Retrieve information about the capabilities of the device's mouse.  This includes:
            // - Whether or not a mouse is present
            // - The number of buttons on the mouse
            // - Whether or not the mouse has a vertical scroll wheel
            // - Whether or not the mouse has a horizontal scroll wheel
            // - Whether or not the user has elected to swap the mouse buttons, causing
            //   the right mouse button to be the primary button
            Windows.Devices.Input.MouseCapabilities mouseCapabilities = new Windows.Devices.Input.MouseCapabilities();
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("Mouse present = " + mouseCapabilities.MousePresent.ToString() + "\n");
            sb.Append("Number of buttons = " + mouseCapabilities.NumberOfButtons.ToString() + "\n");
            sb.Append("Vertical wheel present = " + mouseCapabilities.VerticalWheelPresent.ToString() + "\n");
            sb.Append("Horizontal wheel present = " + mouseCapabilities.HorizontalWheelPresent.ToString() + "\n");
            sb.Append("Buttons swapped = " + mouseCapabilities.SwapButtons.ToString());
            mouseText.Text = sb.ToString();

            // Retrieve information about the capabilities of the device's mouse.  This includes:
            // - Whether or not the device supports touch
            // - The supported number of simultaneous touch contacts
            Windows.Devices.Input.TouchCapabilities touchCapabilities = new Windows.Devices.Input.TouchCapabilities();
            sb = new System.Text.StringBuilder();
            sb.Append("Touch present = " + touchCapabilities.TouchPresent.ToString() + "\n");
            sb.Append("Touch contacts supported = " + touchCapabilities.Contacts.ToString());
            touchText.Text = sb.ToString();
        }
Example #2
0
        private void MessageEditor_OnKeyDown(object sender, KeyRoutedEventArgs e)
        {
            bool HandleSuggestions = (SuggestionBlock.Items.Count != 0);

            if (e.Key == VirtualKey.Enter)
            {
                e.Handled = true;

                Windows.Devices.Input.KeyboardCapabilities keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
                if (keyboardCapabilities.KeyboardPresent > 0)
                {
                    if (CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
                    {
                        InsertNewLine();
                    }
                    else if (HandleSuggestions)
                    {
                        SelectSuggestion((KeyValuePair <string, DawgSharp.DawgItem>)SuggestionBlock.SelectedItem);
                    }
                    else
                    {
                        SendBox_OnClick(null, null);
                    }
                }
                else if (HandleSuggestions)
                {
                    SelectSuggestion((KeyValuePair <string, DawgSharp.DawgItem>)SuggestionBlock.SelectedItem);
                }
                else
                {
                    InsertNewLine();
                }
            }

            if (e.Key == VirtualKey.Up)
            {
                e.Handled = true;
                if (SuggestionBlock.SelectedIndex == -1 || SuggestionBlock.SelectedIndex == 0)
                {
                    SuggestionBlock.SelectedIndex = SuggestionBlock.Items.Count - 1;
                }
                else
                {
                    SuggestionBlock.SelectedIndex = SuggestionBlock.SelectedIndex - 1;
                }
            }
            else if (e.Key == VirtualKey.Down)
            {
                e.Handled = true;

                if (SuggestionBlock.SelectedIndex == -1 || SuggestionBlock.SelectedIndex == SuggestionBlock.Items.Count - 1)
                {
                    SuggestionBlock.SelectedIndex = 0;
                }
                else
                {
                    SuggestionBlock.SelectedIndex = SuggestionBlock.SelectedIndex + 1;
                }
            }
        }
        public Scenario3()
        {
            this.InitializeComponent();

            // Retrieve information about whether or not a keyboard is present
            Windows.Devices.Input.KeyboardCapabilities kbdCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
            keyboardText.Text = "Keyboard present = " + kbdCapabilities.KeyboardPresent.ToString();

            // Retrieve information about the capabilities of the device's mouse.  This includes:
            // - Whether or not a mouse is present
            // - The number of buttons on the mouse
            // - Whether or not the mouse has a vertical scroll wheel
            // - Whether or not the mouse has a horizontal scroll wheel
            // - Whether or not the user has elected to swap the mouse buttons, causing
            //   the right mouse button to be the primary button
            Windows.Devices.Input.MouseCapabilities mouseCapabilities = new Windows.Devices.Input.MouseCapabilities();
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("Mouse present = " + mouseCapabilities.MousePresent.ToString() + "\n");
            sb.Append("Number of buttons = " + mouseCapabilities.NumberOfButtons.ToString() + "\n");
            sb.Append("Vertical wheel present = " + mouseCapabilities.VerticalWheelPresent.ToString() + "\n");
            sb.Append("Horizontal wheel present = " + mouseCapabilities.HorizontalWheelPresent.ToString() + "\n");
            sb.Append("Buttons swapped = " + mouseCapabilities.SwapButtons.ToString());
            mouseText.Text = sb.ToString();

            // Retrieve information about the capabilities of the device's mouse.  This includes:
            // - Whether or not the device supports touch
            // - The supported number of simultaneous touch contacts
            Windows.Devices.Input.TouchCapabilities touchCapabilities = new Windows.Devices.Input.TouchCapabilities();
            sb = new System.Text.StringBuilder();
            sb.Append("Touch present = " + touchCapabilities.TouchPresent.ToString() + "\n");
            sb.Append("Touch contacts supported = " + touchCapabilities.Contacts.ToString());
            touchText.Text = sb.ToString();
        }
Example #4
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string Buffer;
            Windows.Devices.Input.KeyboardCapabilities KeyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();

            Buffer = string.Format("There is {0} keyboard present\n", KeyboardCapabilities.KeyboardPresent != 0 ? "a" : "no");

            KeyboardOutputTextBlock.Text = Buffer;
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string Buffer;

            Windows.Devices.Input.KeyboardCapabilities KeyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();

            Buffer = string.Format("There is {0} keyboard present\n", KeyboardCapabilities.KeyboardPresent != 0 ? "a" : "no");

            KeyboardOutputTextBlock.Text = Buffer;
        }
Example #6
0
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            System.Diagnostics.Debug.WriteLine(Version.Parse("1.2.3").ToPackageVersion().ToString());
            Windows.Devices.Input.KeyboardCapabilities kc = new Windows.Devices.Input.KeyboardCapabilities();
            System.Diagnostics.Debug.WriteLine(kc.KeyboardPresent);
            System.Diagnostics.Debug.WriteLine(Windows.ApplicationModel.Package.Current);
        }
Example #7
0
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            System.Diagnostics.Debug.WriteLine(Version.Parse("1.2.3").ToPackageVersion().ToString());
            Windows.Devices.Input.KeyboardCapabilities kc = new Windows.Devices.Input.KeyboardCapabilities();
            System.Diagnostics.Debug.WriteLine(kc.KeyboardPresent);
            System.Diagnostics.Debug.WriteLine(Windows.ApplicationModel.Package.Current);
        }
Example #8
0
        private void animatedControl_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
#if WINDOWS_PHONE_APP || WINDOWS_UAP
            // Bring the on-screen keyboard back up when the user taps on the screen.
            var keyboardCaps = new Windows.Devices.Input.KeyboardCapabilities();
            if (keyboardCaps.KeyboardPresent == 0)
            {
                // There's no keyboard present, so show the input pane
                var inputPane = Windows.UI.ViewManagement.InputPane.GetForCurrentView();
                inputPane.TryShow();
            }
#endif
        }
        private void control_Loaded(object sender, RoutedEventArgs e)
        {
            // Register for keyboard events
            Window.Current.CoreWindow.KeyDown += KeyDown_UIThread;

#if WINDOWS_PHONE_APP || WINDOWS_UAP
            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).
                var inputPane = Windows.UI.ViewManagement.InputPane.GetForCurrentView();
                inputPane.TryShow();
                inputPane.Showing += inputPane_Showing;
            }
#endif
        }
Example #10
0
        private void control_Loaded(object sender, RoutedEventArgs e)
        {
            // Register for keyboard events
            Window.Current.CoreWindow.KeyDown += KeyDown_UIThread;

            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;
            }
        }
        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 static Devices GetMobileMode()
 {
     if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
     {
         var keyboard = new Windows.Devices.Input.KeyboardCapabilities();
         if (keyboard.KeyboardPresent > 0)
         {
             return(Devices.Continuum);
         }
         else
         {
             return(Devices.Phone);
         }
     }
     else
     {
         return(Devices.Tablet);
     }
 }
Example #13
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();


            //System.Diagnostics.Debug.WriteLine(Windows.);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
            //System.Diagnostics.Debug.WriteLine(Package.Current.DisplayName);
            System.Diagnostics.Debug.WriteLine(Package.Current.Id.Name);
            System.Diagnostics.Debug.WriteLine(Package.Current.Id.Version);
            //System.Diagnostics.Debug.WriteLine(Package.Current.InstalledDate);
            //System.Diagnostics.Debug.WriteLine(Package.Current.IsDevelopmentMode);
            Windows.Devices.Input.KeyboardCapabilities kc = new Windows.Devices.Input.KeyboardCapabilities();
            System.Diagnostics.Debug.WriteLine(kc.KeyboardPresent);

            InTheHand.Security.ExchangeActivesyncProvisioning.EasClientDeviceInformation di = new InTheHand.Security.ExchangeActivesyncProvisioning.EasClientDeviceInformation();

            System.Diagnostics.Debug.WriteLine(di.Id);
            //InTheHand.UI.ApplicationSettings.SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
            this.Loaded += MainPage_Loaded;
        }
Example #14
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();


            //System.Diagnostics.Debug.WriteLine(Windows.);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
            //System.Diagnostics.Debug.WriteLine(Package.Current.DisplayName);
            System.Diagnostics.Debug.WriteLine(Package.Current.Id.Name);
            System.Diagnostics.Debug.WriteLine(Package.Current.Id.Version);
            //System.Diagnostics.Debug.WriteLine(Package.Current.InstalledDate);
            //System.Diagnostics.Debug.WriteLine(Package.Current.IsDevelopmentMode);
            Windows.Devices.Input.KeyboardCapabilities kc = new Windows.Devices.Input.KeyboardCapabilities();
            System.Diagnostics.Debug.WriteLine(kc.KeyboardPresent);

            InTheHand.Security.ExchangeActivesyncProvisioning.EasClientDeviceInformation di = new InTheHand.Security.ExchangeActivesyncProvisioning.EasClientDeviceInformation();

            System.Diagnostics.Debug.WriteLine(di.Id);
            //InTheHand.UI.ApplicationSettings.SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
            this.Loaded += MainPage_Loaded;
        }
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardCapabilities"/> class.
        /// </summary>
        public KeyboardCapabilities()
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP
            _keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
#endif
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardCapabilities"/> class.
        /// </summary>
        public KeyboardCapabilities()
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP
            _keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
#endif
        }
        /// <summary>
        /// Used to check whether the device has keyboard. If it has, no touch overlay is drawed.
        /// </summary>
        /// <returns>True if it has keyboard, false otherwise.</returns>
        public bool IsDeviceWithKeyboard()
        {
            var keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();

            return(keyboardCapabilities.KeyboardPresent != 0);
        }
 private void animatedControl_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     #if WINDOWS_PHONE_APP || WINDOWS_UAP
     // Bring the on-screen keyboard back up when the user taps on the screen.
     var keyboardCaps = new Windows.Devices.Input.KeyboardCapabilities();
     if (keyboardCaps.KeyboardPresent == 0)
     {
         // There's no keyboard present, so show the input pane
         var inputPane = Windows.UI.ViewManagement.InputPane.GetForCurrentView();
         inputPane.TryShow();
     }
     #endif
 }