Exemple #1
0
        /// <summary>
        /// Meteo
        /// </summary>
        public static void Meteo()
        {
            Util.Setup();
            ImageClassList meteoImgs = new ImageClassList("Images/Meteo");

            Task.Run(() =>
            {
                DateTime update = DateTime.Now.AddMinutes(-10);
                int task        = Util.StartTask();

                while (Util.TaskWork(task))
                {
                    if (Util.Meteo is current meteo)
                    {
                        meteoImgs.SetPixel(meteo.weather.icon, Util.Context.Pixels);
                    }

                    Util.Context.Pixels.SetMeteo(Util.Meteo, Heure);

                    Util.SetLeds();
                    Util.Context.Pixels.Reset();

                    if (update.AddMinutes(5) < DateTime.Now)
                    {
                        update = DateTime.Now;
                        Util.GetMeteoAsync();
                    }
                }
            });
        }
Exemple #2
0
        /// <summary>
        /// Constructeur
        /// </summary>
        public AnimationModel(string id)
        {
            FileNameID = id;
            Animations = new ImageClassList("Images/Animation");

            if (string.IsNullOrWhiteSpace(FileNameID) && !Util.Autorun)
            {
                Task.Run(() =>
                {
                    Util.Autorun = true;

                    int i = 0;

                    while (Util.Autorun)
                    {
                        FileNameID = Animations[i++].FileNameID;
                        ShowAnimation();

                        using (ManualResetEventSlim waitHandle = new ManualResetEventSlim(false))
                            waitHandle.Wait(TimeSpan.FromSeconds(10));

                        if (Animations.Count <= i)
                        {
                            i = 0;
                        }
                    }
                });
            }
            else if (!string.IsNullOrWhiteSpace(FileNameID))
            {
                Util.Autorun = false;

                ShowAnimation();
            }
        }