Made errors less intrusive

This commit is contained in:
Lukasz Baldyga committed 2020-10-25 10:56:49 +00:00
1 parent 98ac780f76
commit df09a985c7
3 files changed
+14 -3

No files matched your search

@@ -103,6 +103,10 @@ namespace Advanced_Software_Engineering {
return desc; return desc;
} }
public int GetNumberOfCommands() {
return commands.Count;
}
} }
} }
@@ -31,7 +31,7 @@ namespace Advanced_Software_Engineering
commander = new Commander(graphics); commander = new Commander(graphics);
} }
public Draw_Preview(String commands) { public Draw_Preview(string commands) {
InitializeComponent(); InitializeComponent();
SettingsAndHelperFunctions.NumberOfWindows++; SettingsAndHelperFunctions.NumberOfWindows++;
graphics = panel1.CreateGraphics(); graphics = panel1.CreateGraphics();
@@ -82,5 +82,9 @@ namespace Advanced_Software_Engineering
return commander.ExplainCommands(); return commander.ExplainCommands();
} }
public bool IsSuccess() {
return commander.GetNumberOfCommands() > 0;
}
} }
} }
@@ -148,8 +148,11 @@ namespace Advanced_Software_Engineering {
DisplayForm.RemoveAllCommands(); DisplayForm.RemoveAllCommands();
DisplayForm.SubmitCommands(textBox1.Text); DisplayForm.SubmitCommands(textBox1.Text);
} }
DisplayForm.Show();
DisplayForm.Focus(); if (DisplayForm.IsSuccess()) {
DisplayForm.Show();
DisplayForm.Focus();
}
} }
public void CheckCode() { public void CheckCode() {