/// <summary> /// Creates a new Window. /// </summary> /// <param name="name">Name of the Window.</param> /// <param name="width">Width</param> /// <param name="height">Height</param> public Window(string name, int width, int height) { Name = name; X = 0; Y = 0; Width = width; Height = height; Graphics = new Graphics(width, height); ListY = 0; AutoHeight = true; }
/// <summary> /// Creates a new CalibrationWindow. /// </summary> /// <param name="autoStart">Whether or not to automatically begin calibration.</param> /// <param name="autoSave">Whether or not to save the calibration settings using Extended Weak Reference.</param> public CalibrationWindow(bool autoStart, bool autoSave) { _autoStart = autoStart; _autoSave = autoSave; Settings = new CalibrationSettings(); Name = "calibrationWindow"; Width = Glide.LCD.Width; Height = Glide.LCD.Height; BackColor = Colors.White; Graphics = new Graphics(Width, Height); int yPos = (Height / 2) - 50; _text1 = new TextBlock("text1", 255, (Glide.LCD.Width - 300) / 2, yPos, 300, 50); _text1.Font = FontManager.GetFont(FontManager.FontType.droid_reg12); _text1.TextAlign = HorizontalAlignment.Center; AddChild(_text1); yPos += 50 + 5; _startBtn = new Button("startBtn", 255, (Width - 200) / 2, yPos, 122, 32); _startBtn.Text = "Recalibrate"; _startBtn.TapEvent += new OnTap(_startBtn_TapEvent); _startBtn.Visible = false; AddChild(_startBtn); _exitBtn = new Button("exitBtn", 255, _startBtn.X + _startBtn.Width + 10, yPos, 68, 32); _exitBtn.Text = "Done"; _exitBtn.TapEvent += new OnTap(_exitBtn_TapEvent); _exitBtn.Visible = false; AddChild(_exitBtn); _canvas = new Canvas(); AddChild(_canvas); if (_autoStart) { _text1.FontColor = Colors.Black; _text1.Text = "Touch the crosshair location."; Start(); } else { if (GlideTouch.Calibrated) { _text1.FontColor = Colors.Red; _text1.Text = "Touch is already calibrated."; _exitBtn.Visible = true; _startBtn.Visible = true; } else { _text1.FontColor = Colors.Black; _text1.Text = "Touch the screen to start."; TapEvent += new OnTap(CalibrationWindow_TapEvent); } } }