Exemple #1
0
        void ExecuteOnAttack(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 (AttackCommand?.CanExecute(tone) ?? false)
            {
                AttackCommand.Execute(tone);
            }
        }
Exemple #2
0
        private void AddPianoKeyView(int column, int span, IonianScale scale, bool sharp)
        {
            var view = new PianoKey()
            {
                Sharp          = sharp,
                Scale          = scale,
                AttackCommand  = OnAttack,
                ReleaseCommand = OnRelease,
            };

            Grid.SetColumn(view, column);
            Grid.SetColumnSpan(view, span);
            Grid.SetRowSpan(view, sharp ? 1 : 2);
            grid.Children.Add(view);
        }