Пример #1
0
        public ISBNField()
        {
            base.CanScale = true;

            _isbnBox.FontSize += 16;

            _grid = new Grid()
            {
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
                Background = new SolidColorBrush(Color.FromArgb(200, 50, 50, 50))
            };
            _grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            _grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
            _grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(230, GridUnitType.Pixel) });

            base.Content = _grid;

            TextBlock _isbnLbl = new TextBlock();
            _isbnLbl.Foreground = Brushes.Wheat;
            _isbnLbl.FontSize = _isbnBox.FontSize - 8;
            _isbnLbl.Text = "Lookup ISBN Number:";

            ImageButton _goButton = new ImageButton("139-Play.png");
            _goButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            _goButton.Click += new RoutedEventHandler(goButton_Click);

            Grid.SetRow(_isbnLbl, 0);
            Grid.SetRow(_isbnBox, 1);
            Grid.SetRow(_goButton, 1);

            _grid.Children.Add(_isbnLbl);
            _grid.Children.Add(_isbnBox);
            _grid.Children.Add(_goButton);

            AbstractKeyboard kb = new NumKeyboard();
            KeyboardTextInput kbti = new KeyboardTextInput(kb, _isbnBox);
            kbti.Enabled=true;
            //Grid.SetColumnSpan(kb, 2);
            Grid.SetRow(kb, 2);
            _grid.Children.Add(kb);
        }
Пример #2
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);
        }