示例#1
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            Text text = new Text();
            text.Font = Resources.GetFont(Resources.FontResources.small);
            text.TextContent = Resources.GetString(Resources.StringResources.String1);
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment = VerticalAlignment.Center;

            Border border = new Border();
            border.SetBorderThickness(10); // set a 10 pixel border for r,l,t,b
            border.BorderBrush = new LinearGradientBrush(Colors.White,
                                                         Colors.Blue,
                                                         0, 0,
                                                         SystemMetrics.ScreenWidth,
                                                         SystemMetrics.ScreenHeight);
            border.Child = text; // Add the text element to the border control

            // Add the text control to the window.
            mainWindow.Child = border;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#2
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;
            mainWindow.Background = new SolidColorBrush(Color.Black);

            imageView = new Image();
            imageView.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
            imageView.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;
            mainWindow.Child = imageView;

            mainWindow.AddHandler(Buttons.ButtonDownEvent, new ButtonEventHandler(OnButtonDown), false);

            mainWindow.Visibility = Visibility.Visible;
            Buttons.Focus(mainWindow);

            // Create camera
            camera = new C328R(new SerialPort.Configuration(SerialPort.Serial.COM2, SerialPort.BaudRate.Baud115200, false));
            InitCamera();

            return mainWindow;
        }
 public void init(Display_T35 display_T35)
 {
     this.display = display_T35;
     this.window = display.WPFWindow;
     this.window.Child = this;
     this.taskbar = new TaskbarWidget();
 }
示例#4
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            Font font = Resources.GetFont(Resources.FontResources.NinaB);

            // Create a list box control and add text items
            ListBox listBox = new ListBox();
            for (int i = 0; i < 10; ++i)
            {
                string str = "Item " + i + ". Hello World.";
                listBox.Items.Add(new Text(font, str));
            }

            // Add the text control to the window.
            mainWindow.Child = listBox;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Let the user select items with the up and down buttons.
            Buttons.Focus(listBox);
            // Get notified when the selected item was changed.
            listBox.SelectionChanged += new SelectionChangedEventHandler(listBox_SelectionChanged);
            // Get notified when a selected item was pressed
            // using the select button.
            listBox.AddHandler(Buttons.ButtonDownEvent, new ButtonEventHandler(listBox_ButtonDown), false);

            return mainWindow;
        }
示例#5
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single panel control.
            Panel panel = new Panel();

            Image image = new Image(Resources.GetBitmap(Resources.BitmapResources.Racer));
            image.HorizontalAlignment = HorizontalAlignment.Center;
            image.VerticalAlignment = VerticalAlignment.Center;
            panel.Children.Add(image);

            Font font = Resources.GetFont(Resources.FontResources.small);
            Text text = new Text(font, "I am a racer.");
            text.ForeColor = Colors.Red;
            text.TextContent = Resources.GetString(Resources.StringResources.String1);
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment = VerticalAlignment.Center;
            panel.Children.Add(text);

            // Add the text control to the window.
            mainWindow.Child = panel;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#6
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            Canvas canvas = new Canvas();

            // Create aborder for the text
            Border textBorder = new Border();
            textBorder.SetBorderThickness(1, 5, 1, 5);
            textBorder.BorderBrush = new SolidColorBrush(Colors.Blue);
            Canvas.SetLeft(textBorder, 20);
            Canvas.SetTop(textBorder, 150);

            // Create a single text control and add it to the canvas
            Font font = Resources.GetFont(Resources.FontResources.NinaB);
            Text text = new Text(font, "Text with a border");
            textBorder.Child = text; // Add the text to the border

            // Add the border to the canvas
            canvas.Children.Add(textBorder);

            // Add the canvas to the window.
            mainWindow.Child = canvas;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#7
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            Font font = Resources.GetFont(Resources.FontResources.NinaB);
            Font smallFont = Resources.GetFont(Resources.FontResources.small);

            TextFlow textFlow = new TextFlow();
            textFlow.TextRuns.Add("Hello world.", font, Colors.Black);
            textFlow.TextRuns.Add(" Hello world.", smallFont, Colors.Red);
            textFlow.TextRuns.Add(TextRun.EndOfLine);
            textFlow.TextRuns.Add("Hello world.", font, Colors.Green);

            // Add the text flow to the window.
            mainWindow.Child = textFlow;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#8
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            Text text = new Text();

            text.Font = Resources.GetFont(Resources.FontResources.small);
            text.TextContent = "Displaying a text is one of the most common tasks you need to do with your display. So it is worth looking at the Text and TextFlow classes.";
            //text.Height = 100;
            //text.Width = 50;
            text.TextWrap = true;
            text.Trimming = Microsoft.SPOT.Presentation.Media.TextTrimming.WordEllipsis;
            text.TextAlignment = Microsoft.SPOT.Presentation.Media.TextAlignment.Right;
            text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Right;
            text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;

            // Add the text control to the window.
            mainWindow.Child = text;

            // Connect the button handler to all of the buttons.
            mainWindow.AddHandler(Buttons.ButtonUpEvent, new ButtonEventHandler(OnButtonUp), false);

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            return mainWindow;
        }
