Exemplo n.º 1
0
 public void updateText()
 {
     lPrime.Text = SharedSettings.getGlobalString("brushsettings_color_primary");
     lSec.Text   = SharedSettings.getGlobalString("brushsettings_color_secondary");
     lSize.Text  = SharedSettings.getGlobalString("brushsettings_brush_size") + ": " + tbSize.Value.ToString();
     lHard.Text  = SharedSettings.getGlobalString("brushsettings_brush_hardness") + ": " + tbHardness.Value.ToString();
 }
Exemplo n.º 2
0
        public LayerItem(int w, int h, PixelFormat pf, String name, SharedSettings s)
        {
            ss = s;
            InitializeComponent();

            cbVisible.Text = SharedSettings.getGlobalString("layeritem_checkbox_visible");

            isVisible   = true;
            LayerBitmap = new Bitmap(w, h, pf);
            g           = Graphics.FromImage(LayerBitmap);
            SharedSettings.bitmapCurrentLayer = LayerBitmap;
            SharedSettings.gActiveGraphics    = g;
            cbVisible.Checked = true;

            this.BackColor = cNotActive;

            //Stretch The Preview Image to fit
            pbLayerPreview.SizeMode = PictureBoxSizeMode.Zoom;

            pbLayerPreview.BackColor = Color.White;

            sLayerName       = name;
            tbLayerName.Text = sLayerName;

            this.Update();
        }
Exemplo n.º 3
0
        public ProjectSave(SharedSettings ss)
        {
            settings = ss;
            BackgroundWorker bw = new BackgroundWorker();

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

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

                bw.RunWorkerAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.InnerException);
            }
        }
Exemplo n.º 4
0
 public GDriveSaveDialog()
 {
     InitializeComponent();
     this.Text         = SharedSettings.getGlobalString("gdrivesavedialog_title");
     lbl_FileName.Text = SharedSettings.getGlobalString("gdrivesavedialog_filename");
     lbl_FileType.Text = SharedSettings.getGlobalString("gdrivesavedialog_filetype");
     btn_save.Text     = SharedSettings.getGlobalString("gdrivesavedialog_save");
 }
Exemplo n.º 5
0
        public NewProjectForm()
        {
            InitializeComponent();

            this.Text = SharedSettings.getGlobalString("newproject_dialog_title");
            lWidth.Text = SharedSettings.getGlobalString("newproject_dialog_width");
            lHeight.Text = SharedSettings.getGlobalString("newproject_dialog_height");
            bSubmit.Text = SharedSettings.getGlobalString("newproject_dialog_submit");

            CanvasWidth = -1;
            CanvasHeight = -1;
        }
Exemplo n.º 6
0
        public static void DriveUpload(string pathToFile)
        {
            // Authenticate with Drive API
            UserCredential credential;

            using (var strm =
                       new FileStream("client_secret.json", FileMode.Open, FileAccess.Read))
            {
                string credPath = System.Environment.GetFolderPath(
                    System.Environment.SpecialFolder.Personal);
                credPath = Path.Combine(credPath, ".credentials/drive-dotnet-lepaint.json");

                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(strm).Secrets,
                    Scopes,
                    "user",
                    CancellationToken.None,
                    new FileDataStore(credPath, true)).Result;
                Console.WriteLine("Credential file saved to: " + credPath);
            }

            // Create Drive API service
            var service = new DriveService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = ApplicationName,
            });

            FilesResource.ListRequest listRequest = service.Files.List();
            listRequest.Fields = "nextPageToken, files(name)";

            // insert as new file
            Google.Apis.Drive.v3.Data.File body = new Google.Apis.Drive.v3.Data.File();
            body.Name     = System.IO.Path.GetFileName(pathToFile);
            body.MimeType = GetMimeType(pathToFile);

            byte[] byteArray = System.IO.File.ReadAllBytes(pathToFile);
            System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
            try
            {
                FilesResource.CreateMediaUpload request = service.Files.Create(body, stream, body.MimeType);
                request.Upload();
                Console.WriteLine("File Created " + body.Name + " - " + body.MimeType);
            }
            catch (Exception e)
            {
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, SharedSettings.getGlobalString("googledriveupload_error") + e.Message);
            }
        }
