Skip to content

Commit 020bd4a

Browse files
committed
Avoid launching fallback dialog on cancellation
1 parent 88249a3 commit 020bd4a

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

Bonsai.Design/AnnotationTextEditor.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
3030
{
3131
using var editorDialog = new AnnotationBuilderEditorDialog();
3232
editorDialog.Annotation = (string)value;
33-
if (editorService.ShowDialog(editorDialog) == DialogResult.OK)
34-
{
35-
return editorDialog.Annotation;
36-
}
33+
return editorService.ShowDialog(editorDialog) == DialogResult.OK
34+
? editorDialog.Annotation
35+
: value;
3736
}
3837
}
3938

Bonsai.Scripting.Expressions.Design/ExpressionScriptEditor.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
3131
{
3232
using var editorDialog = new ExpressionScriptEditorDialog();
3333
editorDialog.Script = (string)value;
34-
if (editorService.ShowDialog(editorDialog) == DialogResult.OK)
35-
{
36-
return editorDialog.Script;
37-
}
34+
return editorService.ShowDialog(editorDialog) == DialogResult.OK
35+
? editorDialog.Script
36+
: value;
3837
}
3938
}
4039

Bonsai.Scripting.IronPython.Design/PythonScriptEditor.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
3131
{
3232
using var editorDialog = new PythonScriptEditorDialog();
3333
editorDialog.Script = (string)value;
34-
if (editorService.ShowDialog(editorDialog) == DialogResult.OK)
35-
{
36-
return editorDialog.Script;
37-
}
34+
return editorService.ShowDialog(editorDialog) == DialogResult.OK
35+
? editorDialog.Script
36+
: value;
3837
}
3938
}
4039

0 commit comments

Comments
 (0)