Esempio n. 1
0
        public KeyboardTextInput(AbstractKeyboard k, SurfaceTextBox t)
        {
            this.k = k;
            this.t = t;

            k.CaretMovedBackward += this.keyboard1_CaretMovedBackward;
            k.CaretMovedForward += this.keyboard1_CaretMovedForward;
            k.CharacterDeleted += this.keyboard1_CharacterDeleted;
            k.SelectionMovedBackward += this.keyboard1_SelectionMovedBackward;
            k.SelectionMovedForward += this.keyboard1_SelectionMovedForward;
            k.KeyPressed += this.keyboard1_KeyEvent;
        }
Esempio n. 2
0
        public KeyboardWebInput(AbstractKeyboard k, WebControl w)
        {
            this.k = k;
            this.w = w;

            k.CaretMovedBackward += this.keyboard1_CaretMovedBackward;
            k.CaretMovedForward += this.keyboard1_CaretMovedForward;
            k.CharacterDeleted += this.keyboard1_CharacterDeleted;
            k.SelectionMovedBackward += this.keyboard1_SelectionMovedBackward;
            k.SelectionMovedForward += this.keyboard1_SelectionMovedForward;
            k.EnterPressed += this.keyboard1_Enter;
            k.KeyPressed += this.keyboard1_KeyEvent;
        }
Esempio n. 3
0
        public OurWebBrowser()
        {
            base.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            base.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
            base.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(280, GridUnitType.Pixel) });
            base.Background = new SolidColorBrush(Color.FromArgb(200, 50, 50, 50));

            _webBrowser = new WebControl()
            {
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                Margin = new Thickness(12, 6, 12, 12)
            };
            _webBrowser.BeginLoading += new BeginLoadingEventHandler(_webBrowser_BeginLoading);
            LoadUrl("msn.com");
            Grid.SetRow(_webBrowser, 1);
            base.Children.Add(_webBrowser);

            //grid for the top items
            Grid grid = new Grid();
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            Grid.SetRow(grid, 0);
            base.Children.Add(grid);

            //stack panel for left buttons
            StackPanel sp = new StackPanel()
            {
                Orientation = System.Windows.Controls.Orientation.Horizontal
                //Margin = new Thickness(12, 0, 0, 0)
            };
            Grid.SetColumn(sp, 0);
            grid.Children.Add(sp);

            _backButton = new ImageButton("Back.png") { IsEnabled = false };
            _backButton.Click += new System.Windows.RoutedEventHandler(backButton_Click);
            sp.Children.Add(_backButton);

            _forwardButton = new ImageButton("188-ArrowRounded.png") { IsEnabled = false };
            _forwardButton.Click += new System.Windows.RoutedEventHandler(forwardButton_Click);
            sp.Children.Add(_forwardButton);

            //url bar
            _textBox = new SurfaceTextBox() { VerticalContentAlignment = System.Windows.VerticalAlignment.Center };
            _textBox.Loaded += delegate { _textBox.Focus(); }; //focus on loaded
            _textBox.KeyUp += new System.Windows.Input.KeyEventHandler(_textBox_KeyUp);
            Grid.SetColumn(_textBox, 1);
            grid.Children.Add(_textBox);

            //right buttons
            StackPanel right = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
            Grid.SetColumn(right, 2);
            grid.Children.Add(right);

            //enter button
            ImageButton enterButton = new ImageButton("139-Play.png");
            enterButton.Click += new RoutedEventHandler(enterButton_Click);
            right.Children.Add(enterButton);

            //save button
            ImageButton saveButton = new ImageButton("178-Save.png");
            saveButton.Click += new RoutedEventHandler(saveButton_Click);
            right.Children.Add(saveButton);

            // keyboard
            this.kb = new Keyboard();
            kbwi = new KeyboardWebInput(kb, _webBrowser);
            kbti = new KeyboardTextInput(kb, _textBox);

            _textBox.GotFocus += textGotFocus;
            _textBox.LostFocus += textLostFocus;

            _webBrowser.GotFocus += webGotFocus;
            _webBrowser.LostFocus += webLostFocus;

            kb.KeyboardHidden += keyBoardHidden;
            kb.KeyboardShown += keyBoardShown;

            Grid.SetRow(kb, 2);
            base.Children.Add(kb);
        }