Update: SignalR 2.0.3 Migration; Noticeboards

Migrate all SignalR 1.x Persistent Connections to SignalR 2.x Hubs.
Abstracts ScheduledTaskStatus with core interface and adds a Mock for
optional status reporting. Noticeboards rewritten (with new theme) to be
more resilient and accurate.
This commit is contained in:
Gary Sharp
2014-06-01 23:27:07 +10:00
parent f6fae26bc7
commit 4cd57f4a90
116 changed files with 9874 additions and 6462 deletions
+58 -14
View File
@@ -6,19 +6,30 @@ using System.Threading.Tasks;
namespace Disco.Services.Tasks
{
public class ScheduledTaskMockStatus : IScheduledTaskBasicStatus
public class ScheduledTaskMockStatus : IScheduledTaskStatus
{
private byte progress;
private string currentProcess;
private string currentDescription;
public byte Progress { get; set; }
public string CurrentProcess { get; set; }
public string CurrentDescription { get; set; }
public byte Progress { get { return this.progress; } }
public string CurrentProcess { get { return this.currentProcess; } }
public string CurrentDescription { get { return this.currentDescription; } }
public bool IgnoreCurrentProcessChanges { get; set; }
public bool IgnoreCurrentDescription { get; set; }
public double ProgressMultiplier { get; set; }
public byte ProgressOffset { get; set; }
public string FinishedMessage { get; set; }
public string FinishedUrl { get; set; }
public Exception TaskException { get; set; }
private byte CalculateProgressValue(byte Progress)
{
return (byte)((Progress * this.ProgressMultiplier) + this.ProgressOffset);
}
public void UpdateStatus(byte Progress)
{
this.progress = Progress;
this.Progress = CalculateProgressValue(Progress);
}
public void UpdateStatus(double Progress)
{
@@ -26,12 +37,14 @@ namespace Disco.Services.Tasks
}
public void UpdateStatus(string CurrentDescription)
{
this.currentDescription = CurrentDescription;
if (!IgnoreCurrentDescription)
this.CurrentDescription = CurrentDescription;
}
public void UpdateStatus(byte Progress, string CurrentDescription)
{
this.progress = Progress;
this.currentDescription = CurrentDescription;
this.Progress = CalculateProgressValue(Progress);
if (!IgnoreCurrentDescription)
this.CurrentDescription = CurrentDescription;
}
public void UpdateStatus(double Progress, string CurrentDescription)
{
@@ -39,15 +52,46 @@ namespace Disco.Services.Tasks
}
public void UpdateStatus(byte Progress, string CurrentProcess, string CurrentDescription)
{
this.progress = Progress;
this.currentProcess = CurrentProcess;
this.currentDescription = CurrentDescription;
this.Progress = CalculateProgressValue(Progress);
if (!IgnoreCurrentProcessChanges)
this.CurrentProcess = CurrentProcess;
if (!IgnoreCurrentDescription)
this.CurrentDescription = CurrentDescription;
}
public void UpdateStatus(double Progress, string CurrentProcess, string CurrentDescription)
{
UpdateStatus((byte)Progress, CurrentProcess, CurrentDescription);
}
public void SetFinishedUrl(string FinishedUrl)
{
this.FinishedUrl = FinishedUrl;
}
public void SetFinishedMessage(string FinishedMessage)
{
this.FinishedMessage = FinishedMessage;
}
public void Finished()
{
Finished(this.FinishedMessage, this.FinishedUrl);
}
public void Finished(string FinishedMessage)
{
Finished(FinishedMessage, this.FinishedUrl);
}
public void Finished(string FinishedMessage, string FinishedUrl)
{
this.FinishedMessage = FinishedMessage;
this.FinishedUrl = FinishedUrl;
}
public void SetTaskException(Exception TaskException)
{
this.TaskException = TaskException;
}
public static ScheduledTaskMockStatus Create()
{
return new ScheduledTaskMockStatus();