示例#1
0
        static void KeyCheck_Click(object sender, RoutedEventArgs e)
        {
            var  chk   = sender as CheckBox;
            bool isChk = chk.IsChecked ?? false;

            try
            {
                var pane = InputPane.GetForCurrentView();
                if (isChk)
                {
                    pane.TryShow();
                }
                else
                {
                    pane.TryHide();
                }
            }
            catch (Exception ex)
            {
                App.MessageBox(ex.Message + Environment.NewLine + ex.StackTrace);
            }

            // TODO
            //  System.InvalidCastException: Unable to cast object of type 'Windows.UI.ViewManagement.InputPane' to type 'Windows.UI.ViewManagement.IInputPane2'.
            //at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr & ppTarget)
            //at Windows.UI.ViewManagement.InputPane.TryShow()
        }
示例#2
0
        public override void Execute(object parameter)
        {
            var w = MainPage.Instance;

            //if (!w.Dispatcher  as DispacherObject).CheckAccess())
            //    return;
            if (!w.Dispatcher.HasThreadAccess)
            {
                ExecuteAsync(w.Dispatcher);
                return;
            }

            var web = w.Web1 as WebView;

            var urlText = w.url.Text;

            if (string.IsNullOrWhiteSpace(urlText))
            {
                return;
            }

            var url = new Uri(urlText);

            w.url.Text          = urlText;
            w.url.SelectedIndex = 0;
            w.url.TextBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);

            // if (web.ExecutionMode)
            try
            {
                web.Source = url;
            }
            catch (Exception ex) {
                App.MessageBox(ex.Message);
            }
        }