private void LocationHandler(object sender, EventArgs e)
{
AutoClicker.LocationType locationType;
int x = -1;
int y = -1;
int width = -1;
int height = -1;
if (rdbLocationFixed.Checked)
{
locationType = AutoClicker.LocationType.Fixed;
x = (int)numFixedX.Value;
y = (int)numFixedY.Value;
}
else if (rdbLocationMouse.Checked)
{
locationType = AutoClicker.LocationType.Cursor;
}
else if (rdbLocationRandom.Checked)
{
locationType = AutoClicker.LocationType.Random;
}
else
{
locationType = AutoClicker.LocationType.RandomRange;
x = (int)numRandomX.Value;
y = (int)numRandomY.Value;
width = (int)numRandomWidth.Value;
height = (int)numRandomHeight.Value;
}
// Toggle visibility of controls.
if (locationType == AutoClicker.LocationType.Fixed)
{
numFixedX.Enabled = true;
numFixedY.Enabled = true;
}
else
{
numFixedX.Enabled = false;
numFixedY.Enabled = false;
}
if (locationType == AutoClicker.LocationType.RandomRange)
{
numRandomX.Enabled = true;
numRandomY.Enabled = true;
numRandomWidth.Enabled = true;
numRandomHeight.Enabled = true;
btnSelect.Enabled = true;
}
else
{
numRandomX.Enabled = false;
numRandomY.Enabled = false;
numRandomWidth.Enabled = false;
numRandomHeight.Enabled = false;
btnSelect.Enabled = false;
}
clicker.UpdateLocation(locationType, x, y, width, height);
}