Esempio n. 1
0
        public void LoadImage(int imageId, string imageFile)
        {
            if (imageFileId != imageFile && imageFileId != null)
            {
                imageFile = imageFileId;
            }
            if (ImageGetter == null)
            {
                ImageGetter    = new ImageDataIntializer();
                OriginalImages = ImageGetter.LoadOrginalImages();
            }

            var modifiedImage = (Image)ImageGetter.GetBitmap(ImagIndex, imageFile);
            var preImgIndex   = ImagIndex;

            bool toggleFlag = false;

            //var imageId = 1;
            while (true)
            {
                try
                {
                    var originalKey   = imageFile + ".json";
                    var originalImage = OriginalImages[originalKey];
                    if (imageFileId != imageFile && imageFileId != null)
                    {
                        imageFile = imageFileId;
                    }
                    if ((imageFile != null) && (true || preImgIndex != ImagIndex && preImageFile != imageFile || imageFileChangeFlag))
                    {
                        modifiedImage       = (Image)ImageGetter.GetBitmap(ImagIndex, imageFile);
                        preImageFile        = imageFile;
                        imageFileChangeFlag = false;
                    }
                    if (toggleFlag)
                    {
                        pictureBox.Image = originalImage;
                        toggleFlag       = false;
                    }
                    else
                    {
                        pictureBox.Image = modifiedImage;
                        toggleFlag       = true;
                    }
                    Thread.Sleep(250);
                }
                catch (Exception Ex) {
                    MessageBox.Show(Ex.Message);
                    Application.Exit();
                }
            }
        }
Esempio n. 2
0
        public void LoadImage(int imageId, string imageFile)
        {
            if (imageFileId != null)
            {
                imageFile = imageFileId;
            }
            if (ImageGetter == null)
            {
                ImageGetter    = new ImageDataIntializer();
                OriginalImages = ImageGetter.LoadOrginalImages();
            }

            var  modifiedImage = (Image)ImageGetter.GetBitmap(ImagIndex, imageFile);
            var  preImgIndex   = ImagIndex;
            bool toggleFlag    = false;

            //var imageId = 1;
            while (true)
            {
                var originalKey   = imageFile + ".json";
                var originalImage = OriginalImages[originalKey];
                if (imageFileId != null)
                {
                    imageFile = imageFileId;
                }
                if (preImgIndex != ImagIndex)
                {
                    modifiedImage = (Image)ImageGetter.GetBitmap(ImagIndex, imageFile);
                }
                if (toggleFlag)
                {
                    pictureBox1.Image = originalImage;
                    toggleFlag        = false;
                }
                else
                {
                    pictureBox1.Image = modifiedImage;
                    toggleFlag        = true;
                }
                Thread.Sleep(250);
            }
        }