using QC.QTMDotNetKernelInterface;
using QC.QTMToolKit.Tools;

namespace QC.QTMToolKit;

internal class MessageBoxWithInput
{
	private string msgLabel;

	private string okBtnLabel;

	private string cancelBtnLabel;

	private string comboValues;

	private string comments;

	private string result;

	private string imageFile;

	private int width;

	private int height;

	[QTMParameter(ParameterIOType.Input, DefaultValue = "Message ", TestList = "MessageBoxWithInputAndImage ", Description = "Message text to display in the dialog. \"\\n\" and \"\\r\" are treated as new line characters.")]
	public string Message
	{
		get
		{
			return msgLabel;
		}
		set
		{
			msgLabel = value;
		}
	}

	[QTMParameter(ParameterIOType.Input, DefaultValue = "Ok ", TestList = "MessageBoxWithInputAndImage ", Description = "Text for the OK Button ")]
	public string OKBtnLabel
	{
		get
		{
			return okBtnLabel;
		}
		set
		{
			okBtnLabel = value;
		}
	}

	[QTMParameter(ParameterIOType.Input, DefaultValue = "Cancel ", TestList = "MessageBoxWithInputAndImage ", Description = "Text for Cancel Button ")]
	public string CancelBtnLabel
	{
		set
		{
			cancelBtnLabel = value;
		}
	}

	[QTMParameter(ParameterIOType.Input, DefaultValue = "1;2;3 ", TestList = "MessageBoxWithInputAndImage ", Description = "; separated values for the drop down box ")]
	public string ComboValues
	{
		set
		{
			comboValues = value;
		}
	}

	[QTMParameter(ParameterIOType.Output, TestList = " MessageBoxWithInputAndImage", Description = " Selection from the drop down box")]
	public string Comments
	{
		get
		{
			return comments;
		}
		set
		{
			comments = value;
		}
	}

	[QTMParameter(ParameterIOType.Output, TestList = " MessageBoxWithInputAndImage", Description = "Text of the ok/cancel button")]
	public string Result => result;

	[QTMParameter(ParameterIOType.Input, DefaultValue = " ", TestList = " MessageBoxWithInputAndImage", Description = "File name for the image to be displayed ", DisplayHint = DisplayHints.FILE, NumberOfElements = 1)]
	public string ImageFile
	{
		get
		{
			return imageFile;
		}
		set
		{
			imageFile = value;
		}
	}

	[QTMParameter(ParameterIOType.Input, DefaultValue = "760", TestList = "MessageBoxWithInputAndImage ", Description = "The initial width of the dialog ")]
	public int Width
	{
		get
		{
			return width;
		}
		set
		{
			width = value;
		}
	}

	[QTMParameter(ParameterIOType.Input, DefaultValue = "350", TestList = "MessageBoxWithInputAndImage ", Description = "The initial height of the dialog ")]
	public int Height
	{
		get
		{
			return height;
		}
		set
		{
			height = value;
		}
	}

	[QTMTest(Description = "Displays a MessageBox with text box for input and an image on the side", CanAddToTestPlan = true)]
	public bool MessageBoxWithInputAndImage()
	{
		MessageBoxWithInputAndOutputFrm messageBoxWithInputAndOutputFrm = new MessageBoxWithInputAndOutputFrm();
		int Index = -1;
		SerialNumber.GetCurrentUnitIndex(out Index);
		messageBoxWithInputAndOutputFrm.Caption = "Display At " + Index;
		messageBoxWithInputAndOutputFrm.Message = Message;
		messageBoxWithInputAndOutputFrm.CancelBtnLabel = cancelBtnLabel;
		messageBoxWithInputAndOutputFrm.OKBtnLabel = okBtnLabel;
		messageBoxWithInputAndOutputFrm.ImageFile = ImageFile;
		messageBoxWithInputAndOutputFrm.ComboValues = comboValues;
		if (width > 0)
		{
			messageBoxWithInputAndOutputFrm.Width = width;
		}
		if (height > 0)
		{
			messageBoxWithInputAndOutputFrm.Height = height;
		}
		messageBoxWithInputAndOutputFrm.ShowDialog();
		Comments = messageBoxWithInputAndOutputFrm.Comments;
		result = messageBoxWithInputAndOutputFrm.result;
		return true;
	}
}
