Counters
This commit is contained in:
parent
40f25a4f4c
commit
a2dca4b750
3 changed files with 36 additions and 13 deletions
|
|
@ -24,6 +24,10 @@ namespace CatalogLib
|
||||||
private FileInfo _currentFile;
|
private FileInfo _currentFile;
|
||||||
public void Start(FileInfo workFile)
|
public void Start(FileInfo workFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Stopwatch s = new Stopwatch();
|
||||||
|
s.Start();
|
||||||
|
|
||||||
_currentFile = workFile;
|
_currentFile = workFile;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -119,10 +123,11 @@ namespace CatalogLib
|
||||||
//image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200));
|
//image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200));
|
||||||
image.Save(Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name));
|
image.Save(Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name));
|
||||||
//image.Resize(200, 200).Save("");
|
//image.Resize(200, 200).Save("");
|
||||||
|
|
||||||
MaddoLogger.Log("Saved Image: {0} to: {1}", workFile.FullName, Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name));
|
MaddoLogger.Log("Saved Image: {0} to: {1}", workFile.FullName, Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name));
|
||||||
}
|
}
|
||||||
|
s.Stop();
|
||||||
|
MaddoLogger.Log("Time Taken for {0}: {1}", workFile.FullName, s.Elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetExtraText(Image<Rgba32> image)
|
private void SetExtraText(Image<Rgba32> image)
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,10 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Content="Start" Command="{Binding StartCommand}" Style="{DynamicResource AccentedSquareButtonStyle}"></Button>
|
<Button Content="Start" Command="{Binding StartCommand}" Style="{DynamicResource AccentedSquareButtonStyle}"></Button>
|
||||||
<Button Content="STOP" Command="{Binding StopCommand}" Style="{DynamicResource SquareButtonStyle}"/>
|
<Button Content="STOP" Command="{Binding StopCommand}" Style="{DynamicResource SquareButtonStyle}"/>
|
||||||
|
<TextBlock Text="{Binding CurrentImage}"></TextBlock>
|
||||||
|
<TextBlock Text="{Binding TotalPictures}"></TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,10 @@ namespace WPFCatalog
|
||||||
var tasks = new List<Task>();
|
var tasks = new List<Task>();
|
||||||
// todo folder mode
|
// todo folder mode
|
||||||
MaddoLogger.Log("Starting elaboration");
|
MaddoLogger.Log("Starting elaboration");
|
||||||
foreach (var file in Directory.EnumerateFiles(PicSettings.DirectorySorgente))
|
var files = Directory.EnumerateFiles(PicSettings.DirectorySorgente).ToArray();
|
||||||
|
|
||||||
|
TotalPictures = files.Count();
|
||||||
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
//Task t = new Task(() =>
|
//Task t = new Task(() =>
|
||||||
//{
|
//{
|
||||||
|
|
@ -147,14 +150,9 @@ namespace WPFCatalog
|
||||||
// //CompleteFile(file);
|
// //CompleteFile(file);
|
||||||
//});
|
//});
|
||||||
var t = FileTask(file);
|
var t = FileTask(file);
|
||||||
if (t != null)
|
|
||||||
{
|
tasks.Add(t);
|
||||||
tasks.Add(t);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MaddoLogger.LogError("Task was null for file: {0}", file);
|
|
||||||
}
|
|
||||||
//_tasks.Add(new ImageTask() { ImageName = file, TaskImage = t, Completed = false });
|
//_tasks.Add(new ImageTask() { ImageName = file, TaskImage = t, Completed = false });
|
||||||
//t.Start();
|
//t.Start();
|
||||||
|
|
||||||
|
|
@ -178,8 +176,8 @@ namespace WPFCatalog
|
||||||
MaddoLogger.Log("Starting task for image {0}", file);
|
MaddoLogger.Log("Starting task for image {0}", file);
|
||||||
IImageProcessor i = new ImgSharpCreator();
|
IImageProcessor i = new ImgSharpCreator();
|
||||||
await Task.Run(() => i.Start(new FileInfo(file)));
|
await Task.Run(() => i.Start(new FileInfo(file)));
|
||||||
|
CurrentImage = file;
|
||||||
|
TotalPictures--;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CompleteFile(string file)
|
private void CompleteFile(string file)
|
||||||
|
|
@ -260,6 +258,23 @@ namespace WPFCatalog
|
||||||
|
|
||||||
#region Proprietà
|
#region Proprietà
|
||||||
|
|
||||||
|
private string _currentImage;
|
||||||
|
|
||||||
|
public string CurrentImage
|
||||||
|
{
|
||||||
|
get => _currentImage;
|
||||||
|
set { _currentImage = value; RaisePropertyChanged("CurrentImage"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _totalPictures;
|
||||||
|
|
||||||
|
public int TotalPictures
|
||||||
|
{
|
||||||
|
get => _totalPictures;
|
||||||
|
set { _totalPictures = value; RaisePropertyChanged("TotalPictures"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public PicSettings SettingsString
|
public PicSettings SettingsString
|
||||||
{
|
{
|
||||||
get { return PicSettings; }
|
get { return PicSettings; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue