Basic flow

This commit is contained in:
Maddo 2016-11-07 20:58:16 +01:00
commit 15f0d4d5b8
6 changed files with 491 additions and 49 deletions

View file

@ -31,21 +31,40 @@ namespace WPFCatalog
#region commands
public RelayCommand ExportSettingsCommand { get; private set; }
public RelayCommand ImportSettingsCommand { get; private set; }
public RelayCommand SelectSourceFolderCommand { get; private set; }
public RelayCommand SelectDestinationFolderCommand { get; private set; }
public RelayCommand OpenSourceFolderCommand { get; private set; }
public RelayCommand OpenDestinationFolderCommand { get; private set; }
public RelayCommand StartCommand { get; private set; }
private void RegisterCommands()
{
ExportSettingsCommand = new RelayCommand(ExportSettings);
ImportSettingsCommand = new RelayCommand(ImportSettings);
SelectSourceFolderCommand = new RelayCommand(SelectSourceFolder);
OpenSourceFolderCommand = new RelayCommand(OpenSourceFolder);
SelectDestinationFolderCommand = new RelayCommand(SelectDestinationFolder);
OpenDestinationFolderCommand = new RelayCommand(OpenDestinationFolder);
StartCommand = new RelayCommand(Start);
}
private void Start()
{
//var files = Directory.GetFiles(PicSettings.DirectorySorgente);
foreach (var file in Directory.EnumerateFiles(PicSettings.DirectorySorgente))
{
ImageCreator2 i = new ImageCreator2();
i.Start(new FileInfo(file));
}
DialogHelper.PopUpAlert("Finished", "message");
}
private void OpenSourceFolder()
@ -73,7 +92,7 @@ namespace WPFCatalog
if (!string.IsNullOrWhiteSpace(a))
{
this.DirSorgente = a;
}
}
@ -93,7 +112,28 @@ namespace WPFCatalog
string s = PicSettings.SerializeSettings();
DialogHelper.PopUpAlert(s, "data");
var savePath = FileHelper.GetSavePath("", "settings.json", string.Empty);
if (string.IsNullOrWhiteSpace(savePath)) return;
if (Directory.Exists(Path.GetDirectoryName(savePath)))
{
Debug.WriteLine(savePath);
FileHelper.WriteToFile(savePath, s);
Debug.WriteLine(s);
}
}
private void ImportSettings()
{
var loadPath = FileHelper.GetOpenPath();
if (string.IsNullOrWhiteSpace(loadPath)) return;
if (File.Exists(loadPath))
{
var f = FileHelper.ReadTextFile(loadPath);
PicSettings.DeserializeSettings(f);
RaisePropertyChanged(string.Empty);
}
}
#endregion
@ -133,9 +173,38 @@ namespace WPFCatalog
public bool SubdirCreaSottoCartelle
{
get { return true; }
set { }// temp
//get { return PicSettings.GetBool("")}
get { return PicSettings.SubdirCreaSottoCartelle; }
set { PicSettings.SubdirCreaSottoCartelle = value; RaisePropertyChanged("SubdirCreaSottoCartelle"); }
}
public int SubdirIntervalloFile
{
get { return PicSettings.SubdirIntervalloFile; }
set { PicSettings.SubdirIntervalloFile = value; RaisePropertyChanged("SubdirIntervalloFile"); }
}
public string SubdirSuffisso
{
get { return PicSettings.SubdirSuffisso; }
set { PicSettings.SubdirSuffisso = value; RaisePropertyChanged("SubdirSuffisso"); }
}
public int SubdirCifreContatore
{
get { return PicSettings.SubdirCifreContatore; }
set { PicSettings.SubdirCifreContatore = value; RaisePropertyChanged("SubdirCifreContatore"); }
}
public bool SubdirNumerazioneProgressiva
{
get { return PicSettings.SubdirNumerazioneProgressiva; }
set { PicSettings.SubdirNumerazioneProgressiva = value; RaisePropertyChanged("SubdirNumerazioneProgressiva"); }
}
public bool SubdirNumerazioneFiles
{
get { return PicSettings.SubdirNumerazioneFiles; }
set { PicSettings.SubdirNumerazioneFiles = value; RaisePropertyChanged("SubdirNumerazioneFiles"); }
}
public string DirDividiNumFile { get { return PicSettings.GetString("dirDividiNumFile"); } set { PicSettings.Set("dirDividiNumFile", value); } }
@ -146,7 +215,7 @@ namespace WPFCatalog
public bool DirDividiTipoNumerazioneFile { get { return PicSettings.GetString("DirDividiTipoNumerazione").ToUpper() == "FILES"; } set { if (value == false) PicSettings.Set("DirDividiTipoNumerazione", "FILES"); } }
public bool MiniatureCrea { get { return PicSettings.GetBool("miniatureCrea"); } set { PicSettings.Set("miniatureCrea", value); RaisePropertyChanged("MiniatureCrea"); } }
public string MiniatureSuffisso
{
@ -198,22 +267,25 @@ namespace WPFCatalog
}
}
public string FotoAltezza
public int FotoAltezza
{
get { return PicSettings.GetString("fotoAltezza"); }
get
{
return PicSettings.FotoAltezza;
}
set
{
PicSettings.Set("fotoAltezza", value);
PicSettings.FotoAltezza = value;
RaisePropertyChanged("FotoAltezza");
}
}
public string FotoLarghezza
public int FotoLarghezza
{
get { return PicSettings.GetString("fotoLarghezza"); }
get { return PicSettings.FotoLarghezza; }
set
{
PicSettings.Set("fotoLarghezza", value);
PicSettings.FotoLarghezza = value;
RaisePropertyChanged("FotoLarghezza");
}
}
@ -539,16 +611,32 @@ namespace WPFCatalog
}
}
public string CompressioneJpeg
public int CompressioneJpeg
{
get { return PicSettings.GetString("compressioneJpeg"); }
get { return PicSettings.CompressioneJpeg; }
set
{
PicSettings.Set("compressioneJpeg", value);
PicSettings.CompressioneJpeg = value;
RaisePropertyChanged("CompressioneJpeg");
}
}
public bool FotoMantieniDimensioni
{
get { return PicSettings.FotoMantieniDimensioni; }
set
{
PicSettings.FotoMantieniDimensioni = value;
RaisePropertyChanged("FotoMantieniDimensioni");
}
}
public string FotoSuffisso
{
get { return PicSettings.FotoSuffisso; }
set { PicSettings.FotoSuffisso = value; RaisePropertyChanged("FotoSuffisso"); }
}
public string CompressioneJpegMiniatura
{
get { return PicSettings.GetString("compressioneJpegMiniatura"); }
@ -571,6 +659,31 @@ namespace WPFCatalog
#endregion
#region Testo
public bool EnableText
{
get { return PicSettings.EnableText; }
set { PicSettings.EnableText = value; RaisePropertyChanged("EnableText");}
}
public bool EnableThumbnails
{
get { return PicSettings.EnableThumbnails; }
set { PicSettings.EnableThumbnails = value; RaisePropertyChanged("EnableThumbnails"); }
}
public bool EnableLogo
{
get { return PicSettings.EnableLogo; }
set { PicSettings.EnableLogo = value; RaisePropertyChanged("EnableLogo"); }
}
#endregion