예제 #1
0
        //For drawing image
        public void PutImg(string filepath)
        {
            if (targetForm.InvokeRequired)
            {
                targetForm.Invoke(new CrossThreadCallBackStr(PutImg), filepath);
            }
            else
            {
                if (!MediaCache.preloadedImg.ContainsKey(filepath))
                {
                    if (File.Exists(Environment.CurrentDirectory + @"\Media\img\" + filepath))
                    {
                        MediaCache.preloadedImg.Add(filepath, Image.FromFile(Environment.CurrentDirectory + @"\Media\img\" + filepath));
                    }
                }
                if (!StatusMonitor.dragging)
                {
                    targetForm.Location = new Point(Configuration.frmPosX - MediaCache.preloadedImg[filepath].Width, Configuration.frmPosY - MediaCache.preloadedImg[filepath].Height);
                }

                APIDraw.UpdateFormDisplay(MediaCache.preloadedImg[filepath], targetForm);
                Configuration.frmHeight = MediaCache.preloadedImg[filepath].Height;
                Configuration.frmWidth  = MediaCache.preloadedImg[filepath].Width;
            }
        }
예제 #2
0
        private void aniTimer_Tick(object sender, EventArgs e)
        {
            //handles animation
            if (StatusMonitor.currentAniFrames.Count > StatusMonitor.currentFrame && this.Visible)
            {
                string frame = StatusMonitor.currentAniFrames[StatusMonitor.currentFrame];
                //put image
                if (!MediaCache.preloadedImg.ContainsKey(frame))
                {
                    if (File.Exists(Environment.CurrentDirectory + @"\Media\img\" + frame))
                    {
                        MediaCache.preloadedImg.Add(frame, Image.FromFile(Environment.CurrentDirectory + @"\Media\img\" + frame));
                    }
                }
                if (!StatusMonitor.dragging)
                {
                    this.Location = new Point(Configuration.frmPosX - MediaCache.preloadedImg[frame].Width, Configuration.frmPosY - MediaCache.preloadedImg[frame].Height);
                }

                APIDraw.UpdateFormDisplay(MediaCache.preloadedImg[frame], this);
                Configuration.frmHeight = MediaCache.preloadedImg[frame].Height;
                Configuration.frmWidth  = MediaCache.preloadedImg[frame].Width;


                //shift frame
                if (StatusMonitor.currentFrame != StatusMonitor.currentAniFrames.Count - 1)
                {
                    StatusMonitor.currentFrame = StatusMonitor.currentFrame + 1;
                }
                else
                {
                    StatusMonitor.currentFrame = 0;
                }
            }

            //handles WAIT command
            if (StatusMonitor.waiting)
            {
                if (StatusMonitor.waittime > 0)
                {
                    StatusMonitor.waittime -= aniTimer.Interval;
                }
                else
                {
                    StatusMonitor.waiting = false;
                    if (StatusMonitor.pausedScr.Count > 0)
                    {
                        tmplist = new List <string>(StatusMonitor.pausedScr);

                        Scripting.ScriptEngine.RunFromList(tmplist);

                        foreach (string cmd in tmplist)
                        {
                            StatusMonitor.pausedScr.Remove(cmd);
                        }
                    }
                }
            }
        }