Beispiel #1
0
        }// Program-End with Exit-Button

        private async void button_Start_Click(object sender, EventArgs e)
        {
            // Definition and Initiation
            Random rand = new Random(); // generation of instance of Random-class. in case of (number) = defined random value
            int    Size = 460;          // definition of scale of playground

            // Generation of MainMathode instance
            MainMethods Ausgabe = new MainMethods();

            // Definition of output window and return control instance
            Control outputWin = Ausgabe.OutPut_Window(); // return Graphics instance for further use

            // Generation of PicturBox (w/ image) for graphic plotted in
            PictureBox Field = Ausgabe.GenPicBox(outputWin);

            // Generation of Graphics instance correlated to image in picturebox
            Graphics g = Graphics.FromImage(Field.Image);

            // Generation of playground
            int[,] playground = Ausgabe.PlayGround(g, Size, radioButton_Point, radioButton_Wall, radioButton_WP, radioButton_PPP);

            // Simulate growth
            await Task.Run(() => Ausgabe.OutPut(Field, g, rand, playground));

            // methode running in async mode -> no freezing of desktop due to long-time calculation duration of this methode

            // Dispose graphic instance
            g.Dispose();
        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Generation of MainMathode instance
            MainMethods Ausgabe1 = new MainMethods();

            //  Implementation of QR-code to Form1
            Ausgabe1.Create_QRCode(this, "MIT Licence\nCopyright (c) 2020 SNUF2020\n\nhttps://github.com/SNUF2020");
        }
Beispiel #3
0
        }// Program-End with Exit-Button

        private async void button_Start_Click(object sender, EventArgs e)
        {
            // Definition and Initiation
            Random rand = new Random(); // generation of instance of Random-class. in case of (number) = defined random value
            int    Size = 400;          // definition of scale of playground

            // Generation of MainMathode instance
            MainMethods Ausgabe = new MainMethods();

            // Definition of output window and return control instance
            Control outputPBox = Ausgabe.OutPut_Window(); // return Graphics instance for further use

            Graphics g = Graphics.FromImage(outputPBox.BackgroundImage);

            // Generation of playground
            int[,] playground = Ausgabe.PlayGround(g, Size, radioButton_Point, radioButton_Wall, radioButton_WP, radioButton_PPP);

            // Simulate growth
            await Task.Run(() => Ausgabe.OutPut(g, rand, playground));

            // methode running in asynx mode -> no freezing of desktop due to long-time calculation duration of this methode
        }