public void RunWorkflow(string eventPropertyName)
{
if (!AllDone)
{
if (SongsToAnalyzeBatchUploadReady &&
PropertyNameMatchesEventName(SongsToAnalyzeBatchUploadReadyPropertyName, eventPropertyName))
{
ExecutionQueue.Enqueue(
new WaitCallback(DownloadAnalyzedSongs),
ExecutionQueue.Policy.Queued);
}
else
{
if (SongsToAnalyzeBatchDownloadReady &&
PropertyNameMatchesEventName(SongsToAnalyzeBatchDownloadReadyPropertyName, eventPropertyName))
{
ExecutionQueue.Enqueue(
new WaitCallback(AnalyzeSongs),
ExecutionQueue.Policy.Queued);
}
else
{
if (SongsToAnalyzeLoaded &&
(PropertyNameMatchesEventName(SongsToAnalyzeLoadedPropertyName, eventPropertyName) ||
PropertyNameMatchesEventName(CatalogIdPropertyName, eventPropertyName)))
{
if (String.IsNullOrEmpty(CatalogId))
{
ExecutionQueue.Enqueue(
new WaitCallback(LoadCatalogId),
ExecutionQueue.Policy.Immediate);
}
else
{
ExecutionQueue.Enqueue(
new WaitCallback(DownloadAnalyzedSongsAlreadyInRemoteCatalog),
ExecutionQueue.Policy.Queued);
}
}
else
{
if (SongsOnDeviceLoaded &&
AnalyzedSongsLoaded &&
(PropertyNameMatchesEventName(SongsOnDeviceLoadedPropertyName, eventPropertyName) ||
PropertyNameMatchesEventName(AnalyzedSongsLoadedPropertyName, eventPropertyName)))
{
ExecutionQueue.Enqueue(
new WaitCallback(DiffSongs),
ExecutionQueue.Policy.Immediate);
}
else
{
if (!SongsOnDeviceLoaded &&
PropertyNameMatchesEventName(SongsOnDeviceLoadedPropertyName, eventPropertyName))
{
ExecutionQueue.Enqueue(
new WaitCallback(GetSongsOnDevice),
ExecutionQueue.Policy.Immediate);
}
if (!AnalyzedSongsLoaded &&
PropertyNameMatchesEventName(AnalyzedSongsLoadedPropertyName, eventPropertyName))
{
ExecutionQueue.Enqueue(
new WaitCallback(GetAnalyzedSongs),
ExecutionQueue.Policy.Immediate);
}
}
}
}
}
}
}