Example #1
0
        public static void StartAnimClock()
        {
            var locationColon = 7;

            if (SettingsSDMonitor.CheckForLayout() == "Mini")
            {
                locationColon = 1;
            }

            //start loop
            while (true)
            {
                if (exitflag)
                {
                    break;
                }

                var loc = KeyBitmap.Create.FromFile(SettingsSDMonitor.ImageLocColon);
                deck.SetKeyBitmap(locationColon, loc);

                //animate clock colon every second
                System.Threading.Thread.Sleep(1000);
                deck.ClearKey(locationColon);
                System.Threading.Thread.Sleep(1000);
            }
        }
Example #2
0
        //set the static headers
        public static void SetStaticHeaders()
        {
            if (SettingsSDMonitor.CheckForLayout() == "Mini")
            {
                if (SettingsSDMonitor.isFpsCounter == "False")
                {
                    SetStaticImg("gpu", SettingsSDMonitor.KeyLocGpuHeaderMini);
                }

                SetStaticImg("cpu", SettingsSDMonitor.KeyLocCpuHeaderMini);
            }

            else
            {
                SetStaticImg("cpu", SettingsSDMonitor.KeyLocCpuHeader);
                SetStaticImg("gpu", SettingsSDMonitor.KeyLocGpuHeader);
            }
        }
Example #3
0
        //process video frames for animation
        public static void StartAnimation()
        {
            while (true)
            {
                //create instance of video reader and open video file
                VideoFileReader vidReader = new VideoFileReader();
                string          vidFile   = SharedSettings.animationImgDir + SettingsSDMonitor.animName + ".mp4";
                vidReader.Open(vidFile);

                int frameCount = Convert.ToInt32(vidReader.FrameCount);
                int adjustedCount;

                if (frameCount >= SettingsSDMonitor.framesToProcess)
                {
                    adjustedCount = SettingsSDMonitor.framesToProcess;
                }
                else
                {
                    adjustedCount = frameCount;
                }

                for (int i = 0; i < adjustedCount; i++)
                {
                    using (var vidStream = new MemoryStream())
                    {
                        //resize and save frames to MemoryStream
                        Bitmap videoFrame = new Bitmap(vidReader.ReadVideoFrame(), new Size(dimensHeight, dimensHeight));
                        videoFrame.Save(vidStream, ImageFormat.Png);

                        //dispose the video frame
                        videoFrame.Dispose();

                        //display animation from stream
                        vidStream.Seek(0, SeekOrigin.Begin);
                        var animStream = KeyBitmap.Create.FromStream(vidStream);
                        ShowAnim(animStream);
                        vidStream.Close();
                    }
                }

                vidReader.Close();

                //display animation
                void ShowAnim(KeyBitmap animStream)
                {
                    foreach (var button in SettingsSDMonitor.BgButtonList())
                    {
                        if (exitflag)
                        {
                            break;
                        }
                        deck.SetKeyBitmap(button, animStream);
                    }

                    //frametime delay
                    int frametime = SettingsSDMonitor.FrametimeValue();

                    System.Threading.Thread.Sleep(frametime);
                }
            }
        }