예제 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Inicial inicial = new Inicial();

            inicial.Show();
            Application.Run();
        }
예제 #2
0
        // Back on the 'UI' thread so we can update the progress bar
        void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            int cont = e.ProgressPercentage;


            if (cont < 5 && !this.control)
            {
                this.txtArea.AppendText(this.whiteRabbit[cont] + String.Format(Environment.NewLine));
                if (cont == 4)
                {
                    this.control = true;
                }
            }
            else
            {
                // The progress percentage is a property of e
                progressBar1.Value = e.ProgressPercentage;

                if (e.ProgressPercentage % 2 == 0)
                {
                    txtArea.AppendText(String.Format(Environment.NewLine));
                    txtArea.AppendText(this.smithDialogue[Useful.random_Number(0, this.smithDialogue.GetLength(0))] + String.Format(Environment.NewLine));
                    if (this.infect > 0)
                    {
                        txtArea.AppendText("# Smith has killed " + this.infect + " people!!" + String.Format(Environment.NewLine));
                    }
                    else
                    {
                        txtArea.AppendText("# Good news, smith hasn't killed anyone!!" + String.Format(Environment.NewLine));
                    }
                }
                if (e.ProgressPercentage % 5 == 0)
                {
                    txtArea.AppendText(String.Format(Environment.NewLine));
                    if (m.getBelieved())
                    {
                        txtArea.AppendText(this.neoDialogue[Useful.random_Number(0, this.neoDialogue.GetLength(0))] + String.Format(Environment.NewLine));
                    }
                }



                printDataView();
                this.dataGridView1.ClearSelection();
                // Aqui actualizamos el datagridview con los datos, osea el m.print que haciamos por consola

                if (e.ProgressPercentage == 20)
                {
                    final = new Final();
                    final.Show();
                    Inicial ts = (Inicial)Application.OpenForms["Inicial"];
                    ts.Close();
                }
            }
        }