Beispiel #1
0
        protected void FixupCustomLogo()
        {
            StopAnimation();

            if (string.IsNullOrEmpty(customIcon))
            {
                return;
            }

            Bitmap newImage = FastBitmap.FromFile(customIcon);

            if (newImage == null)
            {
                return;
            }

            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            AnimatedLogo = NativeMethods.IsAnimatedGIF(customIcon);
            if (AnimatedLogo)
            {
                Logo = newImage;
            }
            else
            {
                Logo = BitmapPainter.ResizeBitmap(newImage, FileImage.ImageSize, FileImage.ImageSize, true);
            }
            SaveLogoToCache();
        }
Beispiel #2
0
        public void Dispose()
        {
            Logo?.Dispose();
            Logo = null;

            Parent = null;
        }
Beispiel #3
0
        private void LoadLogo(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                LoadDefaultLogo();
            }
            else
            {
                if (Logo != null)
                {
                    Logo.Dispose();
                    Logo = null;
                }

                string fullName = FileOperations.StripFileName(name);
                if (FileOperations.FileExists(fullName))
                {
                    Bitmap tmp = FastBitmap.FromFile(fullName);
                    if (tmp != null)
                    {
                        Logo = BitmapPainter.ConvertToRealColors(tmp, false);
                        tmp.Dispose();
                    }
                }

                if (Logo == null)
                {
                    LoadDefaultLogo();
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Unload contents
        /// </summary>
        public override void UnloadContent()
        {
            PixelCollision.Dispose();

            if (Logo != null)
            {
                Logo.Dispose();
            }

            if (Star != null)
            {
                Star.Dispose();
            }

            if (Font != null)
            {
                Font.Dispose();
            }

            if (Sprite != null)
            {
                Sprite.Dispose();
            }
            Sprite = null;
        }
Beispiel #5
0
        protected override void FixupTargetLogo()
        {
            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            if (!string.IsNullOrEmpty(targetName))
            {
                if (NativeMethods.FileExtensionIs(targetName, ".circle"))
                {
                    Logo = GetLogoFromRing(targetName);
                }
            }

            if (Logo == null)
            {
                Logo = BitmapPainter.ConvertToRealColors(KrentoRing.DefaultRingImage, false);
            }

            AnimatedLogo = ImageAnimator.CanAnimate(Logo);
            if (!AnimatedLogo)
            {
                Logo = BitmapPainter.ResizeBitmap(Logo, FileImage.ImageSize, FileImage.ImageSize, true);
            }

            SaveLogoToCache();
        }
Beispiel #6
0
 private void LoadDefaultLogo()
 {
     if (Logo != null)
     {
         Logo.Dispose();
     }
     Logo = BitmapPainter.ConvertToRealColors(DefaultRingImage, false);
 }
Beispiel #7
0
 public void DestroyLogoImage()
 {
     DeleteCacheIcon();
     if (Logo != null)
     {
         Logo.Dispose();
         Logo = null;
     }
 }
Beispiel #8
0
 //显示LOGO 3S后消失
 private void Logo_Paint(object sender, PaintEventArgs e)
 {
     new System.Threading.Thread(() =>
     {
         System.Threading.Thread.Sleep(1000 * 3);
         Logo.Dispose();
         TitlePanal.Dock = DockStyle.Top;
     }).Start();
 }
Beispiel #9
0
        public void Dispose()
        {
            Spots.ForEach(s => s.Dispose());
            Spots.Clear();

            Logo?.Dispose();
            Logo = null;

            Parent = null;
        }
Beispiel #10
0
        public virtual void Dispose()
        {
            Logo?.Dispose();
            Logo = null;

            Notes.ForEach(n => n.Dispose());
            Notes.Clear();

            Parent = null;
        }
Beispiel #11
0
        public void Dispose()
        {
            Programs.ForEach(p => p.Dispose());
            Programs.Clear();

            Logo?.Dispose();
            Logo = null;

            ContractSettings = null;

            Parent = null;
        }
Beispiel #12
0
        private void UpdateLogoBitmap(Bitmap newLogo)
        {
            StopAnimation();
            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            Logo = newLogo;
            SaveLogoToCache();
        }
        void ReleaseDesignerOutlets()
        {
            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (Domain != null)
            {
                Domain.Dispose();
                Domain = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            if (Password != null)
            {
                Password.Dispose();
                Password = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (User != null)
            {
                User.Dispose();
                User = null;
            }
        }
Beispiel #14
0
        protected void FixupCacheLogo()
        {
            //Reload image from cache
            Bitmap cacheOriginal;

            if (FileOperations.FileExists(CacheLogoName))
            {
                if (Logo != null)
                {
                    Logo.Dispose();
                    Logo = null;
                }

                cacheOriginal = FastBitmap.FromFile(CacheLogoName);
                if (cacheOriginal != null)
                {
                    if (cacheOriginal.Width == FileImage.ImageSize)
                    {
                        Logo         = BitmapPainter.ConvertToRealColors(cacheOriginal, true);
                        AnimatedLogo = false;
                    }
                }
            }
        }
Beispiel #15
0
        /// <summary>
        /// Updates the logo URL. This method must be used only in case if custom logo is not
        /// present or not provided. Check for custom logo using WebsiteImages.CustomSiteIcon method
        /// and compare result with empty string.
        /// </summary>
        /// <param name="newTarget">The new target.</param>
        private void UpdateLogoURL(string newTarget)
        {
            StopAnimation();
            Bitmap tmpBitmap = (Bitmap)FileOperations.GetSiteLogo(newTarget);

            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            AnimatedLogo = ImageAnimator.CanAnimate(tmpBitmap);

            if (!AnimatedLogo)
            {
                Logo = BitmapPainter.ResizeBitmap(tmpBitmap, FileImage.ImageSize, FileImage.ImageSize, true);
            }
            else
            {
                Logo = tmpBitmap;
            }

            SaveLogoToCache();
        }
 public void Dispose()
 {
     Logo?.Dispose();
 }
Beispiel #17
0
        public async Task <ScreenshotResult> Screenshot(string URL, string DirectoryPath, bool IncludeLogoWatermark, string WatermarkFilePath, Point CropStartPoint, Size CropSize, bool DoCropImage)
        {
            if (LoadedFine)
            {
                try
                {
                    string ImagePath = DirectoryPath + "Screenshot-" + DateTime.UtcNow.Month.ToString() + "-" + DateTime.UtcNow.Day.ToString() + "-" + DateTime.UtcNow.Year.ToString() + "-" + DateTime.UtcNow.Hour.ToString() + "h" + DateTime.UtcNow.Minute.ToString() + "m" + DateTime.UtcNow.Second.ToString() + "s.png";

                    driver.Navigate()
                    .GoToUrl(URL);

                    Thread.Sleep(3000);

                    var bytearray = driver.GetScreenshot().AsByteArray;

                    //driver.Quit();

                    Bitmap bmp;
                    using (var ms = new MemoryStream(bytearray))
                    {
                        bmp = new Bitmap(ms);
                    }

                    Bitmap CroppedImage;
                    if (DoCropImage)
                    {
                        Rectangle section = new Rectangle(CropStartPoint, CropSize);
                        CroppedImage = CropImage(bmp, section);
                    }
                    else
                    {
                        CroppedImage = bmp;
                    }

                    if (IncludeLogoWatermark)
                    {
                        Bitmap Logo;

                        if (WatermarkFilePath != "")
                        {
                            if (File.Exists(WatermarkFilePath))
                            {
                                Logo = new Bitmap(WatermarkFilePath);
                            }
                            else
                            {
                                Logo = Properties.Resources.Watermark;
                            }
                        }
                        else
                        {
                            Logo = Properties.Resources.Watermark;
                        }


                        Bitmap FinalLogo = ResizeBitmap(Logo, Logo.Width / 3, Logo.Height / 3);


                        Graphics gCroppedImage = Graphics.FromImage(CroppedImage);
                        gCroppedImage.DrawImage(FinalLogo, CroppedImage.Width / 2 - FinalLogo.Width / 2, 70, new Rectangle(0, 0, FinalLogo.Width, FinalLogo.Height), GraphicsUnit.Pixel);

                        CroppedImage.Save(ImagePath, ImageFormat.Png);

                        gCroppedImage.Dispose();
                        FinalLogo.Dispose();
                        Logo.Dispose();
                    }
                    else
                    {
                        CroppedImage.Save(ImagePath, ImageFormat.Png);
                    }

                    CroppedImage.Dispose();
                    bmp.Dispose();

                    return(new ScreenshotResult(true, ImagePath));
                }
                catch (Exception ex)
                {
                    return(new ScreenshotResult(false, ""));
                }
            }
            else
            {
                return(new ScreenshotResult(false, ""));
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ContainerView != null)
            {
                ContainerView.Dispose();
                ContainerView = null;
            }

            if (Domain != null)
            {
                Domain.Dispose();
                Domain = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            if (Password != null)
            {
                Password.Dispose();
                Password = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (User != null)
            {
                User.Dispose();
                User = null;
            }

            if (StackView != null)
            {
                StackView.Dispose();
                StackView = null;
            }

            if (TokenTextField != null)
            {
                TokenTextField.Dispose();
                TokenTextField = null;
            }

            if (AuthenticationSelector != null)
            {
                AuthenticationSelector.Dispose();
                AuthenticationSelector = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }
        }
Beispiel #19
0
        private void UpdateLogoFile(string newTarget)
        {
            StopAnimation();
            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            string fullTarget = FileOperations.StripFileName(newTarget);

            if (!FileOperations.IsValidPathName(fullTarget))
            {
                Logo = NativeThemeManager.LoadBitmap("UnknownFile.png");
            }
            else
            {
                if (!string.IsNullOrEmpty(fullTarget))
                {
                    if (NativeMethods.FileExtensionIs(fullTarget, ".circle"))
                    {
                        Logo = GetLogoFromRing(fullTarget);
                    }
                }

                if (Logo == null)
                {
                    try
                    {
                        Logo = (Bitmap)FileImage.FileNameImage(fullTarget);
                    }
                    catch
                    {
                        Logo = null;
                    }
                }

                if (Logo == null)
                {
                    if (FileOperations.DirectoryExists(fullTarget))
                    {
                        Logo = NativeThemeManager.LoadBitmap("Folder.png");
                    }
                    else
                    {
                        Logo = FileOperations.GetExtensionLogo(fullTarget);
                        if (Logo == null)
                        {
                            Logo = NativeThemeManager.LoadBitmap("UnknownFile.png");
                        }
                    }
                }
            }

            AnimatedLogo = ImageAnimator.CanAnimate(Logo);
            if (!AnimatedLogo)
            {
                Logo = BitmapPainter.ResizeBitmap(Logo, FileImage.ImageSize, FileImage.ImageSize, true);
            }

            SaveLogoToCache();
        }