Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Threading;
- using Microsoft.SPOT;
- using Microsoft.SPOT.Presentation;
- using Microsoft.SPOT.Presentation.Controls;
- using Microsoft.SPOT.Presentation.Media;
- using Microsoft.SPOT.Presentation.Shapes;
- using Microsoft.SPOT.Touch;
- using Gadgeteer.Networking;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using Gadgeteer.Modules.GHIElectronics;
- namespace GadgeteerApp4
- {
- public partial class Program
- {
- #region Programos sablonas
- #region kintamuju aprasymas
- private Boolean timerPaleistas = false;
- private GT.Timer timer = new GT.Timer(2);
- private GT.Timer timer2 = new GT.Timer(200);
- private int minutes = 0;
- private int sekundes = 0;
- private Font font = Resources.GetFont(Resources.FontResources.NinaB);
- private Font font2 = Resources.GetFont(Resources.FontResources.consolas_72);
- private Font font3 = Resources.GetFont(Resources.FontResources.Arial_18);
- private Window window;
- private Canvas canvas;
- private Text antraste;
- private Text laikas;
- private Text vlinija;
- private Text linija;
- int x = 0;
- int t = 55;
- private int sk = 1;
- private Image paleistiStabdyti;
- private Image atkurti;
- #endregion
- void ProgramStarted()
- {
- /*******************************************************************************************
- Modules added in the Program.gadgeteer designer view are used by typing
- their name followed by a period, e.g. button. or camera.
- Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
- button.ButtonPressed +=<tab><tab>
- If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
- GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
- timer.Tick +=<tab><tab>
- timer.Start();
- *******************************************************************************************/
- // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
- Debug.Print("Program Started");
- timer2.Tick += new GT.Timer.TickEventHandler(timer_Tick);
- timer.Tick += new GT.Timer.TickEventHandler(timer_Tick2);
- SetupWindow();
- }
- void timer_Tick(GT.Timer timer)
- {
- //linija = new Text(font, "");
- //linija.ForeColor = GT.Color.Black;
- //canvas.Children.Add(linija);
- displayT43.SimpleGraphics.DisplayTextInRectangle(sk.ToString(), 10, t, 30, 15, Color.Black, font);
- displayT43.SimpleGraphics.DisplayTextInRectangle(lightSense.GetIlluminance().ToString(), 60, t, 250, 15, Color.Black, font);
- //Canvas.SetLeft(linija, 50);
- //Canvas.SetTop(linija, t);
- //if (t >= 290)
- t += 30;
- sk += 1;
- }
- void timer_Tick2(GT.Timer timer)
- {
- vlinija = new Text(font, "");
- linija = new Text(font, "");
- linija.ForeColor = GT.Color.Black;
- canvas.Children.Add(linija);
- linija.TextContent += "--------------------------------------------------------------------------------------------------";
- vlinija.TextContent += "------------";
- displayT43.SimpleGraphics.DisplayTextInRectangle("L", 20, x, 15, 15, Color.Black, font);
- //Canvas.SetLeft(vlinija, 30);
- //Canvas.SetTop(vlinija, x);
- //Canvas.SetLeft(linija, 0);
- //Canvas.SetTop(linija, x);
- x += 30;
- }
- void SetupWindow()
- {
- #region Lango elementu konfiguravimas
- window = displayT43.WPFWindow;
- canvas = new Canvas();
- window.Child = canvas;
- //paleistiStabdyti = new Image(Resources.GetBitmap(Resources.BitmapResources.Paleisti_Stabdyti));
- //atkurti = new Image(Resources.GetBitmap(Resources.BitmapResources.Atkurti));
- //canvas.Children.Add(paleistiStabdyti);
- //canvas.Children.Add(atkurti);
- //Canvas.SetLeft(paleistiStabdyti, 10);
- //Canvas.SetTop(paleistiStabdyti, 230);
- //Canvas.SetLeft(atkurti, 230);
- //Canvas.SetTop(atkurti, 230);
- //antraste = new Text(font2, "Laikmatis");
- //antraste.ForeColor = GT.Color.Black;
- //laikas = new Text(font, "00:00");
- //laikas.ForeColor = GT.Color.Black;
- //canvas.Children.Add(antraste);
- //canvas.Children.Add(laikas);
- //Canvas.SetLeft(antraste, 140);
- //Canvas.SetTop(antraste, 0);
- //Canvas.SetLeft(laikas, 100);
- //Canvas.SetTop(laikas, 120);
- #endregion
- #endregion
- //Veiksmas 1
- //timer.Start();
- //timer2.Start();
- //Veiksmas 2
- button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
- button2.ButtonPressed += new Button.ButtonEventHandler(button2_ButtonPressed);
- button2.ButtonReleased += new Button.ButtonEventHandler(button2_ButtonReleased);
- //Veiksmas 3
- }
- void button2_ButtonReleased(Button sender, Button.ButtonState state)
- {
- timer2.Stop();
- }
- void button2_ButtonPressed(Button sender, Button.ButtonState state)
- {
- timer2.Start();
- }
- void button_ButtonPressed(Button sender, Button.ButtonState state)
- {
- displayT43.SimpleGraphics.DisplayRectangle(Color.Black, 1, Color.White, 0, 0, 45, 25);
- displayT43.SimpleGraphics.DisplayRectangle(Color.Black, 1, Color.White, 50, 0, 200, 25);
- displayT43.SimpleGraphics.DisplayTextInRectangle("Nr.", 5, 5, 30, 15, Color.Black, font);
- displayT43.SimpleGraphics.DisplayTextInRectangle("LightSense module readings", 55, 5, 200, 15, Color.Black, font);
- displayT43.SimpleGraphics.DisplayRectangle(Color.Black, 1, Color.White, 50, 30, 200, 250);
- displayT43.SimpleGraphics.DisplayRectangle(Color.Black, 1, Color.White, 0, 30, 45, 250);
- displayT43.SimpleGraphics.DisplayRectangle(Color.White, 1, Color.White, 260, 0, 300, 500);
- t = 35;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement