示例#1
0
 void ExecuteOnRelease(IonianTone?tone)
 {
     if (ReleaseCommand?.CanExecute(tone) ?? false)
     {
         ReleaseCommand.Execute(tone);
     }
 }
示例#2
0
 private void ExecuteReleaseCommand()
 {
     if (CanExecuteReleaseCommand())
     {
         ReleaseCommand.Execute(ReleaseCommandParameter);
     }
 }
示例#3
0
 private void ReleaseKey()
 {
     if (ReleaseCommand?.CanExecute(this) ?? false)
     {
         ReleaseCommand.Execute(this);
         attacked       = false;
         Rectangle.Fill = Sharp ? SharpDefaultKeyFill : DefaultKeyFill;
     }
 }
示例#4
0
        void ExecuteOnRelease(PianoKey view)
        {
            var tone = new IonianTone()
            {
                Scale  = view.Scale,
                Sharp  = view.Sharp,
                Octave = view.Scale == IonianScale.A || view.Scale == IonianScale.B ? Octave + 1 : Octave,
            };

            if (ReleaseCommand?.CanExecute(tone) ?? false)
            {
                ReleaseCommand.Execute(tone);
            }
        }
示例#5
0
        public void Execute()
        {
            int releases = 0;

            var actuatorRepo = new Mock <IActuator>();

            actuatorRepo.Setup(x => x.Hit(It.IsAny <Button>())).Callback(() => Assert.Fail());
            actuatorRepo.Setup(x => x.Press(It.IsAny <Button>())).Callback(() => Assert.Fail());
            actuatorRepo.Setup(x => x.Release(It.IsAny <Button>())).Callback(() => releases++);

            var button    = Button.Down;
            var timestamp = TimeSpan.FromSeconds(3);
            var command   = new ReleaseCommand(button, timestamp);

            command.Execute(actuatorRepo.Object);

            Assert.AreEqual(1, releases);
        }