Exemplo n.º 7
0
        private void doSave(SaveFileDialog sfd)
        {
            if (sfd.FileName != "")
            {
                try
                {
                    System.IO.Directory.CreateDirectory("save");

                    Bitmap[] bitArr     = settings.getLayerBitmaps();
                    string   baseDir    = System.IO.Directory.GetCurrentDirectory();
                    string[] LayerNames = settings.getLayerNames();

                    for (int n = 0; n < bitArr.Length; n++)
                    {
                        bitArr[n].Save(baseDir + "\\save\\" + LayerNames[n] + ".png", ImageFormat.Png);
                    }

                    System.IO.File.WriteAllLines(baseDir + @"\save\names.txt", LayerNames);

                    if (SharedSettings.bitmapWatermark != null)
                    {
                        System.IO.Directory.CreateDirectory("save\\watermark");
                        SharedSettings.bitmapWatermark.Save("save\\watermark\\watermark.png", ImageFormat.Png);
                        string[] watermarkInfo = { SharedSettings.bRenderWatermark.ToString(), SharedSettings.watermarkStyle };
                        System.IO.File.WriteAllLines(baseDir + @"\\save\\watermark\\watermarkdata.txt", watermarkInfo);
                    }

                    if (System.IO.File.Exists(sfd.FileName))
                    {
                        System.IO.File.Delete(sfd.FileName);
                    }

                    ZipFile.CreateFromDirectory(baseDir + @"\save", sfd.FileName);

                    System.IO.Directory.Delete(baseDir + @"\save", true);

                    string message = SharedSettings.getGlobalString("projectsave_saved");
                    MessageBox.Show(new Form()
                    {
                        WindowState = FormWindowState.Maximized, TopMost = true
                    }, message);
                }
                catch (Exception e)
                {
                    string message = SharedSettings.getGlobalString("projectsave_error") + "\n\n" + e.ToString();
                    MessageBox.Show(new Form()
                    {
                        WindowState = FormWindowState.Maximized, TopMost = true
                    }, message);
                }
            }
        }
Exemplo n.º 8
0
        private void updateText()
        {
            //Form Title
            this.Text = SharedSettings.getGlobalString("title");

            //File Menu Items
            tsmiFile.Text                 = SharedSettings.getGlobalString("file_menu");
            tsmiFile_New.Text             = SharedSettings.getGlobalString("file_menu_new");
            tsmiFile_Save.Text            = SharedSettings.getGlobalString("file_menu_save");
            tsmiFile_Load.Text            = SharedSettings.getGlobalString("file_menu_open");
            tsmiFile_Import.Text          = SharedSettings.getGlobalString("file_menu_import");
            tsmiFile_Export.Text          = SharedSettings.getGlobalString("file_menu_export");
            tsmiFile_SaveGoogleDrive.Text = SharedSettings.getGlobalString("file_menu_googledrive");

            //Edit Menu Items
            tsmiEdit.Text        = SharedSettings.getGlobalString("edit_menu");
            tsmiEdit_Redo.Text   = SharedSettings.getGlobalString("edit_menu_redo");
            tsmiEdit_Undo.Text   = SharedSettings.getGlobalString("edit_menu_undo");
            tsmiEdit_Resize.Text = SharedSettings.getGlobalString("edit_menu_resize");

            //View Menu Items
            tsmiView.Text                = SharedSettings.getGlobalString("view_menu");
            tsmiView_GridLines.Text      = SharedSettings.getGlobalString("view_menu_grid");
            tsmiView_GridLines_Auto.Text = SharedSettings.getGlobalString("view_menu_grid_auto");
            tsmiView_ShowTools.Text      = SharedSettings.getGlobalString("view_menu_tools");

            //Preferences Menu Items
            tsmiPreferences.Text                                = SharedSettings.getGlobalString("preferences_menu");
            tsmiPreferences_Watermark.Text                      = SharedSettings.getGlobalString("preferences_menu_watermark");
            tsmiPreferences_Watermark_SetImage.Text             = SharedSettings.getGlobalString("preferences_menu_watermark_set");
            tsmiPreferences_Watermark_ShowWatermark.Text        = SharedSettings.getGlobalString("preferences_menu_watermark_show");
            tsmiPreferences_Watermark_Style.Text                = SharedSettings.getGlobalString("preferences_menu_watermark_style");
            tsmiPreferences_Watermark_Style_SingleBottom.Text   = SharedSettings.getGlobalString("preferences_menu_watermark_style_singlebottom");
            tsmiPreferences_Watermark_Style_SingleCentered.Text = SharedSettings.getGlobalString("preferences_menu_watermark_style_singlecentered");
            tsmiPreferences_Watermark_Style_Tiled.Text          = SharedSettings.getGlobalString("preferences_menu_watermark_style_tiled");
            tsmiInternational.Text                              = SharedSettings.getGlobalString("preferences_menu_international");

            //ToolStrip Item ToolTips
            tsNew.ToolTipText  = SharedSettings.getGlobalString("toolstripmenu_new");
            tsOpen.ToolTipText = SharedSettings.getGlobalString("toolstripmenu_import");
            tsSave.ToolTipText = SharedSettings.getGlobalString("toostripmenu_save");

            foreach (Control c in Controls)
            {
                if (c is ITextUpdate)
                {
                    ((ITextUpdate)c).updateText();
                }
            }

            this.Refresh();
        }
Exemplo n.º 9
0
        public void doSaveAnimGif(string filename, object sender, DoWorkEventArgs args)
        {
            FileStream fs = new FileStream(filename + ".gif", FileMode.OpenOrCreate);

            using (var stream = new MemoryStream())
            {
                using (var encoder = new GifEncoder(stream, null, null, 12))
                {
                    for (int i = 0; i < SharedSettings.Layers.Length; i++)
                    {
                        var image = (Image)(SharedSettings.Layers[i] as Bitmap).Clone();
                        encoder.AddFrame(image, 0, 0, TimeSpan.FromSeconds(0));
                    }

                    stream.Position = 0;
                    stream.WriteTo(fs);
                }
            }
            fs.Close();

            try
            {
                GoogleDriveUpload.DriveUpload(filename + ".gif");
                string message = SharedSettings.getGlobalString("projectsave_saved");
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, message);
            }
            catch (Exception e)
            {
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, SharedSettings.getGlobalString("gdrivesavedialog_error") + e.Message);
            }
            try
            {
                System.IO.File.Delete(filename + ".gif");
            }
            catch (Exception e)
            {
                Console.WriteLine("Problem deleting temp gif file: " + e.Message);
            }
        }
Exemplo n.º 10
0
        private void tsmiFile_Save_Click(object sender, EventArgs e)
        {
            //Save Project Function

            try
            {
                c.setPause(true);
                ProjectSave ps = new ProjectSave(c.getSharedSettings());
            }
            catch (Exception err)
            {
                String s = SharedSettings.getGlobalString("error_save_project") + err.ToString();
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, s);
            }
            c.setPause(false);
        }
Exemplo n.º 11
0
        public BrushSettings(SharedSettings s)
        {
            InitializeComponent();

            lPrime.Text = SharedSettings.getGlobalString("brushsettings_color_primary");
            lSec.Text   = SharedSettings.getGlobalString("brushsettings_color_secondary");
            lSize.Text  = SharedSettings.getGlobalString("brushsettings_brush_size");
            lHard.Text  = SharedSettings.getGlobalString("brushsettings_brush_hardness");

            settings = s;

            pPrime.BackColor = settings.getPrimaryBrushColor();
            pSec.BackColor   = settings.getSecondaryBrushColor();

            tbSize.Value     = (int)settings.getBrushSize();
            tbHardness.Value = (int)settings.getBrushHardness();

            this.Refresh();
        }
Exemplo n.º 12
0
 private void doOpen(SharedSettings ss, OpenFileDialog ofd, object sender, DoWorkEventArgs args)
 {
     if (ofd.FileName != "")
     {
         try
         {
             var    ms = new MemoryStream(File.ReadAllBytes(ofd.FileName));
             Bitmap bm = new Bitmap(Image.FromStream(ms));
             ss.setImportImage(bm);
         }
         catch (Exception e)
         {
             string message = SharedSettings.getGlobalString("importimage_error") + "\n\n" + e.ToString();
             MessageBox.Show(new Form()
             {
                 WindowState = FormWindowState.Maximized, TopMost = true
             }, message);
         }
     }
 }
Exemplo n.º 13
0
        public ProjectLoad()
        {
            Result = "";

            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = SharedSettings.getGlobalString("projectopen_dialog_filter");
                ofd.Title  = SharedSettings.getGlobalString("projectopen_dialog_title");
                ofd.ShowDialog();

                doOpen(ofd);

                ofd.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine("An error was thrown while opening!" + e.InnerException);
            }
        }
