Created monitoring object and refactored code accordingly.
This commit is contained in:
@@ -4,6 +4,16 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BodyshopUploader
|
||||
{
|
||||
public enum SourceSystem
|
||||
{
|
||||
Mitchell = 0,
|
||||
Audatex = 1,
|
||||
CCC = 2
|
||||
}
|
||||
}
|
||||
|
||||
namespace BodyshopUploader.Models
|
||||
{
|
||||
public class DTO_QueueItem : DTO_Base
|
||||
@@ -13,6 +23,13 @@ namespace BodyshopUploader.Models
|
||||
|
||||
}
|
||||
|
||||
private SourceSystem _source;
|
||||
public SourceSystem Source
|
||||
{
|
||||
get { return _source; }
|
||||
set { SetProperty(ref _source, value); }
|
||||
}
|
||||
|
||||
private dynamic _job;
|
||||
public dynamic Job
|
||||
{
|
||||
|
||||
59
BodyshopUploader/Models/Monitor.cs
Normal file
59
BodyshopUploader/Models/Monitor.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BodyshopUploader.Models
|
||||
{
|
||||
public class Monitor : DTO_Base
|
||||
{
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public Monitor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private SourceSystem _source;
|
||||
public SourceSystem Source
|
||||
{
|
||||
get { return _source; }
|
||||
set { SetProperty(ref _source, value); }
|
||||
}
|
||||
|
||||
private string _filePath;
|
||||
public string FilePath
|
||||
{
|
||||
get { return _filePath; }
|
||||
set { SetProperty(ref _filePath, value); }
|
||||
}
|
||||
|
||||
private string _status;
|
||||
public string Status
|
||||
{
|
||||
get { return _status; }
|
||||
set { SetProperty(ref _status, value); }
|
||||
}
|
||||
|
||||
private Utils.CIECAMonitor _folderMonitor;
|
||||
public Utils.CIECAMonitor FolderMonitor
|
||||
{
|
||||
get { return _folderMonitor; }
|
||||
set { SetProperty(ref _folderMonitor, value); }
|
||||
}
|
||||
|
||||
public void StartMonitor()
|
||||
{
|
||||
logger.Debug("Starting folder monitor for path {0}", FilePath);
|
||||
System.IO.Directory.CreateDirectory(FilePath);
|
||||
FolderMonitor = new Utils.CIECAMonitor(FilePath);
|
||||
}
|
||||
|
||||
public void StopMonitor()
|
||||
{
|
||||
logger.Debug("Stopping folder monitor for path {0}", FilePath);
|
||||
FolderMonitor?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user