protected virtual void ContinueAtMatchValue( NativeActivityContext context, ActivityInstance completedInstance, DynamicValue result) { if (completedInstance.State == ActivityInstanceState.Faulted) { context.Abort(new Exception(Properties.Resources.FailMatchValue)); } int caseIndex = context.GetValue <int>(this.CaseIndex); DynamicValue expressionValue = context.GetValue <DynamicValue>(this.Expression); if (DoValuesMatch(expressionValue, result)) { MatchCase matchCase = this.Cases[caseIndex]; this.OnCaseMatched(context, completedInstance, result, matchCase.Case); } else { caseIndex++; if (caseIndex >= this.Cases.Count) { if (null != this.Default) { this.OnCaseMatched(context, completedInstance, result, this.Default); } return; } context.SetValue <int>(this.CaseIndex, caseIndex); MatchCase nextMatchCase = this.Cases[caseIndex]; context.ScheduleActivity(nextMatchCase.Expression, onMatchValueComplete); } }
protected override void Execute(NativeActivityContext context) { if (this.Cases.Count == 0 || null == this.Expression) { return; } context.SetValue <int>(this.CaseIndex, 0); MatchCase matchCase = this.Cases[0]; context.ScheduleActivity(matchCase.Expression, onMatchValueComplete); }