Ejemplo n.º 1
0
        private void SaveStateAsJpg(object sender, RoutedEventArgs args)
        {
            RenderTargetBitmap renderTargetBitmap = ImageWriter.CopyAsBitmap(GameScroll.Content as Grid);

            byte[]         bytes          = ImageWriter.Encode(renderTargetBitmap, new JpegBitmapEncoder());
            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                DefaultExt      = ".jpeg",
                FileName        = LoadedMap.Name,
                Title           = "Zapisz zrzut mapy jako",
                AddExtension    = true,
                OverwritePrompt = true
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                File.WriteAllBytes(saveFileDialog.FileName, bytes);
            }
        }