Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DateTimeOffset start   = DateTimeOffset.UtcNow;
            int            rcvmess = 0;

            int.TryParse(tbQtt.Text, out int qttMess);
            if (qttMess > 0)
            {
                catcher.SetEvent(lblDuration, new EventHandler <string>(this.EvHandler));
                var actor = new BaseActor(new Behavior <string>(t => { return(true); }, t =>
                {
                    rcvmess++; if (rcvmess >= qttMess)
                    {
                        DateTimeOffset end = DateTimeOffset.UtcNow;
                        catcher.SendMessage(string.Format("start {0} end {1} Duration{2}",
                                                          start.ToString(), end.ToString(), end.Subtract(start).ToString()));
                    }
                }
                                                                ));
                for (int i = 0; i < qttMess; i++)
                {
                    actor.SendMessage("go");
                }
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int lMax  = 8;
            int lAccu = 0;

            catcher.SetEvent(listBox1, new EventHandler <string>(this.EvHandler));
            PointActor pa   = new PointActor();
            BaseActor  accu = new BaseActor(new Behavior <int>(
                                                i =>
            {
                lAccu++;
                catcher.SendMessage(lAccu.ToString());
            }
                                                ));

            pa.SendMessage("AddLevel", 0, lMax);
            pa.SendMessage("GiveLevel", (IActor)accu);
        }