Exemplo n.º 14
0
        private void setImageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog sfd = new OpenFileDialog();
                sfd.Filter = SharedSettings.getGlobalString("watermarkdialog_filter");
                sfd.Title  = SharedSettings.getGlobalString("watermarkdialog_title");
                sfd.ShowDialog();

                SharedSettings.watermarkPath   = sfd.FileName;
                SharedSettings.bitmapWatermark = new Bitmap(sfd.FileName);
            }
            catch
            {
            }

            if (SharedSettings.watermarkPath != null)
            {
                tsmiPreferences_Watermark_ShowWatermark.Enabled = true;
                tsmiPreferences_Watermark_Style.Enabled         = true;
            }
        }
Exemplo n.º 15
0
        public ImageImport(SharedSettings ss)
        {
            BackgroundWorker bw = new BackgroundWorker();

            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = SharedSettings.getGlobalString("imageimport_dialog_filter");
                ofd.Title  = SharedSettings.getGlobalString("imageimport_dialog_title");
                ofd.ShowDialog();

                bw.DoWork += (send, args) =>
                {
                    doOpen(ss, ofd, send, args);
                };

                bw.RunWorkerAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.InnerException);
            }
        }
Exemplo n.º 16
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.º 17
0
 public string getToolTip()
 {
     return(SharedSettings.getGlobalString("tooltip_move"));
 }
Exemplo n.º 18
0
 public void updateText()
 {
     lZoom.Text = SharedSettings.getGlobalString("zoom");
 }
Exemplo n.º 19
0
        public void doSaveProject(SharedSettings ss, string filename, object sender, DoWorkEventArgs args)
        {
            try
            {
                System.IO.Directory.CreateDirectory("save");

                Bitmap[] bitArr     = ss.getLayerBitmaps();
                string   baseDir    = System.IO.Directory.GetCurrentDirectory();
                string[] LayerNames = ss.getLayerNames();

                for (int n = 0; n < bitArr.Length; n++)
                {
                    bitArr[n].Save(baseDir + "\\save\\" + LayerNames[n] + ".png", ImageFormat.Png);
                }

                System.IO.File.WriteAllLines(baseDir + @"\save\names.txt", LayerNames);

                if (SharedSettings.bitmapWatermark != null)
                {
                    System.IO.Directory.CreateDirectory("save\\watermark");
                    SharedSettings.bitmapWatermark.Save("save\\watermark\\watermark.png", ImageFormat.Png);
                    string[] watermarkInfo = { SharedSettings.bRenderWatermark.ToString(), SharedSettings.watermarkStyle };
                    System.IO.File.WriteAllLines(baseDir + @"\\save\\watermark\\watermarkdata.txt", watermarkInfo);
                }

                if (System.IO.File.Exists(filename + ".lep"))
                {
                    System.IO.File.Delete(filename + ".lep");
                }

                ZipFile.CreateFromDirectory(baseDir + @"\save", filename + ".lep");

                System.IO.Directory.Delete(baseDir + @"\save", true);
            }
            catch (Exception e)
            {
                string message = SharedSettings.getGlobalString("projectsave_error") + "\n\n" + e.ToString();
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, message);
            }

            try
            {
                GoogleDriveUpload.DriveUpload(filename + ".lep");
                string message = SharedSettings.getGlobalString("projectsave_saved");
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, message);
            }
            catch (Exception e)
            {
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, SharedSettings.getGlobalString("gdrivesavedialog_error") + e.Message);
            }
            try
            {
                System.IO.File.Delete(filename + ".lep");
            }
            catch (Exception e)
            {
                Console.WriteLine("Problem deleting temp lep file: " + e.Message);
            }
        }
Exemplo n.º 20
0
        public void doSave(Bitmap bm, string filename, string filetype, object sender, DoWorkEventArgs args)
        {
            try
            {
                Canvas.handleWatermark(Graphics.FromImage(bm));

                string      ext = ".png";
                ImageFormat fmt = ImageFormat.Png;
                switch (filetype)
                {
                case ("Jpeg | *.jpg"):
                    ext = ".jpg";
                    fmt = ImageFormat.Jpeg;
                    break;

                case ("PNG | *.png"):
                    // don't need to change anything
                    break;

                case ("GIF | *.gif"):
                    ext = ".gif";
                    fmt = ImageFormat.Gif;
                    break;

                case ("ICON | *.ico"):
                    ext = ".ico";
                    fmt = ImageFormat.Icon;
                    break;

                case ("TIFF | *.tiff"):
                    ext = ".tiff";
                    fmt = ImageFormat.Tiff;
                    break;

                case ("Bitmap | *.bmp"):
                    ext = ".bmp";
                    fmt = ImageFormat.Bmp;
                    break;

                default:
                    // on error, default to png
                    break;
                }

                bm.Save(filename + ext, fmt);

                GoogleDriveUpload.DriveUpload(filename + ext);

                string message = SharedSettings.getGlobalString("projectsave_saved");
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, message);

                System.IO.File.Delete(filename + ext);
            }
            catch (Exception e)
            {
                MessageBox.Show(new Form()
                {
                    WindowState = FormWindowState.Maximized, TopMost = true
                }, SharedSettings.getGlobalString("gdrivesavedialog_error") + e.Message);
            }
        }
