private void UpdateTime()
        {
            UTCTime      = DateTime.Now.ToUniversalTime();
            LabResetTime = UTCTime.Date.AddDays(1);

            if (Settings.CurrentImageDateDay != UTCTime.Day)
            {
                ImageState = ImageCheckState.Checking;
                DeleteOldImages();
                #pragma warning disable 4014
                LoadImage();
                #pragma warning restore 4014
            }
        }
        private async Task LoadImage()
        {
            Settings.CurrentImageDateDay = UTCTime.Day;

            ImageState = ImageCheckState.Checking;
            await LoadData(UTCTime);

            if (ImageState == ImageCheckState.NotFound404)
            {
                LogMessage("New lab layout image is not created yet. Loading old image: " + (DateTime.Now.AddDays(-1).ToString("dd MMMM")), 10);

                await LoadData(DateTime.Now.AddDays(-1));

                if (ImageState == ImageCheckState.NotFound404)
                {
                    LogMessage("Failed loading OLD lab layout image: " + (DateTime.Now.AddDays(-1).ToString("dd MMMM")), 10);
                    ImageState = ImageCheckState.FailedToLoad;
                }
            }
        }
        private async Task LoadData(DateTime data)
        {
            var time  = data;
            var month = time.Month.ToString("00");
            var day   = time.Day.ToString("00");

            var tempFileName = $"{time.Year}-{month}-{day}_{Settings.LabType.Value}.jpg";

            var FilePath = Path.Combine(ImagesDirectory, tempFileName);

            if (File.Exists(FilePath))
            {
                LogMessage("Loading lab layout image from cache", 3);
                ImagePathToDraw = FilePath;
                ImageState      = ImageCheckState.ReadyToDraw;
                return;
            }

            LogMessage("Loading new lab layout image from site", 3);

            var ImageUrl = $"http://www.poelab.com/wp-content/uploads/{time.Year}/{month}/" + tempFileName;

            ImageState = ImageCheckState.Downloading;

            WebClient webClient = new WebClient();

            byte[] imageBytes = new byte[0];
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(ImageUrl);
            }
            catch// (Exception ex)
            {
                ImageState = ImageCheckState.NotFound404;
                //Not found
                return;
            }

            Bitmap downloadedImage;

            try
            {
                using (var ms = new MemoryStream(imageBytes))
                {
                    downloadedImage = new Bitmap(ms);
                }

                if (!Directory.Exists(ImagesDirectory))
                {
                    Directory.CreateDirectory(ImagesDirectory);
                }

                downloadedImage = new Bitmap(downloadedImage);//Fix for exception (bitmap save problem https://stackoverflow.com/questions/5813633/a-generic-error-occurs-at-gdi-at-bitmap-save-after-using-savefiledialog )

                downloadedImage = downloadedImage.Clone(new System.Drawing.Rectangle(302, 111, ImageWidth, ImageHeight), downloadedImage.PixelFormat);

                downloadedImage.Save(FilePath, System.Drawing.Imaging.ImageFormat.Jpeg);

                ImageState      = ImageCheckState.ReadyToDraw;
                ImagePathToDraw = FilePath;

                downloadedImage.Dispose();
            }
            catch (Exception ex)
            {
                LogError("AdvancedUberLabLayout Plugin: Error while cropping or saving image: " + ex.Message, 10);
                ImageState = ImageCheckState.FailedToLoad;
            }
            finally
            {
                //downloadedImage.Dispose();
            }
        }