Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
IamRanjeetSingh committed May 17, 2024
1 parent b4a2073 commit 5579046
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,10 +1262,66 @@ private async Task ContinueRunFromAutomatePage(eContinueFrom continueFrom, objec
await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.LastStoppedAction);
break;
case eContinueFrom.SpecificAction:
await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.SpecificAction, mBusinessFlow, (Activity)((Tuple<Activity, Act>)executedItem).Item1, (Act)((Tuple<Activity, Act>)executedItem).Item2);
Activity parentActivity = (Activity)((Tuple<Activity, Act>)executedItem).Item1;
Act actionToExecute = (Act)((Tuple<Activity, Act>)executedItem).Item2;

Check notice on line 1266 in Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml.cs#L1266

Remove this unnecessary cast to 'Act'.
try
{
if (mExecutionEngine.ExecutionLoggerManager.Configuration.SelectedDataRepositoryMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB)
{
bool reachedCurrentAction = false;
foreach (Activity activity in mBusinessFlow.Activities)
{
foreach (Act action in activity.Acts.Cast<Act>())
{
if (activity == parentActivity && action == actionToExecute)
{
reachedCurrentAction = true;
break;
}
mExecutionEngine.ExecutionLoggerManager.ActionEnd(0, action);
}
if (reachedCurrentAction)
{
break;
}
mExecutionEngine.ExecutionLoggerManager.ActivityEnd(0, activity);
}
}
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR, "Error while logging previous activity and actions", ex);
}

await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.SpecificAction, mBusinessFlow, parentActivity, actionToExecute);
break;
case eContinueFrom.SpecificActivity:
mBusinessFlow.CurrentActivity = (Activity)executedItem;
Activity activityToExecute = (Activity)executedItem;
try
{
if (mExecutionEngine.ExecutionLoggerManager.Configuration.SelectedDataRepositoryMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB)
{
foreach (Activity activity in mBusinessFlow.Activities)
{
if (activity == activityToExecute)
{
break;
}
foreach (Act action in activity.Acts.Cast<Act>())
{
mExecutionEngine.ExecutionLoggerManager.ActionEnd(0, action);
}
mExecutionEngine.ExecutionLoggerManager.ActivityEnd(0, activity);
}
}
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR, "Error while logging previous activity and actions", ex);
}

mBusinessFlow.CurrentActivity = activityToExecute;

await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.SpecificActivity, mBusinessFlow, (Activity)executedItem);
break;
default:
Expand Down

0 comments on commit 5579046

Please sign in to comment.