Exemplo n.º 21
0
        private void doOpen(OpenFileDialog ofd)
        {
            Console.WriteLine("Attempting to open: " + ofd.FileName);

            if (ofd.FileName != "")
            {
                try
                {
                    if (ofd.FileName.EndsWith(".gif"))
                    {
                        using (System.IO.Stream sr = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                        {
                            GifBitmapDecoder gbd   = new GifBitmapDecoder(sr, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                            List <Bitmap>    bmps  = new List <Bitmap>();
                            List <string>    names = new List <string>();
                            for (int i = 0; i < gbd.Frames.Count; i++)
                            {
                                bmps.Add(BitmapFromSource(gbd.Frames[i]));
                                names.Add(i.ToString());
                            }
                            SharedSettings.iCanvasWidth      = ((int)gbd.Frames[0].Width);
                            SharedSettings.iCanvasHeight     = ((int)gbd.Frames[0].Height);
                            SharedSettings.Layers            = (bmps.ToArray());
                            SharedSettings.LayerNames        = (names.ToArray());
                            SharedSettings.bLoadFromSettings = (true);
                            bmps.Clear();
                            names.Clear();
                        }
                    }
                    else if (ofd.FileName.EndsWith(".lep"))
                    {
                        Console.WriteLine(ofd.FileName);
                        string baseDir = System.IO.Directory.GetCurrentDirectory();

                        try
                        {
                            DeleteDirectory(baseDir + @"\load");
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Couldn't delete 'load' Directory!" + e.InnerException);
                        }

                        List <String> layerNames   = new List <String>();
                        List <Bitmap> layerBitmaps = new List <Bitmap>();

                        DirectorySecurity securityRules = new DirectorySecurity();
                        securityRules.AddAccessRule(new FileSystemAccessRule("Users", FileSystemRights.FullControl, AccessControlType.Allow));
                        DirectoryInfo di = Directory.CreateDirectory("load", securityRules);

                        System.IO.Compression.ZipFile.ExtractToDirectory(ofd.FileName, baseDir + @"\load");

                        using (System.IO.StreamReader sr = new System.IO.StreamReader(baseDir + @"\load\names.txt", Encoding.Default))
                        {
                            string line;
                            // Read the stream to a string, and write the string to the console.
                            while ((line = sr.ReadLine()) != null)
                            {
                                layerNames.Add(line);
                            }

                            sr.Close();
                            sr.Dispose();
                        }

                        int w = 0;
                        int h = 0;

                        for (int n = 0; n < layerNames.Count; n++)
                        {
                            Bitmap temp = (Bitmap)Image.FromFile(baseDir + @"\load\" + layerNames[n] + ".png");

                            w = (temp.Width > w) ? temp.Width : w;
                            h = (temp.Height > h) ? temp.Height : h;
                            layerBitmaps.Add((Bitmap)temp.Clone());
                        }

                        try
                        {
                            if (Directory.Exists(baseDir + @"\load\watermark"))
                            {
                                //Console.WriteLine("Watermark Found");
                                SharedSettings.bitmapWatermark = (Bitmap)Bitmap.FromFile(baseDir + @"\load\watermark\watermark.png").Clone();
                                SharedSettings.watermarkPath   = baseDir + @"\load\watermark\watermark.png";
                                List <string> watermarkdata = new List <string>();
                                using (System.IO.StreamReader sr = new System.IO.StreamReader(baseDir + @"\load\watermark\watermarkdata.txt", Encoding.Default))
                                {
                                    string line;

                                    // Read the stream to a string, and write the string to the console.
                                    while ((line = sr.ReadLine()) != null)
                                    {
                                        Console.WriteLine(line);
                                        watermarkdata.Add(line);
                                    }
                                    sr.Close();
                                    sr.Dispose();
                                }

                                bool show;
                                Boolean.TryParse(watermarkdata[0], out show);
                                SharedSettings.bRenderWatermark = show;
                                SharedSettings.watermarkStyle   = watermarkdata[1];
                            }
                        }
                        catch (Exception err)
                        {
                            SharedSettings.bitmapWatermark = null;
                            Console.WriteLine("Exception Thrown in Watermark Loading" + err.InnerException);
                        }

                        SharedSettings.iCanvasWidth      = w;
                        SharedSettings.iCanvasHeight     = h;
                        SharedSettings.Layers            = layerBitmaps.ToArray();
                        SharedSettings.LayerNames        = layerNames.ToArray();
                        SharedSettings.bLoadFromSettings = true;

                        Console.WriteLine(SharedSettings.Layers.Count());

                        layerBitmaps.Clear(); //Clears all Bitmap File References
                        layerNames.Clear();   //Clears Layer Name File Reference
                        Console.WriteLine(SharedSettings.Layers.Count());
                    }
                    else
                    {
                        BackgroundWorker bw = new BackgroundWorker();
                        bw.DoWork += (send, args) =>
                        {
                            Console.WriteLine("Wrong File Type");
                            string message = SharedSettings.getGlobalString("projectopen_error");
                            MessageBox.Show(new Form()
                            {
                                WindowState = FormWindowState.Maximized, TopMost = true
                            }, message);
                        };

                        bw.RunWorkerAsync();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    Result = SharedSettings.getGlobalString("projectopen_error");
                    //MessageBox.Show(Result);
                }
            }
        }
Exemplo n.º 22
0
 private void tbSize_ValueChanged(object sender, EventArgs e)
 {
     lSize.Text = SharedSettings.getGlobalString("brushsettings_brush_size") + ": " + tbSize.Value.ToString();
     lSize.Refresh();
     settings.setBrushSize(tbSize.Value);
 }
Exemplo n.º 23
0
 public string getToolTip()
 {
     return(SharedSettings.getGlobalString("tooltip_colorselect"));
 }
Exemplo n.º 24
0
 private void tbHardness_ValueChanged(object sender, EventArgs e)
 {
     lHard.Text = SharedSettings.getGlobalString("brushsettings_brush_hardness") + ": " + tbHardness.Value.ToString();
     lHard.Refresh();
     settings.setBrushHardness(tbHardness.Value);
 }
Exemplo n.º 25
0
 public void updateText()
 {
     cbVisible.Text = SharedSettings.getGlobalString("layeritem_checkbox_visible");
 }
Exemplo n.º 26
0
        //test comment, please ignore
        private void doSave(Bitmap bm, SaveFileDialog sfd, object sender, DoWorkEventArgs args)
        {
            if (sfd.FileName != "")
            {
                try
                {
                    System.IO.FileStream fs = (System.IO.FileStream)sfd.OpenFile();

                    if (SharedSettings.bRenderWatermark && SharedSettings.bitmapWatermark != null)
                    {
                        Canvas.handleWatermark(Graphics.FromImage(bm));
                    }

                    if (sfd.CheckFileExists)
                    {
                        Console.WriteLine(sfd.FileName);
                        System.IO.File.Delete(sfd.FileName);
                    }
                    switch (sfd.FilterIndex)
                    {
                    case 1:
                        bm.Save(fs, ImageFormat.Bmp);
                        break;

                    case 2:
                        bm.Save(fs, ImageFormat.Gif);
                        break;

                    case 3:
                        saveGIFAnimation(fs);
                        break;

                    case 4:
                        bm.Save(fs, ImageFormat.Icon);
                        break;

                    case 5:
                        bm.Save(fs, ImageFormat.Jpeg);
                        break;

                    case 6:
                        bm.Save(fs, ImageFormat.Png);
                        break;

                    case 7:
                        bm.Save(fs, ImageFormat.Tiff);
                        break;
                    }

                    string message = SharedSettings.getGlobalString("filesave_saved");

                    MessageBox.Show(new Form()
                    {
                        WindowState = FormWindowState.Maximized, TopMost = true
                    }, message);
                    fs.Close();
                }
                catch (Exception e)
                {
                    string message = SharedSettings.getGlobalString("filesave_error") + "\n\n" + e.ToString();
                    MessageBox.Show(new Form()
                    {
                        WindowState = FormWindowState.Maximized, TopMost = true
                    }, message);
                }
            }
        }
Exemplo n.º 27
0
 public string getToolTip()
 {
     return(SharedSettings.getGlobalString("tooltip_greenscreen"));
 }