示例#9
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            this.textElement = new Text();
            this.textElement.Font = Resources.GetFont(Resources.FontResources.NinaB);
            this.textElement.TextContent = this.count.ToString();
            this.textElement.HorizontalAlignment = HorizontalAlignment.Center;
            this.textElement.VerticalAlignment = VerticalAlignment.Center;
            // Add the text control to the window.
            mainWindow.Child = this.textElement;

            this.dispatcherTimer = new DispatcherTimer(this.textElement.Dispatcher);
            this.dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            this.dispatcherTimer.Interval = new TimeSpan(0, 0, 1); //one second
            this.dispatcherTimer.Start();

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            return mainWindow;
        }
示例#10
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            Text text = new Text();
            text.Font = Resources.GetFont(Resources.FontResources.NinaB);
            text.TextContent = "Touch me!";
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment = VerticalAlignment.Center;

            // Subscribe to touch events
            text.StylusDown += new StylusEventHandler(text_StylusDown);
            text.StylusMove += new StylusEventHandler(text_StylusMove);
            text.StylusUp += new StylusEventHandler(text_StylusUp);

            // Add the text control to the window.
            mainWindow.Child = text;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#11
0
        private Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            Window window = new Window();
            window.Height = SystemMetrics.ScreenHeight;
            window.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            Text text = new Text();
            text.TextContent = this.temperature.ToString();
            text.Font = Resources.GetFont(Resources.FontResources.small);
            text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
            text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;

            // Add the text control to the window.
            window.Child = text;

            // Connect the button handler to all of the buttons.
            window.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);

            // Set the window visibility to visible.
            window.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(window);

            this.text = text;

            return window;
        }
示例#12
0
        void setupUI()
        {
            touchScreen = display_T35.WPFWindow;
            //setup layout
            Canvas layout = new Canvas();
            Border background = new Border();
            background.Background = new SolidColorBrush(Colors.Black);
            background.Height = 240;
            background.Width = 320;
            layout.Children.Add(background);
            Canvas.SetLeft(background, 0);
            Canvas.SetTop(background, 0);

            //add label
            console = new Text("Hello World!");
            console.Height = 100;
            console.Width = 320;
            console.ForeColor = Colors.Green;
            console.Font = Resources.GetFont(Resources.FontResources.NinaB);
            console.TextAlignment = TextAlignment.Left;

            layout.Children.Add(console);
            Canvas.SetLeft(console, 0);
            Canvas.SetTop(console, 10);

            touchScreen.Child = layout;
        }
示例#13
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            Microsoft.SPOT.Touch.Touch.Initialize(Application.Current);
            // Setup Main Window
            mainWindow = display_TE35.WPFWindow;
            mainWindow.Background = new SolidColorBrush(GT.Color.White);

            // Setup model
            Model.TemperatureControlDataModel dataModel = new Model.TemperatureControlDataModel();

            // Setup Managers
            Hardware.RelayManager relayManager = new Hardware.RelayManager(relays);
            Hardware.ThermocoupleManager thermocoupleManager = new Hardware.ThermocoupleManager(thermocouple);

            // Setup Controller
            Controller.TemperatureController controller = new Controller.TemperatureController(dataModel, relayManager, thermocoupleManager);

            // Setup Views
            View.SplashView splashView = new View.SplashView(dataModel);
            View.DashboardView dashboardView = new View.DashboardView(dataModel, controller);
            View.IdleView idleView = new View.IdleView(dataModel);
            View.SettingsView2 settingsView = new View.SettingsView2(dataModel, controller);

            controller.AttachViews(settingsView, dashboardView, splashView, idleView, mainWindow);
            mainWindow.Background = new SolidColorBrush(GT.Color.White);

            controller.Start(splashView);
        }
