Example #1
0
        //triggers running on the current loaded file
        private void buttonRunFile_Click(object sender, EventArgs e)
        {
            getFormValues();
            //init engine now otherwise everything will break
            gaEng = new GAEngineColour(bufferImage, bufferGraphics, canvas, panelDraw.Width, drawEvery, textBoxDrawInfo, userImage, pop, prKeep, prMut);
            //check if image is suitable before running
            if (gaEng.IsImageOK(userImage))
            {
                disableFormControls();
                //make sure engine triggers form controls working
                gaEng.worker.RunWorkerCompleted += enableFormControls;
                //toggle saving images based on form
                if (checkBoxSaveImages.Checked)
                {
                    gaEng.SaveImages = true;
                }

                gaEng.RunGA();
                buttonStop.Enabled = true;
            }
            else
            {
                MessageBox.Show("Image must be square 8,16,32,64,128,256,512px, but is " + userImage.Width + "x" + userImage.Height);
            }
        }
Example #2
0
        //test draw button click handler
        private void buttonColour16_Click(object sender, EventArgs e)
        {
            disableFormControls();
            getFormValues();
            //init engine now otherwise everything will break
            gaEng = new GAEngineColour(bufferImage, bufferGraphics, canvas, panelDraw.Width, drawEvery, textBoxDrawInfo, Constants.TARGET_DRAW16, Constants.TARGET_DRAW16.Length, pop, prKeep, prMut);
            //make sure engine triggers form controls working
            gaEng.worker.RunWorkerCompleted += enableFormControls;
            //toggle saving images based on form
            if (checkBoxSaveImages.Checked)
            {
                gaEng.SaveImages = true;
            }

            gaEng.RunGA();
            buttonStop.Enabled = true;
        }