コード例 #1
0
        private void CreatePagesWithoutChords(SongViewModel song)
        {
            if (String.IsNullOrWhiteSpace(Song.Text))
            {
                Pages.Add(new PresentationPageModel()
                {
                    Title    = song.Title,
                    Text     = AppResources.SongTextPresentation_EmptyText,
                    SongKey  = song.SongKey,
                    FontSize = FontSize
                });
                return;
            }

            Label testLabel = SongTextPresentationView.GetGhostLabelInstance();

            string[]      allText   = song.Text.Split(Environment.NewLine.ToCharArray());
            int           linesLeft = allText.Length;
            List <string> leftText  = allText.ToList();

            while (linesLeft > 0)
            {
                int linesFitted = PresentationPageHelper.GetFitPageModel(leftText.ToArray(), testLabel, song.Title, FontSize, song.SongKey);
                if (linesFitted != -1)
                {
                    Pages.Add(PresentationPageHelper.PresentationPageModel);
                    linesLeft -= linesFitted + 1;
                    leftText.RemoveRange(0, linesFitted + 1);
                }
            }
        }
コード例 #2
0
        private void CreatePagesWithChords(SongViewModel song)
        {
            Label testLabel = SongTextPresentationView.GetGhostLabelInstance();

            string[]      allText    = song.Text.Split(Environment.NewLine.ToCharArray());
            string[]      allChords  = song.Chords.Split(Environment.NewLine.ToCharArray());
            int           linesLeft  = allText.Length;
            List <string> leftText   = allText.ToList();
            List <string> leftChords = allChords.ToList();



            while (linesLeft > 0)
            {
                int linesFitted = PresentationPageHelper.GetFitPageModel(leftText.ToArray(), testLabel, song.Title, FontSize, song.SongKey, addChords: true, chordsToFit: leftChords.ToArray());
                if (linesFitted != -1)
                {
                    Pages.Add(PresentationPageHelper.PresentationPageModel);
                    linesLeft -= linesFitted;
                    leftText.RemoveRange(0, linesFitted);
                    leftChords.RemoveRange(0, linesFitted);
                }
            }
        }