public override void OnClick() { base.OnClick(); Tile tile = QsTile; if (tile.State == TileState.Active) { // update visual tile state tile.State = TileState.Inactive; tile.UpdateTile(); OverscanUtil.DisableOverscan(); } else if (tile.State == TileState.Inactive) { // update visual tile state tile.State = TileState.Active; tile.UpdateTile(); // todo: show warning dialog for qs tile // not a common scenario but if you press the qs tile without having tested it before // you're on your own OverscanUtil.EnableOverscan(); } }
public void ShowAlertAndEnableOverscan() { /** * Show a confirmation dialog and enable overscan. */ OverscanUtil.EnableOverscan(); if (!OverscanUtil.DialogShown) { System.Console.WriteLine("Showing alert dialog"); AlertDialog confirmAlertDialog = builder.Create(); confirmAlertDialog.SetCanceledOnTouchOutside(false); Handler mHandler = new Handler((Android.OS.Message msg) => { switch (msg.What) { case 0: if (confirmAlertDialog != null && confirmAlertDialog.IsShowing) { confirmAlertDialog.Cancel(); DisableOverscan(); } break; default: break; } }); confirmAlertDialog.Show(); mHandler.SendEmptyMessageDelayed(0, DIALOG_TIMEOUT); OverscanUtil.DialogShown = true; } }