/// <summary>
        /// Execute
        /// </summary>
        /// <param name="context">WF context</param>
        /// <returns></returns>
        protected override void Execute(NativeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            SplitedDocument sDoc         = context.GetValue(this.SplitedDocument);
            var             localEpisode = context.GetValue(this.LocalEpisode);

            // TODO : Code this activity
            DMDocument doc = new DMDocument();

            int index = 0;

            foreach (var para in sDoc.Paragraphs)
            {
                DMParagraph paragraph = new DMParagraph();

                for (int i = 0; i < para.Sentences.Count; i++)
                {
                    var text = para.Sentences[i];

                    var sentence = new DMSentence()
                    {
                        Index = index
                    };
                    sentence.Initialize(text);
                    paragraph.Inlines.Add(sentence);
                    paragraph.Inlines.Add(new Run(" "));

                    index += 1;
                }
                doc.Blocks.Add(paragraph);
            }

            doc.Save(localEpisode.SyncDocumentFilePath);
            localEpisode.ReloadSyncDocument();
        }
示例#2
0
        private void ProcessSentence(string cmd, DMSentence selectedSentence)
        {
            var paragraph   = selectedSentence.Paragraph;
            var newSentence = new DMSentence();

            newSentence.Initialize("(New Sentences)");

            switch (cmd)
            {
            case "Before":
                newSentence.BeginTime = selectedSentence.BeginTime;
                newSentence.EndTime   = selectedSentence.BeginTime;
                //this.Document.Insert(this.list_LyricsSentence.SelectedIndex, newLP);
                paragraph.Inlines.InsertBefore(selectedSentence, newSentence);
                break;

            case "Behind":
                newSentence.BeginTime = selectedSentence.EndTime;
                newSentence.EndTime   = selectedSentence.EndTime;
                //this.SentencePhrases.Insert(this.list_LyricsSentence.SelectedIndex + 1, newLP);
                paragraph.Inlines.InsertAfter(selectedSentence, newSentence);
                break;

            case "Delete":
                //this.SentencePhrases.RemoveAt(this.list_LyricsSentence.SelectedIndex);
                paragraph.Inlines.Remove(selectedSentence);
                break;
            }
        }
示例#3
0
        private static DMDocument BuildDocument(Core.Lyrics lrc)
        {
            var doc   = new DMDocument();
            var para  = new DMParagraph();
            var index = 0;

            foreach (var phrase in lrc.Phrases)
            {
                var sentence = new DMSentence(index)
                {
                    BeginTime = phrase.BeginTime,
                    EndTime   = phrase.EndTime,
                };
                sentence.Initialize(lrc.Transcript);

                para.Inlines.Add(sentence);

                index += 1;
            }
            doc.Blocks.Add(para);
            return(doc);
        }