Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 887b9c8

Browse files
KayMKMlzc850612
authored andcommitted
add clear state (#486)
1 parent 7814965 commit 887b9c8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

solutions/Virtual-Assistant/src/csharp/skills/calendarskill/Dialogs/Main/MainDialog.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ public MainDialog(
275275

276276
private async Task<InterruptionAction> OnCancel(DialogContext dc)
277277
{
278+
var state = await _stateAccessor.GetAsync(dc.Context, () => new CalendarSkillState());
279+
state.Clear();
278280
await dc.Context.SendActivityAsync(dc.Context.Activity.CreateReply(CalendarMainResponses.CancelMessage));
279281
await CompleteAsync(dc);
280282
await dc.CancelAllDialogsAsync();

solutions/Virtual-Assistant/src/csharp/skills/calendarskill/Dialogs/Summary/SummaryDialog.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public SummaryDialog(
155155
// this will lead to error when test
156156
if (string.IsNullOrEmpty(state.APIToken))
157157
{
158+
state.Clear();
158159
return await sc.EndDialogAsync(true);
159160
}
160161

@@ -185,6 +186,7 @@ public SummaryDialog(
185186
if (searchedEvents.Count == 0)
186187
{
187188
await sc.Context.SendActivityAsync(sc.Context.Activity.CreateReply(SummaryResponses.ShowNoMeetingMessage));
189+
state.Clear();
188190
return await sc.EndDialogAsync(true);
189191
}
190192
else
@@ -333,6 +335,7 @@ public SummaryDialog(
333335
var topIntent = luisResult?.TopIntent().intent;
334336
if (topIntent == null)
335337
{
338+
state.Clear();
336339
return await sc.EndDialogAsync(true);
337340
}
338341

@@ -360,6 +363,7 @@ public SummaryDialog(
360363
}
361364
else
362365
{
366+
state.Clear();
363367
return await sc.EndDialogAsync(true);
364368
}
365369
}

0 commit comments

Comments
 (0)