Skip to content

Commit f47fb63

Browse files
committed
hide progress panel if settings/arguments have errors
1 parent 5b9c291 commit f47fb63

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

MainWindow.xaml.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ private void Main()
5656
// check args, null here because we get the args later
5757
var importSettings = ArgParser.Parse(null, rootFolder);
5858

59+
60+
5961
// if have files, process them
6062
if (importSettings != null)
6163
{
@@ -241,9 +243,9 @@ static void ParseFile(ImportSettings importSettings, int fileIndex)
241243

242244
private void btnConvert_Click(object sender, RoutedEventArgs e)
243245
{
246+
gridProcessingPanel.Visibility = Visibility.Visible;
244247
SaveSettings();
245248
StartProcess();
246-
gridProcessingPanel.Visibility = Visibility.Visible;
247249
}
248250

249251
void StartProcess(bool doProcess = true)
@@ -301,6 +303,11 @@ void StartProcess(bool doProcess = true)
301303
workerThread.Start(importSettings);
302304
}
303305
}
306+
else
307+
{
308+
HideProcessingPanel();
309+
txtConsole.Text = "Operation failed! Errors in arguments.";
310+
}
304311
}
305312

306313

Structs/ImportSettings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public class ImportSettings
1212
public IReader reader = new LAZ();
1313
public IWriter writer = new UCPC();
1414

15+
public bool haveError = false; // if errors during parsing args
16+
public string[] errorMessages = null; // last error message(s)
17+
1518
public bool useScale = false;
1619
public float scale = 1f;
1720

Tools/ArgParser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ public static ImportSettings Parse(string[] args, string rootFolder)
614614
Console.WriteLine(i + "> " + errors[i]);
615615
}
616616
Console.ForegroundColor = ConsoleColor.White;
617+
617618
return null;
618619
}
619620
else

0 commit comments

Comments
 (0)