Exemple #1
0
        /// <summary>
        /// Creates a new game.
        /// </summary>
        /// <param name="timerInterval">The duration of a game cycle in miliseconds.</param>
        /// <param name="controller">A keyboard controller that will process the input device's messages.</param>
        /// <param name="state">The keyboard state that will represent the current state of the input device's keyboard.</param>
        protected TrainerBase(double timerInterval, KeyboardController controller, KeyboardState state)
        {
            keyboardController = controller;
            keyboardController.KeyboardStateChanged += KeyboardStateChanged;

            keyboardState = state;

            timer           = new Timer(timerInterval);
            timer.Elapsed  += TimerElapsed;
            timer.AutoReset = true;
        }
        public MainWindow()
        {
            InitializeComponent();

            keyboardState      = new KeyboardState();
            keyboardController = new KeyboardController(keyboardState);
            game = new NoteTrainer(keyboardController, keyboardState);
            game.ViewModelChangedEvent  += Game_ViewModelChangedEvent;
            InputDeviceCombo.ItemsSource = keyboardController.MidiDevices;
            HandCombo.ItemsSource        = new string[] { Hands.Left.ToString(), Hands.Right.ToString(), Hands.Both.ToString() };
            HandCombo.SelectedIndex      = 0;

            musicScore = Score.CreateOneStaffScore(Clef.Treble, MajorScale.C);
            musicScore.AddStaff(Clef.Bass, TimeSignature.CommonTime, Step.C, MajorAndMinorScaleFlags.MajorFlat);

            GameViewer.ScoreSource = musicScore;
        }
Exemple #3
0
 public NoteTrainer(KeyboardController controller, KeyboardState keyboardState) : base(500, controller, keyboardState)
 {
 }