private void ClickAndGetResources(Bot.Location location) { var t = new Touch(new NoOpLogger()); CommerceResourceReader reader = new CommerceResourceReader(new NoOpLogger(), t); var palleteReader = new TwoColourPallette(); pictureBox1.Image = null; pictureBox2.Image = null; pictureBox3.Image = null; this.textBox1.Text = string.Empty; this.textBox2.Text = string.Empty; this.textBox3.Text = string.Empty; var images = reader.GetResourceImages(location, resourceLocations); pictureBox1.Image = images[0]; var required = palleteReader.GetClosest2Colours(images[0]).Contains("Red"); this.textBox1.Text = required ? "Required" : "Ok"; if (images.Count > 1) { pictureBox2.Image = images[1]; required = palleteReader.GetClosest2Colours(images[1]).Contains("Red"); this.textBox2.Text = required ? "Required" : "Ok"; } if (images.Count > 2) { pictureBox3.Image = images[2]; required = palleteReader.GetClosest2Colours(images[2]).Contains("Red"); this.textBox3.Text = required ? "Required" : "Ok"; } }
private void btnAroundPosition_Click(object sender, EventArgs e) { var t = new Touch(new NoOpLogger()); CommerceResourceReader reader = new CommerceResourceReader(new NoOpLogger(), t); //pallete1.Entries.ToList().ForEach(s => textBox1.Text += GetClosestColor(colors, s) + ", "); var palleteReader = new TwoColourPallette(); pictureBox1.Image = null; pictureBox2.Image = null; pictureBox3.Image = null; this.textBox1.Text = string.Empty; this.textBox2.Text = string.Empty; this.textBox3.Text = string.Empty; var images = reader.GetResourceImages(Bot.Location.ButtonLeftInner1, resourceLocations); pictureBox1.Image = images[0]; var required = palleteReader.GetClosest2Colours(images[0]).Contains("Red"); this.textBox1.Text = required ? "Required" : "Ok"; if (images.Count > 1) { pictureBox2.Image = images[1]; required = palleteReader.GetClosest2Colours(images[1]).Contains("Red"); this.textBox2.Text = required ? "Required" : "Ok"; } if (images.Count > 2) { pictureBox3.Image = images[2]; required = palleteReader.GetClosest2Colours(images[2]).Contains("Red"); this.textBox3.Text = required ? "Required" : "Ok"; } }