public SplashPage()
            : base(0, 0, UIManager.Desktop.Width, UIManager.Desktop.Height)
        {
            tbTitle = new TextBlock(0, 0, UIManager.Desktop.Width, UIManager.Desktop.Height / 2, UIManager.FontTitle, "")
            {
                ForeColor = Color.CornflowerBlue,
                TextAlignment = TextAlignment.Center,
                TextVerticalAlignment = VerticalAlignment.Center,
                TextWrap = true
            };
            Children.Add(tbTitle);

            pbLoad = new ProgressBar(UIManager.Desktop.Width / 6, 5 * UIManager.Desktop.Height / 6, 2 * UIManager.Desktop.Width / 3, 20)
            {
                Background = new LinearGradientBrush(Color.CornflowerBlue, Color.Black),
                Foreground = new LinearGradientBrush(Color.CornflowerBlue, Color.LimeGreen),
                Value = 0
            };
            Children.Add(pbLoad);

            tbLoad = new TextBlock(pbLoad.X, pbLoad.Y, pbLoad.Width, pbLoad.Height, UIManager.FontCourierNew10, "0 %")
            {
                TextAlignment = TextAlignment.Center,
                TextVerticalAlignment = VerticalAlignment.Center,
                TextWrap = true
            };
            Children.Add(tbLoad);
        }
