Beispiel #1
0
 public PianoView(Grid myGrid, MusicPieceController mPc)
 {
     MusicPieceController = mPc;
     MusicPieceController.Piano.PianoView = this;
     this.myGrid = myGrid;
     DrawPianoView();
 }
Beispiel #2
0
        public MainWindow()
        {
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            PianoController pC = new PianoController()
            {
            };

            SheetController sC = new SheetController();
            MidiController  mC = new MidiController();

            sC.MidiController = mC;

            kC = new KeyboardController()
            {
                PianoController = pC
            };
            mPc = new MusicPieceController()
            {
                Piano = pC, SheetController = sC, MidiController = mC, KeyboardController = kC
            };

            //mPc.Guide.Start();
            DrawMenu();
            InitializeComponent();
            Show();
        }
        public void StartBtn_Click_BpmOutsideRange_ReturnsException(int input, Type expectedException)
        {
            // Arrange
            MusicPieceController mPc = GetMusicPieceController();

            //Console.WriteLine(mPc.Guide.Bpm);
            // Assert
            Assert.AreEqual(1, 1);
            //Assert.Throws(expectedException, () => mPc.Guide.Bpm = input);
        }
        public MusicPieceController GetMusicPieceController()
        {
            PianoController      pC  = new PianoController();
            MusicPieceController mPc = new MusicPieceController()
            {
                Piano = pC
            };

            return(mPc);
        }
Beispiel #5
0
        public StaveView(Grid myGrid, MusicPieceController mPc)
        {
            this.myGrid          = myGrid;
            MusicPieceController = mPc;
            sheet = new StackPanel();
            DrawMusic();

            MusicPieceController.staffEndReached += scrollToNext;
            MusicPieceController.GoToFirstStaff  += ScrollToTop;
            MusicPieceController.HoldPosition    += ScrollToCurrent;
        }
        public void StartBtn_Click_SaveNoteType_CorrectNoteTypeSaved(string note, NoteType result)
        {
            // Arrange
            MusicPieceController mPc = GetMusicPieceController();

            // Act
            mPc.Guide.SetNote(note);

            // Assert
            Assert.AreEqual((NoteType)mPc.Guide.Note, result);
        }
Beispiel #7
0
        public ButtonView(Grid myGrid, StaveView sv, NoteView nv)
        {
            this.myGrid = myGrid;
            this.nv     = nv;
            this.sv     = sv;
            this.mPc    = sv.MusicPieceController;

            //menuGrid.ShowGridLines = true;
            // Define all columns for menuGrid
            DefineGridRowsMenuGrid();

            // Draw menu items
            DrawBpmMenu();

            // Metronome enable/disable button
            metronomeText                       = new TextBlock();
            metronomeText.Text                  = "🔇";
            metronomeButton                     = new Button();
            metronomeButton.Content             = metronomeText;
            metronomeButton.Width               = 40;
            metronomeButton.Height              = 40;
            metronomeButton.FontSize            = 25;
            metronomeButton.Click              += onMetronomeButtonClick;
            metronomeButton.HorizontalAlignment = HorizontalAlignment.Center;


            // Piano enable/disable button
            TextDecoration strikeTroughDecoration = new TextDecoration();

            strikeTroughDecoration.Location = TextDecorationLocation.Strikethrough;
            strikeTroughDecoration.Pen      = new Pen(Brushes.Red, 3);
            strikeTrough.Add(strikeTroughDecoration);
            pianoText                       = new TextBlock();
            pianoText.Text                  = "🎹";
            pianoText.TextDecorations       = strikeTrough;
            pianoButton                     = new Button();
            pianoButton.Content             = pianoText;
            pianoButton.Width               = 40;
            pianoButton.Height              = 40;
            pianoButton.FontSize            = 20;
            pianoButton.Click              += onPianoButtonClick;
            pianoButton.HorizontalAlignment = HorizontalAlignment.Center;
            pianoButton.VerticalAlignment   = VerticalAlignment.Bottom;

            // Start button
            startBtn.FontSize            = 25;
            startBtn.Name                = "startBtn";
            startBtn.Content             = "▶";
            startBtn.Width               = 40;
            startBtn.Height              = 40;
            startBtn.HorizontalAlignment = HorizontalAlignment.Center;
            startBtn.Click              += StartBtn_Click;
            Grid.SetColumn(startBtn, 5);

            // Stop Button
            StopBtn.FontSize            = 25;
            StopBtn.Name                = "stopBtn";
            StopBtn.Content             = "◼";
            StopBtn.Width               = 40;
            StopBtn.Height              = 40;
            StopBtn.HorizontalAlignment = HorizontalAlignment.Center;
            StopBtn.Click              += StopBtn_Click;
            StopBtn.IsEnabled           = false;
            Grid.SetColumn(StopBtn, 6);


            // Add the button to the Grid
            SelectSheetMusic                     = new Button();
            SelectSheetMusic.Name                = "SelectSheetMusic";
            SelectSheetMusic.Content             = "Selecteer \n muziekstuk";
            SelectSheetMusic.Width               = menuGrid.ColumnDefinitions[0].Width.Value - 15;
            SelectSheetMusic.Height              = 40;
            SelectSheetMusic.HorizontalAlignment = HorizontalAlignment.Left;
            SelectSheetMusic.VerticalAlignment   = VerticalAlignment.Bottom;
            SelectSheetMusic.Click              += SelectSheetMusic_Click;

            Grid.SetRow(menuGrid, 0);

            Grid.SetColumn(SelectSheetMusic, 0);
            Grid.SetColumn(pianoButton, 8);
            Grid.SetColumn(metronomeButton, 7);

            menuGrid.Children.Add(metronomeButton);
            menuGrid.Children.Add(pianoButton);
            menuGrid.Children.Add(startBtn);
            menuGrid.Children.Add(StopBtn);
            menuGrid.Children.Add(SelectSheetMusic);

            myGrid.Children.Add(menuGrid);
        }
Beispiel #8
0
 public NoteView(StaveView sv)
 {
     this.mPc = sv.MusicPieceController;
     mPc.SheetController.NoteView = this;
     DrawNotes();
 }