protected void OnSaveButtonClicked(object sender, EventArgs e)
        {
            try
            {
                FileChooserDialog fc = new FileChooserDialog("Save Filterset", this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept);

                FileFilter filter = new FileFilter();
                filter.Name = "DeSERt Filterset";
                filter.AddMimeType("Filterset/fis");
                filter.AddPattern("*.fis");
                fc.AddFilter(filter);
                fc.DoOverwriteConfirmation = true;
                fc.CurrentName             = FiltersetnameEntry.Text.Replace(" ", "-");
                if (Directory.Exists(MySettings.LastFilterDir))
                {
                    fc.SetCurrentFolder(MySettings.LastFilterDir);
                }

                ResponseType res = (ResponseType)fc.Run();
                if (res == ResponseType.Ok || res == ResponseType.Close)
                {
                    string path;
                    if (!System.IO.Path.HasExtension(fc.Filename))
                    {
                        path = fc.Filename + ".fis";
                    }
                    else
                    {
                        path = fc.Filename;
                    }
                    MySettings.LastFilterDir = System.IO.Path.GetDirectoryName(fc.Filename);
                    MySettings.Save();
                    fst.Name = FiltersetnameEntry.Text;
                    Filterset.SaveFilterset(path, fst);
                    saved = true;
                }
                fc.Destroy();
                if (res == ResponseType.Close)
                {
                    this.Destroy();
                }
            }
            catch (Exception ex) { ErrorReport.ReportError("Save Button (Create Filterset)", ex); }
        }
예제 #2
0
        protected void OnButtonOkClicked(object sender, EventArgs e)
        {
            try
            {
                MySettings.ProgramPath  = ProgramPathChoose.Filename;
                MySettings.KeepPP       = KeepPPChkBox.Active;
                MySettings.SavingFormat = SavingFormatBox.Active;
                MySettings.JPGQuality   = (int)QualitySpin.Value;
                MySettings.Threads      = (int)ThreadcountSpin.Value;
                MySettings.AutoThreads  = AutothreadsChkBox.Active;
                MySettings.TiffCompress = CompressChkBox.Active;
                MySettings.LR           = LRpath;
                MySettings.RT           = RTpath;
                MySettings.Program      = ProgramSelBox.Active;
                switch (SavingFormatBox.Active)
                {
                case 1:
                    MySettings.BitDepthPNG = BitDepthBox.Active;
                    break;

                case 2:
                    MySettings.BitDepthTiff = BitDepthBox.Active;
                    break;
                }
                switch (MySettings.Program)
                {
                case 0:
                    MySettings.ProgramPath = RTpath;
                    break;

                case 1:
                    MySettings.ProgramPath = LRpath;
                    break;
                }

                MySettings.Save();

                this.Hide();
            }
            catch (Exception ex) { ErrorReport.ReportError("OK Button (Settings)", ex); }
        }