コード例 #1
0
        // On worker thread so do our thing!


        void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            //initialMesage();
            int max_time = 20;
            int time     = 1;

            m = new Matrix.Matrix();


            do
            {
                if (time % 1 == 0 && !m.end())
                {
                    //Accion del personaje
                    m.actionPg();
                }
                if (time % 2 == 0 && !m.end())
                {
                    //Accion de smith
                    m.smithAction2();
                }
                if (time % 5 == 0 && !m.end())
                {
                    //Accion de neo
                    m.actionNeo();
                }
                backgroundWorker1.ReportProgress(time);
                System.Threading.Thread.Sleep(1000);
                time += 1;

                //nuevo.label1.Text = (progressBar1.Value.ToString() + "%");
            } while (time <= max_time && !m.end());
        }
コード例 #2
0
        // On worker thread so do our thing!


        void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            int cont = 0;

            while (cont < 5)
            {
                System.Threading.Thread.Sleep(2000);
                backgroundWorker1.ReportProgress(cont);
                cont++;
            }
            int max_time = 20;
            int time     = 1;

            m = new Matrix.Matrix();


            do
            {
                if (time % 1 == 0 && !m.end())
                {
                    //Accion del personaje
                    m.actionPg();
                }
                if (time % 2 == 0 && !m.end())
                {
                    //Accion de smith
                    m.smithAction2();
                    this.infect = m.getDead();
                }
                if (time % 5 == 0 && !m.end())
                {
                    //Accion de neo
                    m.actionNeo();
                }
                backgroundWorker1.ReportProgress(time);
                System.Threading.Thread.Sleep(1500);
                time += 1;
            } while (time <= max_time && !m.end());
        }