rawfilewizard

git clone https://git.clttr.info/rawfilewizard.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

SettingsForm.cs (2759B)


      1 using SilkypixFileMover.Properties;
      2 using System;
      3 using System.Collections.Generic;
      4 using System.ComponentModel;
      5 using System.Windows.Forms;
      6 
      7 namespace SilkypixFileMover
      8 {
      9     // TODO: Validierungen wenn die Felder leer sind!
     10     public partial class SettingsForm : Form
     11     {
     12         public SettingsForm()
     13         {
     14             InitializeComponent();
     15         }
     16 
     17         private void btnSettingsSave_Click( object sender, EventArgs e )
     18         {
     19             Settings.Default.Save();
     20             Close();
     21         }
     22 
     23         private void btnSettingsRestore_Click( object sender, EventArgs e )
     24         {
     25             Settings.Default.Reload();
     26         }
     27 
     28         private void ValidateFolder( object sender, CancelEventArgs e )
     29         {
     30             TextBox box = ( TextBox )sender;
     31 
     32             box.Text = box.Text.Trim( '\\' );
     33         }
     34 
     35         private void ValidateFileextensions( object sender, CancelEventArgs e )
     36         {
     37             TextBox box = ( TextBox )sender;
     38             if ( string.IsNullOrWhiteSpace( box.Text ) )
     39             {
     40                 errorProvider.SetError( box, "Dieses Feld darf nicht leer sein!" );
     41                 e.Cancel = true;
     42                 return;
     43             }
     44             else
     45             {
     46                 errorProvider.SetError( box, string.Empty );
     47             }
     48 
     49             string[] exts = box.Text.Split( '|' );
     50             List<string> result = new List<string>();
     51             foreach ( string fileExt in exts )
     52             {
     53                 result.Add( fileExt.TrimStart( '.' ) );
     54             }
     55 
     56             box.Text = string.Join( "|", result.ToArray() );
     57         }
     58 
     59         private void txtJpegSubfolder_Validating( object sender, CancelEventArgs e )
     60         {
     61             ValidateFolder( sender, e );
     62         }
     63 
     64         private void txtSidecarFileSubfolder_Validating( object sender, CancelEventArgs e )
     65         {
     66             ValidateFolder( sender, e );
     67         }
     68 
     69         private void txtSidecarFileextensions_Validating( object sender, CancelEventArgs e )
     70         {
     71             ValidateFileextensions( sender, e );
     72         }
     73 
     74         private void txtJpegFileExtensions_Validating( object sender, CancelEventArgs e )
     75         {
     76             ValidateFileextensions( sender, e );
     77         }
     78 
     79         private void txtRawFileextension_Validating( object sender, CancelEventArgs e )
     80         {
     81             ValidateFileextensions( sender, e );
     82         }
     83 
     84         private void cboIncludeSimilarFiles_CheckedChanged( object sender, EventArgs e )
     85         {
     86             txtNameAdditionChar.Enabled = ( ( CheckBox )sender ).Checked;
     87         }
     88 
     89         private void SettingsForm_Load( object sender, EventArgs e )
     90         {
     91             txtNameAdditionChar.Enabled = Settings.Default.IncludeSimilarFiles;
     92         }
     93     }
     94 }