Skip to content

Commit

Permalink
Tiny better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Oct 23, 2022
1 parent dc454d4 commit cc3e0bc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
21 changes: 19 additions & 2 deletions CustomActionTester/CATHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ private void ReloadHistoryItem(int nextstepnum)
break;

case 2:
if (SelectedSolutionUnique != historyrequest.Solution?.Unique)
{
GetCustomActions("Default", ReloadHistoryItem, ++nextstepnum);
}
else
{
ReloadHistoryItem(++nextstepnum);
}
break;

case 3:
if (SelectedCustomUnique != historyrequest.UniqueName)
{
SelectCmbByStringAttribute(cmbCustomActions, catTool.Columns.APIUniqueName, historyrequest.UniqueName);
Expand All @@ -215,11 +226,17 @@ private void ReloadHistoryItem(int nextstepnum)
ReloadHistoryItem(++nextstepnum);
break;

case 3:
case 4:
if (SelectedCustomUnique != historyrequest.UniqueName)
{
Enabled = true;
MessageBox.Show($"Can't find the {catTool.Target}.", "Reload", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
GetInputParams(cmbCustomActions.SelectedRecord?.Id ?? Guid.Empty, ReloadHistoryItem, ++nextstepnum);
break;

case 4:
case 5:
SetInputParametersValues(historyrequest.Parameters);
Enabled = true;
break;
Expand Down
7 changes: 4 additions & 3 deletions CustomActionTester/CATcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private void GetCustomActions(string solutionunique, Action<int> nextstep = null
},
PostWorkCallBack = (args) =>
{
Enabled = nextstep == null;
Enabled = nextstep == null || args.Error != null;
ShowErrorDialog(args.Error);
if (args.Error == null && args.Result is EntityCollection actions)
{
Expand Down Expand Up @@ -315,6 +315,7 @@ private void GetInputParams(Guid caid, Action<int> nextstep = null, int nextstep
{
gridInputParams.DataSource = null;
gridOutputParams.DataSource = null;
nextstep?.Invoke(nextstepnum);
return;
}
var qx = catTool.GetInputQuery(caid);
Expand All @@ -328,7 +329,7 @@ private void GetInputParams(Guid caid, Action<int> nextstep = null, int nextstep
},
PostWorkCallBack = (args) =>
{
Enabled = nextstep == null;
Enabled = nextstep == null || args.Error != null;
ShowErrorDialog(args.Error);
if (args.Error == null && args.Result is EntityCollection inputs)
{
Expand Down Expand Up @@ -464,7 +465,7 @@ private void GetSolutions(SolutionType type, Action<int> nextstep = null, int ne
},
PostWorkCallBack = (args) =>
{
Enabled = nextstep == null;
Enabled = nextstep == null || args.Error != null;
ShowErrorDialog(args.Error);
if (args.Error == null && args.Result is EntityCollection solutions)
{
Expand Down

0 comments on commit cc3e0bc

Please sign in to comment.