Skip to content

Commit 840fb02

Browse files
CopilotJusterZhu
andcommitted
Fix async consistency in MessageBox calls
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
1 parent a2c541d commit 840fb02

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/ViewModels/ExtensionViewModel.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,26 +311,26 @@ private bool CanAddCustomProperty()
311311
!string.IsNullOrWhiteSpace(NewCustomPropertyValue);
312312
}
313313

314-
private void AddCustomPropertyAction()
314+
private async void AddCustomPropertyAction()
315315
{
316316
try
317317
{
318318
if (string.IsNullOrWhiteSpace(NewCustomPropertyKey))
319319
{
320-
MessageBox.Show("Property key cannot be empty", "Validation Error", Buttons.OK);
320+
await MessageBox.ShowAsync("Property key cannot be empty", "Validation Error", Buttons.OK);
321321
return;
322322
}
323323

324324
if (string.IsNullOrWhiteSpace(NewCustomPropertyValue))
325325
{
326-
MessageBox.Show("Property value cannot be empty", "Validation Error", Buttons.OK);
326+
await MessageBox.ShowAsync("Property value cannot be empty", "Validation Error", Buttons.OK);
327327
return;
328328
}
329329

330330
// Check if key already exists
331331
if (ConfigModel.CustomProperties.ContainsKey(NewCustomPropertyKey))
332332
{
333-
MessageBox.Show($"Property key '{NewCustomPropertyKey}' already exists", "Validation Error", Buttons.OK);
333+
await MessageBox.ShowAsync($"Property key '{NewCustomPropertyKey}' already exists", "Validation Error", Buttons.OK);
334334
return;
335335
}
336336

@@ -353,23 +353,23 @@ private void AddCustomPropertyAction()
353353
}
354354
catch (Exception ex)
355355
{
356-
MessageBox.Show($"Failed to add custom property: {ex.Message}", "Error", Buttons.OK);
356+
await MessageBox.ShowAsync($"Failed to add custom property: {ex.Message}", "Error", Buttons.OK);
357357
}
358358
}
359359

360-
private void RemoveCustomPropertyAction(CustomPropertyModel? property)
360+
private async void RemoveCustomPropertyAction(CustomPropertyModel? property)
361361
{
362362
try
363363
{
364364
if (property == null)
365365
{
366-
MessageBox.Show("No property selected to remove", "Validation Error", Buttons.OK);
366+
await MessageBox.ShowAsync("No property selected to remove", "Validation Error", Buttons.OK);
367367
return;
368368
}
369369

370370
if (string.IsNullOrWhiteSpace(property.Key))
371371
{
372-
MessageBox.Show("Property key is invalid", "Validation Error", Buttons.OK);
372+
await MessageBox.ShowAsync("Property key is invalid", "Validation Error", Buttons.OK);
373373
return;
374374
}
375375

@@ -384,7 +384,7 @@ private void RemoveCustomPropertyAction(CustomPropertyModel? property)
384384
}
385385
catch (Exception ex)
386386
{
387-
MessageBox.Show($"Failed to remove custom property: {ex.Message}", "Error", Buttons.OK);
387+
await MessageBox.ShowAsync($"Failed to remove custom property: {ex.Message}", "Error", Buttons.OK);
388388
}
389389
}
390390

0 commit comments

Comments
 (0)