Пример #1
0
        private static void RenderingModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NoteViewer          control  = (NoteViewer)obj;
            ScoreRenderingModes oldValue = (ScoreRenderingModes)args.OldValue;
            ScoreRenderingModes newValue = (ScoreRenderingModes)args.NewValue;

            if (control.InnerScore == null)
            {
                return;
            }
            control.RenderOnCanvas(control.InnerScore);
        }
Пример #2
0
        private static void ScoreSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NoteViewer control  = (NoteViewer)obj;
            Score      oldValue = args.OldValue as Score;
            Score      newValue = args.NewValue as Score;

            if (oldValue != null)
            {
                oldValue.Safety.BoundControl = null;
            }
            Score.SanityCheck(newValue, control);

            control.RenderOnCanvas(newValue);
        }
Пример #3
0
        private static void XmlSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NoteViewer contol   = (NoteViewer)obj;
            string     oldValue = args.OldValue as string;
            string     newValue = args.NewValue as string;

            var xmlDocument = XDocument.Parse(newValue);

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

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

            contol.RenderOnCanvas(score);
        }
Пример #4
0
        private static void PlaybackCursorPositionChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NoteViewer             control  = (NoteViewer)obj;
            PlaybackCursorPosition oldValue = (PlaybackCursorPosition)args.OldValue;
            PlaybackCursorPosition newValue = (PlaybackCursorPosition)args.NewValue;

            if (control.InnerScore == null)
            {
                return;
            }
            if (control.Renderer == null)
            {
                return;
            }

            if (!newValue.IsValid)
            {
                return;
            }

            control.Renderer.DrawPlaybackCursor(newValue);
        }
Пример #5
0
 private static void CurrentPageChanged(NoteViewer control, int oldValue, int newValue)
 {
     control.RenderOnCanvas(control.InnerScore);
 }