예제 #1
0
 public LoopDecorator(ITypedCommand <TValue> command, double startTime, double repeatDuration, int repeats)
 {
     this.command        = command;
     StartTime           = startTime;
     this.repeatDuration = repeatDuration;
     this.repeats        = repeats;
 }
예제 #2
0
        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;
            }
        }
예제 #3
0
        public void Remove(ITypedCommand <TValue> command)
        {
            var triggerable = command as TriggerDecorator <TValue>;

            if (triggerable == null)
            {
                commands.Remove(command);
            }
            else
            {
                triggerable.OnStateChanged -= triggerable_OnStateChanged;
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
 public TriggerDecorator(ITypedCommand <TValue> command)
 {
     this.command = command;
 }
예제 #6
0
 public UICommand(string header, ITypedCommand <INoteRepository> command)
 {
     Header  = header;
     Command = command;
 }