示例#14
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            int buttonWidth = SystemMetrics.ScreenWidth / 4;
            int buttonHeight = 20;

            // Create a panel to hold the list view and buttons.
            StackPanel stackPanel = new StackPanel();
            stackPanel.Orientation = Orientation.Vertical;

            // Create a panel to hold the buttons.
            StackPanel buttonPanel = new StackPanel();
            buttonPanel.Orientation = Orientation.Horizontal;

            ButtonControl newFileButton = new ButtonControl("New File", buttonWidth, buttonHeight);
            newFileButton.TouchDown += new TouchEventHandler(OnNewFile);
            buttonPanel.Children.Add(newFileButton);

            ButtonControl newDirButton = new ButtonControl("New Dir", buttonWidth, buttonHeight);
            newDirButton.TouchDown += new TouchEventHandler(OnNewDirectory);
            buttonPanel.Children.Add(newDirButton);

            ButtonControl deleteButton = new ButtonControl("Delete", buttonWidth, buttonHeight);
            deleteButton.TouchDown += new TouchEventHandler(OnDeleteFile);
            buttonPanel.Children.Add(deleteButton);

            ButtonControl formatButton = new ButtonControl("Format", buttonWidth, buttonHeight);
            formatButton.TouchDown += new TouchEventHandler(OnFormat);
            buttonPanel.Children.Add(formatButton);

            // Create the list view.
            _listView = new ListView(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight - buttonHeight);
            _listView.AddColumn("Name", 200);
            _listView.AddColumn("Size", 80);
            _listView.AddColumn("Created", 80);
            _listView.SelectionChanged += new SelectionChangedEventHandler(OnItemSelected);

            stackPanel.Children.Add(buttonPanel);
            stackPanel.Children.Add(_listView);
            mainWindow.Child = stackPanel;

            // Refresh the directory and file list
            RefreshList();

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            return mainWindow;
        }
示例#15
0
        internal void SetTopMost(Window window)
        {
            UIElementCollection children = LogicalChildren;

            if (!IsTopMost(window))
            {
                children.Remove(window);
                children.Add(window);
            }
        }
        public Keyboard(Window mw, Data h)
        {
            spWindow = new Window();
            spWindow.Height = SystemMetrics.ScreenHeight;
            spWindow.Width = SystemMetrics.ScreenWidth;

            HwDevices = h;

            DrawCanvas();
        }
示例#17
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            return mainWindow;
        }
示例#18
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            // Setup Main Window
            mainWindow = display_TE35.WPFWindow;
            mainWindow.Background = new SolidColorBrush(GT.Color.White);

            // Create Controller
            controller = new Controller.TemperatureController(mainWindow, controlRelays, temperatureProbe);

            controller.Start();
        }
示例#19
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;         

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#20
0
        /// <summary>This method is run when the mainboard is powered up or reset</summary>
        public void ProgramStarted()
        {
            Debug.Print("Program Started");

            this.canvas = new Canvas();
            this.text = new Text(Resources.GetFont(Resources.FontResources.NinaB), "Starting...");
            this.canvas.Children.Add(this.text);
            
            this.window = this.oledDisplay.WPFWindow;
            this.window.Child = this.canvas;

            this.temperatureHumidity.MeasurementComplete += new TemperatureHumidity.MeasurementCompleteEventHandler(this.TemperatureHumidityMeasurementComplete);
            this.temperatureHumidity.StartContinuousMeasurements();
        }
示例#21
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;
            // Add a gradient color background to the window
            mainWindow.Background = new LinearGradientBrush(Colors.White, Colors.Red,
                                                            0, 0,
                                                            mainWindow.Width, mainWindow.Height);

            Font font = Resources.GetFont(Resources.FontResources.NinaB);

            // Create a list box control and add text items
            ListBox listBox = new ListBox();
            // set the width so that it fills the entire screen
            listBox.Child.Width = mainWindow.Width;
            // make the list box transparent
            listBox.Background = null;
            // make the enclosed scroll viewer transparent also
            // we get the scroll viewer via the child property but
            // need to cast it to Control in order to clear the background
            ((Control)listBox.Child).Background = null;
            for (int i = 0; i < 10; ++i)
            {
                string str = "Item " + i.ToString() + ". Hello World.";
                ListBoxItem item = new HighlightableTextListBoxItem(font, str);
                listBox.Items.Add(item);
                if (i > 0 && i % 4 == 0)
                    listBox.Items.Add(new SeparatorListBoxItem());
            }

            // Add the text control to the window.
            mainWindow.Child = listBox;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Let the user select items with the up and down buttons.
            Buttons.Focus(listBox);
            // Get notified when the selected item was changed.
            listBox.SelectionChanged += new SelectionChangedEventHandler(listBox_SelectionChanged);
            // Get notified when a selected item was pressed
            // using the select button.
            listBox.AddHandler(Buttons.ButtonDownEvent, new ButtonEventHandler(listBox_ButtonDown), false);

            return mainWindow;
        }
        //public TemperatureController(Model.TemperatureControlDataModel model, ControlRelays controlRelays, TemperatureProbe temperatureProbe)
        //{
        //    theModel = model;
        //    this.controlRelays = controlRelays;
        //    this.temperatureProbe = temperatureProbe;
        //}
        public TemperatureController(Window mainWindow, ControlRelays controlRelays, TemperatureProbe temperatureProbe)
        {
            this.controlRelays = controlRelays;
            this.temperatureProbe = temperatureProbe;
            this.mainWindow = mainWindow;

            // Create Model
            theModel = new Model.TemperatureControlDataModel();

            // Create Views
            splashView = new View.SplashView(theModel);
            dashboardView = new View.DashboardView(theModel);
            idleView = new View.IdleView(theModel);
            settingsView = new View.SettingsView(theModel);
        }
示例#23
0
        /// <summary>
        /// The executable entry point.
        /// </summary>
        public static void Main()
        {
            MySimpleWPFApplication myApplication = new MySimpleWPFApplication();

            mainWindow = new MainMenuWindow(myApplication);

            // Create the object that configures the GPIO pins to buttons.
            GPIOButtonInputProvider inputProvider = new GPIOButtonInputProvider(null);

            // Load the fonts.
            NinaBFont = Resources.GetFont(Resources.FontResources.NinaBFont);
            SmallFont = Resources.GetFont(Resources.FontResources.SmallFont);

            // Start the application.
            myApplication.Run(mainWindow);
        }
示例#24
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a scrollviewer
            ScrollViewer scrollViewer = new ScrollViewer();
            scrollViewer.Background = new SolidColorBrush(Colors.Gray);
            // scroll line by line with 10 pixels per line
            scrollViewer.ScrollingStyle = ScrollingStyle.LineByLine;
            scrollViewer.LineWidth = 10;
            scrollViewer.LineHeight = 10;

            // Create a canvas and add ellipse shapes
            Canvas canvas = new Canvas();
            for (int x = 0; x <= 20; ++x)
            {
                for (int y = 0; y <= 20; ++y)
                {
                    Ellipse ellipse = new Ellipse(10, 10);
                    ellipse.Stroke = new Pen(Colors.White);
                    canvas.Children.Add(ellipse);
                    Canvas.SetLeft(ellipse, x * 30);
                    Canvas.SetTop(ellipse, y * 30);
                }
            }
            //we need to set the size of a canvas explicitly
            //because it doesn´t calculate the desired size from its content
            canvas.Width = 20 * 30 + 10 * 2;
            canvas.Height = 20 * 30 + 10 * 2;
            scrollViewer.Child = canvas;

            // Add the scroll viewer to the window.
            mainWindow.Child = scrollViewer;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the scroll viewer
            // to be able to scroll with the up down right and left buttons
            Buttons.Focus(scrollViewer);

            return mainWindow;
        }
