Added fill commands

This commit is contained in:
Lukasz Baldyga committed 2020-10-25 11:20:29 +00:00
1 parent 307854216b
commit 72c53314dd
2 files changed
+37

No files matched your search

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class Fill : Verb {
Drawer drawer;
bool enable;
public Fill(Drawer drawer, bool enable) {
this.drawer = drawer;
this.enable = enable;
}
public void ExecuteVerb() {
if (enable) drawer.EnableFill();
else drawer.DisableFill();
}
public string GetDescription() {
if (enable) return "Enable fill";
else return "Disable fill";
}
}
}
@@ -145,6 +145,16 @@ namespace Advanced_Software_Engineering {
return new ResetPen(drawer);
} else throw new Exception("Command doesn't take parameters");
case "fillon":
if (parameters.Length == 0) {
return new Fill(drawer, true);
} else throw new Exception("Command doesn't take parameters");
case "filloff":
if (parameters.Length == 0) {
return new Fill(drawer, false);
} else throw new Exception("Command doesn't take parameters");
case "pen":
if (parameters.Length == 1) {
return new PenColor(drawer, Value.TextToColor(parameters[0]));