Created
April 9, 2018 19:16
-
-
Save hishaamn/e61ecac656c5ebb81eafeda04ff83b19 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| protected override void OnLoad(EventArgs e) | |
| { | |
| JobManager.GetJobs(); | |
| var stringBuilder = new StringBuilder(); | |
| var requiredService = ServiceLocator.ServiceProvider.GetRequiredService<BaseJobManager>(); | |
| DefaultJobManager defaultJobManager; | |
| if (requiredService == null || (defaultJobManager = requiredService as DefaultJobManager) == null) | |
| { | |
| this.lt.Text = "Job Viewer page does not work with non-default BaseJobManager implementation."; | |
| } | |
| else | |
| { | |
| this.ShowRefreshStatus(stringBuilder); | |
| if (RunningJobsFieldInfo != null) | |
| { | |
| this.ShowJobs(stringBuilder, "Running jobs", ((SafeDictionary<Handle, Job>)RunningJobsFieldInfo.GetValue(defaultJobManager)).Values.ToArray()); | |
| } | |
| if (QueuedJobsFieldInfo != null) | |
| { | |
| this.ShowJobs(stringBuilder, "Queued jobs", ((IEnumerable<Job>)QueuedJobsFieldInfo.GetValue(defaultJobManager)).ToArray()); | |
| } | |
| if (FinishedJobsFieldInfo != null) | |
| { | |
| this.ShowJobs(stringBuilder, "Finished jobs", ((IEnumerable<Job>)FinishedJobsFieldInfo.GetValue(defaultJobManager)).Reverse().ToArray()); | |
| } | |
| this.lt.Text = stringBuilder.ToString(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment