public LoopDecorator(ITypedCommand <TValue> command, double startTime, double repeatDuration, int repeats) { this.command = command; StartTime = startTime; this.repeatDuration = repeatDuration; this.repeats = repeats; }
public void Add(ITypedCommand <TValue> command) { var triggerable = command as TriggerDecorator <TValue>; if (triggerable == null) { if (command.EndTime < command.StartTime) { Debug.Print($"'{command}' ends before it starts"); } findCommandIndex(command.StartTime, out int index); while (index < commands.Count) { if (commands[index].CompareTo(command) < 0) { index++; } else { break; } } HasOverlap = (index > 0 && (int)Math.Round(command.StartTime) < (int)Math.Round(commands[index - 1].EndTime)) || (index < commands.Count && (int)Math.Round(commands[index].StartTime) < (int)Math.Round(command.EndTime)); commands.Insert(index, command); } else { triggerable.OnStateChanged += triggerable_OnStateChanged; } }
public void Remove(ITypedCommand <TValue> command) { var triggerable = command as TriggerDecorator <TValue>; if (triggerable == null) { commands.Remove(command); } else { triggerable.OnStateChanged -= triggerable_OnStateChanged; } }
public void Add(ITypedCommand <TValue> command) { var triggerable = command as TriggerDecorator <TValue>; if (triggerable == null) { if (command.EndTime < command.StartTime) { Debug.Print($"'{command}' ends before it starts"); } int index; findCommandIndex(command.StartTime, out index); while (index < commands.Count) { if (commands[index].StartTime <= command.StartTime) { index++; } else { break; } } if (index > 0 && command.StartTime < commands[index - 1].EndTime) { hasOverlap = true; //Debug.Print($"'{command}' overlaps existing previous command '{commands[index - 1]}'"); } else if (index < commands.Count && commands[index].StartTime < command.EndTime) { hasOverlap = true; //Debug.Print($"'{command}' overlaps existing next command '{commands[index]}'"); } commands.Insert(index, command); } else { triggerable.OnStateChanged += triggerable_OnStateChanged; } }
public TriggerDecorator(ITypedCommand <TValue> command) { this.command = command; }
public UICommand(string header, ITypedCommand <INoteRepository> command) { Header = header; Command = command; }