Example #1
0
        protected override bool DoInsertData(DataAction action, MarkupPointer begin, MarkupPointer end)
        {
            //might be a video
            VideoProvider provider = VideoProviderManager.FindProviderFromEmbed(DataMeister.TextData.Text);

            if (provider != null)
            {
                // HACK: drive the selection textRange to the caret so we can call generic
                // content-source routines that work off the current selection
                EditorContext.MarkupServices.CreateMarkupRange(begin, end).ToTextRange().select();
                try
                {
                    return(InsertSmartContentFromEmbed(DataMeister.TextData.Text));
                }
                catch (Exception ex)
                {
                    Trace.Fail("Unexpected exception inserting content: " + ex.ToString());
                    return(false);
                }
            }
            else //unknown embed
            {
                try
                {
                    using (new WaitCursor())
                    {
                        // insert the content
                        EditorContext.InsertHtml(begin, end, DataMeister.TextData.Text, null);
                    }

                    return(true);
                }
                catch (Exception ex)
                {
                    Trace.Fail("Unexpected exception while pasting EMBED: " + ex.ToString());
                    return(false);
                }
            }
        }
Example #2
0
        public Video GetVideo()
        {
            VideoProvider provider = VideoProviderManager.FindProviderFromUrl(_url);

            return(provider.VideoFromUrl(_url));
        }