示例#1
0
        /// <summary>
        /// User starts up the Piano and Sheet Music Forms
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxOpen_Click(object sender, EventArgs e)
        {
            Chromatic type = Chromatic.Natural;

            if (uxSharp.Checked == true)
            {
                type = Chromatic.Sharp;
            }
            if (uxFlats.Checked)
            {
                type = Chromatic.Flat;
            }

            // Positions the Forms so they aren't on top of each other
            SheetMusic sheet = new SheetMusic();

            sheet.Location = new Point(500, 200);
            Piano piano = new Piano(Convert.ToInt32(BPM.Text), type, sheet);

            piano.Location = new Point(250, 0);

            // Shows the Piano and hides the Main Form
            piano.Show();
            this.Hide();
        }
示例#2
0
        /// <summary>
        /// User starts up the Piano and Sheet Music Forms
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxOpen_Click(object sender, EventArgs e)
        {
            bool      rests = true;
            Chromatic type  = Chromatic.Natural;

            if (Off.Checked == false && On.Checked == false)
            {
                MessageBox.Show("Must Select to Show Rests or Not before continuing");
            }
            else if (Off.Checked == true && On.Checked == true)
            {
                MessageBox.Show("Must Select only On or Off, not both");
            }
            else if (Off.Checked == true || On.Checked == true)
            {
                if (uxSharp.Checked == true)
                {
                    type = Chromatic.Sharp;
                }
                if (uxFlats.Checked)
                {
                    type = Chromatic.Flat;
                }

                if (On.Checked == true)
                {
                    rests          = true;
                    Off.Checked    = false;
                    Off.CheckState = CheckState.Unchecked;
                    Off.Update();
                    this.Update();
                }
                if (Off.Checked == true)
                {
                    rests         = false;
                    On.Checked    = false;
                    On.CheckState = CheckState.Unchecked;
                    On.Update();
                    this.Update();
                }

                // Positions the Forms so they aren't on top of each other
                SheetMusic sheet = new SheetMusic();
                sheet.Location = new Point(500, 200);
                Piano piano = new Piano(Convert.ToInt32(BPM.Text), type, sheet, rests);
                piano.Location = new Point(250, 0);

                // Shows the Piano and hides the Main Form
                piano.Show();
                this.Hide();
            }
        }
示例#3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="bpm">Beats Per Minute</param>
        /// <param name="type">Chromatic Type</param>
        /// <param name="form">Sheet Music</param>
        public Piano(int bpm, Chromatic type, SheetMusic form)
        {
            InitializeComponent();
            BeatsPerMinute = bpm;
            sheetForm      = form;
            chromatic      = type;
            noteEstimator  = new NoteEstimator(bpm);
            sheetForm.Show();

            // Initializes the Stopwatch Timers
            for (int i = 0; i < oldTimers.Length; i++)
            {
                oldTimers[i]     = new Stopwatch();
                currentTimers[i] = new Stopwatch();
            }
            this.pianoControl.Size = this.Size;
        }
示例#4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="bpm">Beats Per Minute</param>
        /// <param name="type">Chromatic Type</param>
        /// <param name="form">Sheet Music</param>
        public Piano(int bpm, Chromatic type, SheetMusic form, bool rest)
        {
            InitializeComponent();
            sheetForm     = form;
            chromatic     = type;
            rests         = rest;
            noteEstimator = new NoteEstimator(bpm);

            sheetForm.Show();

            // Initializes the Stopwatch Timers
            for (int i = 0; i < oldTimers.Length; i++)
            {
                oldTimers[i]     = new Stopwatch();
                currentTimers[i] = new Stopwatch();
            }
            this.pianoControl.Size = this.Size;

            metronome          = new System.Timers.Timer(noteEstimator.SixteenthCount);
            metronome.Elapsed += OnTick;
        }