Exemplo n.º 1
0
        public FileSave(SharedSettings ss)
        {
            Bitmap           bm = ss.getBitmapCanvas(); // Get the image from the bitmap object
            BackgroundWorker bw = new BackgroundWorker();

            try {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.OverwritePrompt = false;
                sfd.Filter          = SharedSettings.getGlobalString("filesave_filter");
                sfd.Title           = SharedSettings.getGlobalString("filesave_title");
                sfd.ShowDialog();

                bw.DoWork += (send, args) =>
                {
                    doSave(bm, sfd, send, args);
                };

                bw.RunWorkerAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.InnerException);
            }
        }
Exemplo n.º 2
0
        public SaveToDrive(SharedSettings ss, string fileName, string fileType)
        {
            try
            {
                Bitmap           bm = ss.getBitmapCanvas().Clone() as Bitmap;
                BackgroundWorker bw = new BackgroundWorker();

                if (fileType == "LePaint Project File | *.lep")
                {
                    bw.DoWork += (send, args) =>
                    {
                        doSaveProject(ss, fileName, send, args);
                    };
                }
                else if (fileType == "Animated GIF | *.gif")
                {
                    bw.DoWork += (send, args) =>
                    {
                        doSaveAnimGif(fileName, send, args);
                    };
                }
                else
                {
                    bw.DoWork += (send, args) =>
                    {
                        doSave(bm, fileName, fileType, send, args);
                    };
                }

                bw.RunWorkerAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error starting thread to save to drive: " + e.Message);
            }
        }