RunTimeout() public static méthode

public static RunTimeout ( uint milliseconds, TimeoutHandler handler ) : uint
milliseconds uint
handler TimeoutHandler
Résultat uint
Exemple #1
0
 private void OnClientStarted(Client client)
 {
     Application.ClientStarted -= OnClientStarted;
     Application.RunTimeout(1000, delegate {
         startup_job.Finish();
         return(false);
     });
 }
Exemple #2
0
        public static void SpawnLikeFish(int count)
        {
            int i = 0;

            Application.RunTimeout(2000, delegate {
                new TestUserJob();
                return(++i < count);
            });
        }
Exemple #3
0
        public TestUserJob() : base("UserJob Test Job", "Waiting for 7.5 seconds...")
        {
            CancelRequested += OnCancelRequested;
            DelayShow        = true;
            Register();

            IconNames = new string [] { "media-eject" };

            initial_timeout_id = Application.RunTimeout(7500, delegate {
                Title = "New Title for Test Job";

                main_timeout_id = Application.RunTimeout(50, delegate {
                    Progress += 0.001;

                    if (Progress >= 0.45 && Progress <= 0.55)
                    {
                        Status = null;
                    }
                    else
                    {
                        Status = String.Format("I am {0:0.0}% complete", Progress * 100.0);
                    }

                    if (Progress >= 0.65 && Progress <= 0.75)
                    {
                        Title = null;
                    }
                    else if (Title == null)
                    {
                        Title = "The final Title";
                    }

                    if (Progress >= 0.25 && Progress <= 0.35 && icon_timeout_id == 0)
                    {
                        icon_timeout_id = Application.RunTimeout(100, delegate {
                            icon_index = (icon_index + 1) % icon_names_go.Length;
                            IconNames  = new string [] { icon_names_go [icon_index] };
                            if (Progress <= 0.35)
                            {
                                return(true);
                            }
                            icon_timeout_id = 0;
                            return(false);
                        });
                    }

                    if (Progress >= 0.45 && Progress <= 0.70 && icon_timeout_id == 0)
                    {
                        icon_timeout_id = Application.RunTimeout(250, delegate {
                            icon_index = rand.Next(0, icon_names_rand.Length - 1);
                            IconNames  = new string [] { icon_names_rand[icon_index] };
                            if (Progress <= 0.65)
                            {
                                return(true);
                            }
                            icon_timeout_id = 0;
                            return(false);
                        });
                    }

                    CanCancel = (Progress >= 0.15 && Progress <= 0.30) || (Progress >= 0.65 && Progress <= 0.85);

                    if (Progress == 1.0)
                    {
                        Progress         = 0.0;
                        Title            = "Bouncing";
                        Status           = "I'm going to bounce now...";
                        final_timeout_id = Application.RunTimeout(8000, delegate {
                            Finish();
                            return(false);
                        });

                        return(false);
                    }

                    return(true);
                });

                return(false);
            });
        }