Class JobManager
Singleton class that manages a list of JobModel instances. Ensures only one instance of JobManager exists throughout the application.
Inherited Members
Namespace: EasySave_Project.Manager
Assembly: .dll
Syntax
public sealed class JobManager
Properties
| Edit this page View SourceJobs
List containing all backup jobs.
Declaration
public List<JobModel> Jobs { get; }
Property Value
Type | Description |
---|---|
List<JobModel> |
Methods
| Edit this page View SourceAddJob(JobModel)
Adds a new job to the job list.
Declaration
public void AddJob(JobModel jobModel)
Parameters
Type | Name | Description |
---|---|---|
JobModel | jobModel | The job to add. |
CreateAndAddJob(string, string, string, JobSaveTypeEnum)
Creates a new job using the JobFactory and adds it to the job list.
Declaration
public JobModel CreateAndAddJob(string name, string fileSource, string fileTarget, JobSaveTypeEnum jobSaveTypeEnum)
Parameters
Type | Name | Description |
---|---|---|
string | name | Job name. |
string | fileSource | Source directory. |
string | fileTarget | Target directory. |
JobSaveTypeEnum | jobSaveTypeEnum | Type of backup (complete or differential). |
Returns
Type | Description |
---|---|
JobModel | The created job, or null if an error occurs. |
Destroy()
Declaration
public static void Destroy()
GetAll()
Retrieves all jobs from the list. If the job list is empty, it displays a message and initializes the list.
Declaration
public List<JobModel> GetAll()
Returns
Type | Description |
---|---|
List<JobModel> | List of all jobs. |
GetInstance()
Retrieves the single instance of JobManager. If the instance does not exist, it is created.
Declaration
public static JobManager GetInstance()
Returns
Type | Description |
---|---|
JobManager | The singleton instance of JobManager. |
GetJobById(int)
Declaration
public JobModel? GetJobById(int jobId)
Parameters
Type | Name | Description |
---|---|---|
int | jobId |
Returns
Type | Description |
---|---|
JobModel |