@@ -372,9 +372,9 @@ private void PerformDNSLookupHostnameAction()
372
372
373
373
private void CustomCommandAction ( object guid )
374
374
{
375
- CustomCommand ( guid ) ;
375
+ CustomCommand ( guid ) ;
376
376
}
377
-
377
+
378
378
public ICommand AddProfileSelectedHostCommand => new RelayCommand ( p => AddProfileSelectedHostAction ( ) ) ;
379
379
private async void AddProfileSelectedHostAction ( )
380
380
{
@@ -590,7 +590,7 @@ private void ScanFinished()
590
590
IsScanRunning = false ;
591
591
}
592
592
593
- private void CustomCommand ( object guid )
593
+ private async void CustomCommand ( object guid )
594
594
{
595
595
if ( guid is Guid id )
596
596
{
@@ -605,10 +605,20 @@ private void CustomCommand(object guid)
605
605
606
606
info . FilePath = Regex . Replace ( info . FilePath , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
607
607
info . FilePath = Regex . Replace ( info . FilePath , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
608
- info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
609
- info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
608
+ if ( ! string . IsNullOrEmpty ( info . Arguments ) )
609
+ {
610
+ info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $hostname\\ $\\ $" , hostname , RegexOptions . IgnoreCase ) ;
611
+ info . Arguments = Regex . Replace ( info . Arguments , "\\ $\\ $ipaddress\\ $\\ $" , ipAddress , RegexOptions . IgnoreCase ) ;
612
+ }
610
613
611
- Utilities . CustomCommand . Run ( info ) ;
614
+ try
615
+ {
616
+ Utilities . CustomCommand . Run ( info ) ;
617
+ }
618
+ catch ( Exception ex )
619
+ {
620
+ await _dialogCoordinator . ShowMessageAsync ( this , Resources . Localization . Strings . ResourceManager . GetString ( "Error" , LocalizationManager . Culture ) , ex . Message , MessageDialogStyle . Affirmative , AppearanceManager . MetroDialog ) ;
621
+ }
612
622
}
613
623
}
614
624
0 commit comments