-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
104 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,52 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Shiny; | ||
using Shiny.Jobs; | ||
using Shiny.Jobs; | ||
using Shiny.Notifications; | ||
|
||
namespace Sample; | ||
|
||
|
||
public class SampleJob : IJob | ||
public partial class SampleJob : Job | ||
{ | ||
readonly INotificationManager notificationManager; | ||
public SampleJob(INotificationManager notificationManager) | ||
=> this.notificationManager = notificationManager; | ||
|
||
// TODO: test new object binding | ||
public SampleJob(ILogger<SampleJob> logger, INotificationManager notificationManager) : base(logger) | ||
{ | ||
this.notificationManager = notificationManager; | ||
this.MinimumTime = TimeSpan.FromSeconds(50); | ||
} | ||
|
||
public async Task Run(JobInfo jobInfo, CancellationToken cancelToken) | ||
protected override async Task Run(CancellationToken cancelToken) | ||
{ | ||
await this.notificationManager.Send( | ||
"Jobs", | ||
$"Job Started - {jobInfo.Identifier}" | ||
$"Job Started - {this.JobInfo!.Identifier}" | ||
); | ||
//await Task.Delay(TimeSpan.FromSeconds(seconds), cancelToken); | ||
|
||
await this.notificationManager.Send( | ||
"Jobs", | ||
$"Job Finished - {jobInfo.Identifier}" | ||
$"Job Finished - {this.JobInfo!.Identifier}" | ||
); | ||
} | ||
} | ||
|
||
//public class SampleJob : IJob | ||
//{ | ||
// readonly INotificationManager notificationManager; | ||
// public SampleJob(INotificationManager notificationManager) | ||
// => this.notificationManager = notificationManager; | ||
|
||
// // TODO: test new object binding | ||
|
||
// public async Task Run(JobInfo jobInfo, CancellationToken cancelToken) | ||
// { | ||
// await this.notificationManager.Send( | ||
// "Jobs", | ||
// $"Job Started - {jobInfo.Identifier}" | ||
// ); | ||
// //await Task.Delay(TimeSpan.FromSeconds(seconds), cancelToken); | ||
|
||
// await this.notificationManager.Send( | ||
// "Jobs", | ||
// $"Job Finished - {jobInfo.Identifier}" | ||
// ); | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters