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;
|
||||
public void Start(FileInfo workFile)
|
||||
{
|
||||
|
||||
Stopwatch s = new Stopwatch();
|
||||
s.Start();
|
||||
|
||||
_currentFile = workFile;
|
||||
|
||||
|
||||
|
|
@ -122,7 +126,8 @@ namespace CatalogLib
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -187,7 +187,10 @@
|
|||
</StackPanel>
|
||||
<Button Content="Start" Command="{Binding StartCommand}" Style="{DynamicResource AccentedSquareButtonStyle}"></Button>
|
||||
<Button Content="STOP" Command="{Binding StopCommand}" Style="{DynamicResource SquareButtonStyle}"/>
|
||||
<TextBlock Text="{Binding CurrentImage}"></TextBlock>
|
||||
<TextBlock Text="{Binding TotalPictures}"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,10 @@ namespace WPFCatalog
|
|||
var tasks = new List<Task>();
|
||||
// todo folder mode
|
||||
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(() =>
|
||||
//{
|
||||
|
|
@ -147,14 +150,9 @@ namespace WPFCatalog
|
|||
// //CompleteFile(file);
|
||||
//});
|
||||
var t = FileTask(file);
|
||||
if (t != null)
|
||||
{
|
||||
|
||||
tasks.Add(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
MaddoLogger.LogError("Task was null for file: {0}", file);
|
||||
}
|
||||
|
||||
//_tasks.Add(new ImageTask() { ImageName = file, TaskImage = t, Completed = false });
|
||||
//t.Start();
|
||||
|
||||
|
|
@ -178,8 +176,8 @@ namespace WPFCatalog
|
|||
MaddoLogger.Log("Starting task for image {0}", file);
|
||||
IImageProcessor i = new ImgSharpCreator();
|
||||
await Task.Run(() => i.Start(new FileInfo(file)));
|
||||
|
||||
|
||||
CurrentImage = file;
|
||||
TotalPictures--;
|
||||
}
|
||||
|
||||
private void CompleteFile(string file)
|
||||
|
|
@ -260,6 +258,23 @@ namespace WPFCatalog
|
|||
|
||||
#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
|
||||
{
|
||||
get { return PicSettings; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue