protected ModalDesktop(int width, int height) { _suspended = true; _mWidth = width; _mHeight = height; _mX = (DesktopManager.ScreenWidth - _mWidth) / 2; _mY = (DesktopManager.ScreenHeight - _mHeight) / 2; _padding = new Primitives.Point(_mX, _mY); _prevDesktop = null; _waitObject = new AutoResetEvent(false); }
protected void Show(bool blockThread = true) { _blockThread = blockThread; _prevDesktop = DesktopManager.Instance.CurrentDesktop; _screenBuffer.SetClippingRectangle(0, 0, _width, _height); _screenBuffer.DrawImage(0, 0, _prevDesktop._screenBuffer, 0, 0, _width, _height); Color overlayColor = Color.Black; _screenBuffer.DrawRectangle(overlayColor, 0, 0, 0, _width, _height, 0, 0, overlayColor, 0, 0, overlayColor, 0, _height - 1, 128); DesktopManager.Instance.AddDesktop(this); DesktopManager.Instance.SwitchDesktop(this); if (blockThread) _waitObject.WaitOne(); }
public bool SwitchDesktop(Desktop desktop) { if (_currentDesktop != null) { _currentDesktop.Visible = false; _currentDesktop.Suspended = true; _currentDesktop.ReleaseTouchCapture(); } Desktop lastDesktop = _currentDesktop; _currentDesktop = desktop; _currentDesktop.Visible = true; _currentDesktop.Suspended = false; return true; }
public void RemoveDesktop(Desktop desktop) { RemoveDesktop(desktop, null); }
public void RemoveDesktop(Desktop toRemove, Desktop toSwitch) { if (!_desktops.Contains(toRemove) || (toSwitch != null && !_desktops.Contains(toSwitch))) return; int index = _desktops.IndexOf(toRemove); if (index < _reservedDesktops) return; _desktops.RemoveAt(index); if (_currentDesktop == toRemove) { if (toSwitch == null) { int newDesktopIndex = index - 1; if (newDesktopIndex < _reservedDesktops) newDesktopIndex = 0; SwitchDesktop((Desktop)_desktops[newDesktopIndex]); } else SwitchDesktop(toSwitch); } }
public void StartCalibration() { _inputTimeoutTimer.Change(Timeout.Infinite, Timeout.Infinite); CalibrationDesktop calDesktop = new CalibrationDesktop(new TouchCalibrationPoints()); calDesktop.CalibrationComplete += calDesktop_CalibrationComplete; calDesktop.StartCalibration(); prevDesktop = _currentDesktop; AddDesktop(calDesktop); SwitchDesktop(calDesktop); }
internal Desktop AddDesktop(Desktop desktop) { if (_desktops.Contains(desktop)) return desktop; desktop.Visible = false; desktop.Suspended = true; _desktops.Add(desktop); return desktop; }
private EditDesktop() { _lastDesktop = null; Suspended = true; _bmpEnter = Mp.Ui.Resources.Images.GetBitmap(Resources.Images.BitmapResources.enter); _bmpEnter.MakeTransparent(Colors.Fuchsia); Utils.ChangeBitmapColor(_bmpEnter, Colors.Fuchsia, StyleManager.CurrentStyle.ButtonEnabledTextColor); _bmpBackspace = Mp.Ui.Resources.Images.GetBitmap(Resources.Images.BitmapResources.backspace); _bmpBackspace.MakeTransparent(Colors.Fuchsia); Utils.ChangeBitmapColor(_bmpBackspace, Colors.Fuchsia, StyleManager.CurrentStyle.ButtonEnabledTextColor); StyleManager.StyleChanged += (oldStyle, newStyle) => { Utils.ChangeBitmapColor(_bmpEnter, Colors.Fuchsia, newStyle.ButtonEnabledTextColor); Utils.ChangeBitmapColor(_bmpBackspace, Colors.Fuchsia, newStyle.ButtonEnabledTextColor); }; CreateCommonLayout(); int panelHeight = _height - _doneButton.ScreenBottom - _uiMargin; CreateQwertyLayout(_qwertyPanel = new Panel(0, _height - panelHeight, _width, panelHeight)); CreateNumericLayout(_numericPanel = new Panel(0, _height - panelHeight, _width, panelHeight) { _visible = false }); base.AddChild(_qwertyPanel); base.AddChild(_numericPanel); _ignoreAllowedCharsChanges = true; AllowedCharTypes = AllowedCharTypesEnum.All; _ignoreAllowedCharsChanges = false; }
public void Open() { if (DesktopManager.Instance.CurrentDesktop == this) return; _lastDesktop = DesktopManager.Instance.CurrentDesktop; DesktopManager.Instance.SwitchDesktop(this); }