1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SketchAssistantWPF
- {
- public class SketchAction
- {
-
- public enum ActionType
- {
- Draw,
- Delete,
- Start
- }
-
- private ActionType thisAction;
-
- private HashSet<int> lineIDs;
-
-
-
-
-
- public SketchAction(ActionType theAction, HashSet<int> affectedIDs)
- {
- thisAction = theAction;
- if (theAction.Equals(ActionType.Start)) { lineIDs = new HashSet<int>(); }
- else { lineIDs = new HashSet<int>(affectedIDs); }
- }
-
-
-
-
-
- public SketchAction(ActionType theAction, int affectedID)
- {
- thisAction = theAction;
- if (theAction.Equals(ActionType.Start)) { lineIDs = new HashSet<int>(); }
- else
- {
- lineIDs = new HashSet<int>();
- lineIDs.Add(affectedID);
- }
- }
-
-
-
-
- public ActionType GetActionType()
- {
- return thisAction;
- }
-
-
-
-
- public HashSet<int> GetLineIDs()
- {
- return lineIDs;
- }
-
-
-
-
- public String GetActionInformation()
- {
- String returnString;
- switch (thisAction)
- {
- case ActionType.Start:
- returnString = "A new canvas was created.";
- break;
- case ActionType.Draw:
- returnString = "Line number " + lineIDs.First().ToString() + " was drawn.";
- break;
- case ActionType.Delete:
- if (lineIDs.Count == 1) { returnString = "Line number " + lineIDs.First().ToString() + " was deleted."; }
- else
- {
- returnString = "Several Lines were deleted.";
- }
- break;
- default:
- returnString = "There is no information available for this action.";
- break;
- }
- return returnString;
- }
- }
- }
|