示例#25
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            Text help = new Text();
            help.Font = Resources.GetFont(Resources.FontResources.nina14);
            help.TextContent = "Buttons: UP resets, SEL Syncs, DOWN schedules";
            help.HorizontalAlignment = HorizontalAlignment.Center;
            help.VerticalAlignment = VerticalAlignment.Top;

            time.Font = Resources.GetFont(Resources.FontResources.small);
            time.TextContent = "Initializing...";
            time.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
            time.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;

            // Add the text controls to the window.
            Panel panel = new Panel();
            panel.Children.Add(help);
            panel.Children.Add(time);
            mainWindow.Child = panel;

            // Connect the button handler to all of the buttons.
            mainWindow.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            clockTimer = new DispatcherTimer(mainWindow.Dispatcher);
            clockTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
            clockTimer.Tick += new EventHandler(ClockTimer_Tick);

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            TimeService.SystemTimeChanged += new SystemTimeChangedEventHandler(TimeService_SystemTimeChanged);
            TimeService.TimeSyncFailed += new TimeSyncFailedEventHandler(TimeService_TimeSyncFailed);

            clockTimer.Start();

            return mainWindow;
        }
示例#26
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            _panel = new MyPanel();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            Text t = new Text(Resources.GetFont(Resources.FontResources.small), "Shape Tests !");
            t.VerticalAlignment = VerticalAlignment.Center;
            t.HorizontalAlignment = HorizontalAlignment.Center;
            _panel.Children.Add(t);
            mainWindow.Child = _panel;
            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#27
0
        /// <summary>This method is run when the mainboard is powered up or reset</summary>
        public void ProgramStarted()
        {
            Debug.Print("Program Started");

            this.canvas = new Canvas();
            
            this.window = this.oledDisplay.WPFWindow;
            this.window.Child = this.canvas;

            Timer timer = new Timer(34);
            timer.Tick += new Timer.TickEventHandler(TimerTick);
            timer.Start();

            game = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
            scoreFont = Resources.GetFont(Resources.FontResources.NinaB);

            joystick.JoystickReleased += new Joystick.JoystickEventHandler(Player1JoystickReleased);

            InitBall();
        }
示例#28
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            Canvas canvas = new Canvas();

            // Create a single text control and add it to the canvas
            Font font = Resources.GetFont(Resources.FontResources.small);
            Text text = new Text(font, "I am a racer.");
            Canvas.SetLeft(text, 50);
            Canvas.SetTop(text, 200);
            canvas.Children.Add(text);

            // Create an image and add it to the canvas
            Bitmap racer = Resources.GetBitmap(Resources.BitmapResources.Racer);
            Image image = new Image(racer);
            Canvas.SetLeft(image, 10);
            Canvas.SetTop(image, 10);
            canvas.Children.Add(image);

            // Create a rectangle shape and add it to the canvas
            Rectangle rect = new Rectangle();
            rect.Fill = new SolidColorBrush(Colors.Blue);
            rect.Width = 100;
            rect.Height = 50;
            Canvas.SetLeft(rect, 200);
            Canvas.SetTop(rect, 50);
            canvas.Children.Add(rect);

            // Add the canvas to the window.
            mainWindow.Child = canvas;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#29
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create Ink Canvas
            InkCanvas inkCanvas = new InkCanvas(0, 0, mainWindow.Width, mainWindow.Height);
            // Subscribe to event handler to get notified of gestures
            inkCanvas.Gesture += new InkCollectorGestureEventHandler(inkCanvas_Gesture);

            // Add the text control to the window.
            mainWindow.Child = inkCanvas;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }
示例#30
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            StackPanel panel = new StackPanel(Orientation.Vertical);

            // Create a single text control and add it to the panel
            Font font = Resources.GetFont(Resources.FontResources.small);
            Text text = new Text(font, "I am a racer.");
            text.HorizontalAlignment = HorizontalAlignment.Left;
            panel.Children.Add(text);

            // Create an image and add it to the panel
            Bitmap racer = Resources.GetBitmap(Resources.BitmapResources.Racer);
            Image image = new Image(racer);
            image.HorizontalAlignment = HorizontalAlignment.Left;
            panel.Children.Add(image);

            // Create a rectangle shape and add it to the panel
            Rectangle rect = new Rectangle();
            rect.HorizontalAlignment = HorizontalAlignment.Left;
            rect.Fill = new SolidColorBrush(Colors.Blue);
            rect.Width = 100;
            rect.Height = 50;
            panel.Children.Add(rect);

            // Add the panel to the window.
            mainWindow.Child = panel;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            return mainWindow;
        }