public class InputDlg : Dialog
{
	public string[] info;

	public TField tfInput;

	public TField tfInput2;

	public IAction okAction;

	public IAction backAction;

	private int dis;

	private Command back;

	public InputDlg()
	{
		dis = (CCanvas.isTouch ? 15 : 0);
		tfInput = new TField();
		tfInput.width = CCanvas.w - 70;
		if (tfInput.width > 300)
		{
			tfInput.width = 300;
		}
		tfInput.x = CCanvas.w - tfInput.width >> 1;
		tfInput.y = CCanvas.h - CScreen.ITEM_HEIGHT - 58 - dis;
		tfInput.height = CScreen.ITEM_HEIGHT + 2;
		tfInput.isFocus = true;
		tfInput.cmdClear.x = CCanvas.w / 2 + 5;
		tfInput.cmdClear.y = tfInput.y + 40;
		if (!CCanvas.isTouch)
		{
			right = tfInput.cmdClear;
		}
	}

	public void initChatTextField()
	{
		dis = (CCanvas.isTouch ? 15 : 0);
		tfInput = new TField();
		tfInput.width = CCanvas.w - 70;
		if (tfInput.width > 300)
		{
			tfInput.width = 300;
		}
		tfInput.x = CCanvas.w - tfInput.width >> 1;
		tfInput.y = CCanvas.h - CScreen.ITEM_HEIGHT - 58 - dis;
		tfInput.height = CScreen.ITEM_HEIGHT + 2;
		tfInput.isFocus = true;
		tfInput.cmdClear.x = CCanvas.w / 2 + 5;
		tfInput.cmdClear.y = tfInput.y + 40;
		if (!CCanvas.isTouch)
		{
			right = tfInput.cmdClear;
		}
	}

	public void setPayment(string info, Command ok, Command back)
	{
		tfInput.name = "Mã thẻ";
		tfInput.setText(string.Empty);
		tfInput.setIputType(TField.INPUT_TYPE_NUMERIC);
		tfInput2 = new TField();
		tfInput2.name = "Số seri";
		tfInput2.setIputType(TField.INPUT_ALPHA_NUMBER_ONLY);
		tfInput2.width = tfInput.width;
		tfInput2.height = tfInput.height;
		tfInput2.x = tfInput.x;
		tfInput2.y = tfInput.y - 30;
		tfInput2.isFocus = true;
		tfInput.isFocus = false;
		tfInput2.cmdClear.x = CCanvas.w / 2 + 5;
		tfInput2.cmdClear.y = tfInput.y + 40;
		tfInput.strInfo = "Mã thẻ";
		tfInput2.strInfo = "Số seri";
		if (!CCanvas.isTouch)
		{
			right = tfInput2.cmdClear;
		}
		if (back.caption.Equals(string.Empty))
		{
			back.caption = L.close();
		}
		this.info = mFont.tahoma_7b_lightblue.splitFontArray(info, CCanvas.w - 40);
		if (CCanvas.isTouch)
		{
			ok.x = CCanvas.w / 2 - 80;
			ok.y = tfInput.y + 40;
			back.x = CCanvas.w / 2 + 5;
			back.y = ok.y;
		}
		this.back = back;
		center = ok;
		center.caption = "OK";
	}

	public void setInfo(string info, Command ok, Command back, int type)
	{
		tfInput2 = null;
		tfInput.name = string.Empty;
		tfInput.setText(string.Empty);
		tfInput.setIputType(type);
		if (back.caption.Equals(string.Empty))
		{
			back.caption = L.close();
		}
		this.info = mFont.tahoma_7b_lightblue.splitFontArray(info, CCanvas.w - 40);
		if (CCanvas.isTouch)
		{
			ok.x = CCanvas.w / 2 - 80;
			ok.y = tfInput.y + 40;
			back.x = CCanvas.w / 2 + 5;
			back.y = ok.y;
		}
		this.back = back;
		center = ok;
		center.caption = "OK";
	}

	public override void paint(mGraphics g)
	{
		CScreen.paintBorderRect2(g, tfInput.x - 10, CCanvas.h - 105 - dis - ((tfInput2 != null) ? 30 : 0), tfInput.width + 20, ((!CCanvas.isTouch) ? 65 : 85) + ((tfInput2 != null) ? 30 : 0));
		int num = CCanvas.h - 45 - 50 - (info.Length >> 1) * mFont.tahoma_7b_lightblue.getHeight() - ((tfInput2 != null) ? 30 : 0);
		int num2 = 0;
		int num3 = num;
		while (num2 < info.Length)
		{
			mFont.tahoma_7b_dark.drawString(g, info[num2], CCanvas.hw, num3 - dis, 2);
			num2++;
			num3 += mFont.tahoma_7b_lightblue.getHeight();
		}
		if (tfInput2 != null)
		{
			tfInput2.paint(g);
		}
		tfInput.paint(g);
		base.paint(g);
	}

	public override void keyPress(int keyCode)
	{
		if (tfInput.isFocus)
		{
			tfInput.keyPressed(keyCode);
		}
		if (tfInput2 != null && tfInput2.isFocus)
		{
			tfInput2.keyPressed(keyCode);
		}
		base.keyPress(keyCode);
	}

	public override void update()
	{
		if (TouchScreenKeyboard.visible)
		{
			mGraphics.addYWhenOpenKeyBoard = 0;
		}
		if (tfInput.getText().Equals(string.Empty))
		{
			right = back;
		}
		else
		{
			right = tfInput.cmdClear;
		}
		tfInput.update();
		if (tfInput2 != null)
		{
			if (CCanvas.keyPressed[2])
			{
				CCanvas.keyPressed[2] = false;
				tfInput.isFocus = !tfInput.isFocus;
				tfInput2.isFocus = !tfInput2.isFocus;
			}
			else if (CCanvas.keyPressed[8])
			{
				CCanvas.keyPressed[8] = false;
				tfInput.isFocus = !tfInput.isFocus;
				tfInput2.isFocus = !tfInput2.isFocus;
			}
			tfInput2.update();
		}
		base.update();
	}

	public override void show()
	{
		tfInput.clearAllText();
		if (tfInput2 != null)
		{
			tfInput2.clearAllText();
		}
		CCanvas.currentDialog = this;
	}
}