Exemple #2
0
 public SplashPage()
     : base(0, 0, DemoManager.Desktop.Width, DemoManager.Desktop.Height)
 {
     tbTitle = new TextBlock(0, 0, DemoManager.Desktop.Width, DemoManager.Desktop.Height, DemoManager.FontTitle, "MFE Graphics Library")
     {
         ForeColor = Color.Blue,//.CornflowerBlue,
         TextAlignment = TextAlignment.Center,
         TextVerticalAlignment = VerticalAlignment.Center,
         TextWrap = true
     };
     Children.Add(tbTitle);
 }
 public DebugPage()
     : base(0, 0, UIManager.Desktop.Width, UIManager.Desktop.Height)
 {
     tbText = new TextBlock(0, 0, UIManager.Desktop.Width, UIManager.Desktop.Height, UIManager.FontRegular, "")
     {
         ForeColor = Color.White,
         TextAlignment = TextAlignment.Left,
         TextVerticalAlignment = VerticalAlignment.Top,
         TextWrap = true
     };
     Children.Add(tbText);
 }
        protected override void Run()
        {
            if (!Utils.IsEmulator)
            {
                bool reboot = false;
                reboot |= LCDManager.SetLCDConfiguration_800_480();
                //reboot |= LCDManager.SetLCDConfiguration_320_240();
                //reboot |= LCDManager.SetBootLogo(null, 0, 0);
                reboot |= LCDManager.SetLCDBootupMessages(true);

                if (reboot)
                {
                    Util.FlushExtendedWeakReferences();
                    PowerState.RebootDevice(false);
                }
            }

            GraphicsManager.Initialize();

            if (LCDManager.IsScreenAvailable)
            {
                if (!CalibrationManager.IsCalibrated)
                {
                    CalibrationWindow winCal = new CalibrationWindow();
                    winCal.Background = new LinearGradientBrush(Color.Blue, Color.Black);
                    winCal.CrosshairPen = new Pen(Color.LimeGreen, 1);

                    TextBlock text = new TextBlock(0, winCal.Height / 4, winCal.Width, 40, Resources.GetFont(Resources.FontResources.CourierNew_10), "Please tap the crosshairs to calibrate the screen");
                    text.ForeColor = Color.White;
                    text.TextAlignment = TextAlignment.Center;
                    text.TextVerticalAlignment = VerticalAlignment.Center;
                    text.TextWrap = true;
                    winCal.Children.Add(text);

                    winCal.ShowModal();
                }

                MainWindow wndMain = new MainWindow();
                wndMain.Show();

                // place your code here
            }
        }
        public static void CheckCalibration()
        {
            if (!gm.IsCalibrated)
            {
                var cw = gm.CalibrationWindow;
                cw.Background = new SolidColorBrush(Color.CornflowerBlue);
                cw.CrosshairPen = new Pen(Color.Red, 1);

                TextBlock text = new TextBlock(0, 0, cw.Width, cw.Height / 2, Resources.GetFont(Resources.FontResources.CourierNew_10), "Please touch the crosshair")
                {
                    ForeColor = Color.White,
                    TextAlignment = TextAlignment.Center,
                    TextVerticalAlignment = VerticalAlignment.Center,
                    TextWrap = true
                };
                cw.Children.Add(text);

                cw.Show();
            }
        }
        private void CreateToolButton(ref int x, string name, string text, Bitmap bitmap)
        {
            ToolButton btn = new ToolButton(x, 250, Program.ShortcutIconSize, Program.ShortcutIconSize)
            {
                Name = name,
                Foreground = new ImageBrush(bitmap)
            };
            //btn.Foreground.Opacity = 200;
            btn.Click += new EventHandler(ToolButton_Click);
            Children.Add(btn);

            TextBlock lbl = new TextBlock(x, btn.Area.Bottom, Program.ShortcutIconSize, 20, Program.FontCourierNew10, text)
            {
                ForeColor = Program.ButtonTextColor,
                TextAlignment = TextAlignment.Center,
                TextVerticalAlignment = VerticalAlignment.Top
            };
            Children.Add(lbl);

            x += btn.Width + 10;
        }
        private void Demo()
        {
            Background = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.reWalls)) { Stretch = Stretch.Fill };

            ImageBrush bar = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Bar));

            // left panel
            Panel panelNavigation = new Panel(10, 10, 150, 460);
            panelNavigation.Background = new LinearGradientBrush(Color.Bisque, Color.Black, 0, 500, 1000, 500);
            panelNavigation.Background.Opacity = 120;
            panelNavigation.Border = new Pen(Color.Black, 1);
            Children.Add(panelNavigation);

            Panel tlb = new Panel(1, 1, panelNavigation.Width - 2, 25);
            tlb.Background = bar;
            tlb.Children.Add(new Label(10, 5, fontCourierNew10, "Navigation") { ForeColor = Color.CornflowerBlue });
            tlb.TouchDown += delegate(object sender, TouchEventArgs e) { TouchCapture.Capture(tlb); p = e.Point; };
            tlb.TouchMove += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb) { panelNavigation.Translate(e.Point.X - p.X, e.Point.Y - p.Y); p = e.Point; } };
            tlb.TouchUp += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb) TouchCapture.ReleaseCapture(); };
            panelNavigation.Children.Add(tlb);

            //int d = 15;
            //int x = 0;
            ////int y = 5;
            //RadioButtonGroup rbgNavigation = new RadioButtonGroup(10, 30, 15, panelNavigation.Height - 40);
            //panelNavigation.Children.Add(rbgNavigation);
            //rbgNavigation.AddRadioButton(new RadioButton(x, 5, d, true));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 25, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 45, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 65, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 85, d));
            //rbgNavigation.AddRadioButton(new RadioButton(x, 105, d));

            //panelNavigation.Children.Add(new Label(30, 35, fontCourierNew10, "Checkboxes") { ForeColor = Color.White });
            //panelNavigation.Children.Add(new Label(30, 55, fontCourierNew10, "Buttons") { ForeColor = Color.White });

            int x = 5;
            int w = panelNavigation.Width - 2 * x;
            int h = 18;
            int y = 35;
            int step = h + 5;

            //Font fnt = fontRegular;
            Font fnt = fontCourierNew10;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Checkbox", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Button", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Image", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Label", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Level", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "MultiImage", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Panel", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "ProgressBar", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "RadioButton", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "Slider", Color.White) { BackgroundUnpressed = bar }); y += step;
            panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "TextBlock", Color.White) { BackgroundUnpressed = bar }); y += step;
            //panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "", Color.White) { BackgroundUnpressed = bar }); y += step;
            //panelNavigation.Children.Add(new Button(x, y, w, h, fnt, "", Color.White) { BackgroundUnpressed = bar }); y += step;

            foreach (Control ctrl in panelNavigation.Children)
            {
                if (ctrl is Button)
                    (ctrl as Button).Click += new EventHandler(Button_Click);
            }

            // title
            TextBlock txtTitle = new TextBlock(200, panelNavigation.Y, 590, 60, fontTitle, "MFE graphics");
            txtTitle.ForeColor = Color.CornflowerBlue;
            txtTitle.TextAlignment = TextAlignment.Center;
            txtTitle.TextVerticalAlignment = VerticalAlignment.Center;
            Children.Add(txtTitle);

            // right panel
            int yy = txtTitle.Height + 10;
            panelPresentation = new Panel(txtTitle.X, panelNavigation.Y + yy, txtTitle.Width, panelNavigation.Height - yy);
            panelPresentation.Background = new SolidColorBrush(Color.Black);
            panelPresentation.Background.Opacity = 50;
            panelPresentation.Border = new Pen(Color.Black, 1);
            Children.Add(panelPresentation);

            tlb2 = new Panel(1, 1, panelPresentation.Width - 2, 25);
            tlb2.Background = bar;
            tlb2.Children.Add(lblActiveDemo = new Label(10, 5, fontCourierNew10, "Presentation: [Please select control type on the left]") { ForeColor = Color.CornflowerBlue });
            tlb2.TouchDown += delegate(object sender, TouchEventArgs e) { TouchCapture.Capture(tlb2); p = e.Point; };
            tlb2.TouchMove += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb2) { panelPresentation.Translate(e.Point.X - p.X, e.Point.Y - p.Y); p = e.Point; } };
            tlb2.TouchUp += delegate(object sender, TouchEventArgs e) { if (TouchCapture.Captured == tlb2) TouchCapture.ReleaseCapture(); };
            panelPresentation.Children.Add(tlb2);
        }