Пример #1
0
        public void ShowStaff(string content)
        {
            if (content != null)
            {
                LilypondText = content;
            }
            Staff.Clear();
            Lilypond lily = new Lilypond("");

            Staff = lily.ReadLily(Staff, LilypondText);
            ShowStaff();
        }
Пример #2
0
        public void CheckForChange()
        {
            Lilypond lily      = new Lilypond("");
            string   finalLily = lily.GetLilyFromStaff(Staff);

            if (finalLily != originalLily)
            {
                var result = MessageBox.Show("Save changes?", "Close program", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    Save();
                }
            }
        }
Пример #3
0
        public void ShowStaff()
        {
            WPFStaffs.Clear();
            WPFManager.getMusicSymbols(Staff, WPFStaffs);
            WPFStaffsChanged?.Invoke(this, new WPFStaffsEventArgs()
            {
                Symbols = WPFStaffs
            });

            Lilypond lily = new Lilypond("");

            LilypondText = lily.GetLilyFromStaff(Staff);

            Midi midi = new Midi("");

            MidiSequence = midi.GetSequenceFromStaff(Staff);
            MidiSequenceChanged?.Invoke(this, new MidiSequenceEventArgs()
            {
                MidiSequence = MidiSequence
            });
        }
Пример #4
0
        public void OpenFile(string fileName)
        {
            Staff.Clear();
            Midi     midi = new Midi(fileName);
            Lilypond lily = new Lilypond(fileName);

            if (Path.GetExtension(fileName).EndsWith(".mid"))
            {
                midi.Open();
                midi.ReadMidi(Staff);
            }
            else if (Path.GetExtension(fileName).EndsWith(".ly"))
            {
                lily.Open();
                lily.ReadLily(Staff);
            }
            else
            {
                throw new NotSupportedException($"File extension {Path.GetExtension(fileName)} is not supported.");
            }
            originalLily = lily.GetLilyFromStaff(Staff);
            ShowStaff();
        }
Пример #5
0
        internal void SaveToLilypond(string fileName)
        {
            Lilypond lily = new Lilypond(fileName);

            lily.SaveToFile(Staff);
        }