BlueSky.SyntaxEditorWindow.createDiskFileFromImageSource C# (CSharp) Метод

createDiskFileFromImageSource() приватный Метод

private createDiskFileFromImageSource ( BSkyGraphicControl bsgc ) : void
bsgc BSkyGraphicControl
Результат void
        private void createDiskFileFromImageSource(BSkyGraphicControl bsgc)
        {
            Image myImage = new System.Windows.Controls.Image();
            myImage.Source = bsgc.BSkyImageSource;
            string grpctrlimg = Path.Combine(System.IO.Path.GetTempPath().Replace("\\", "/"), confService.GetConfigValueForKey("bskygrphcntrlimage"));//23nov2012
            // load default value if no path is set or invalid path is set
            if (grpctrlimg.Trim().Length == 0 || !IsValidFullPathFilename(grpctrlimg, false))
            {
                MessageBox.Show(this, "Key 'bskygrphcntrlimage' not found in config file. Aborting...");
                return;
            }

            System.Windows.Media.Imaging.BitmapImage bitmapImage = new System.Windows.Media.Imaging.BitmapImage();
            bitmapImage = ((System.Windows.Media.Imaging.BitmapImage)myImage.Source);
            System.Windows.Media.Imaging.PngBitmapEncoder pngBitmapEncoder = new System.Windows.Media.Imaging.PngBitmapEncoder();
            System.IO.FileStream stream = new System.IO.FileStream(@grpctrlimg, FileMode.Create);

            pngBitmapEncoder.Interlace = PngInterlaceOption.On;
            pngBitmapEncoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(bitmapImage));
            pngBitmapEncoder.Save(stream);
            stream.Flush();
            stream.Close();
        }
SyntaxEditorWindow