예제 #1
0
        private static void ScoreSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NoteViewer viewer   = obj as NoteViewer;
            var        oldScore = args.OldValue as Score;
            var        score    = args.NewValue as Score;

            if (oldScore != null)
            {
                oldScore.Safety.BoundControl = null;
            }
            Score.SanityCheck(score, viewer);

            viewer.RenderOnCanvas(score);
        }
예제 #2
0
        private static void XmlSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NoteViewer viewer    = obj as NoteViewer;
            string     xmlSource = args.NewValue as string;

            XDocument xmlDocument = XDocument.Parse(xmlSource);

            //Apply transformations:
            if (viewer.XmlTransformations != null)
            {
                foreach (var transformation in viewer.XmlTransformations)
                {
                    xmlDocument = transformation.Parse(xmlDocument);
                }
            }

            MusicXmlParser parser = new MusicXmlParser();
            var            score  = parser.Parse(xmlDocument);

            viewer.RenderOnCanvas(score);
        }