Exemple #1
0
 string ITextEditor.GetContent(Document doc)
 {
     if (doc == App.Document())
     {
         return(sci.GetTextUnicode());
     }
     else
     {
         using (var sciTemp = new BasicScintillaControl())
         {
             sciTemp.AttachDocument(((TextDocument)doc).GetSciDocument());
             return(sciTemp.GetTextUnicode());
         }
     }
 }
Exemple #2
0
        private void InternalCompile(object obj)
        {
            var doc = (CodeDocument)obj;
            var src = String.Empty;

            sci.Invoke(() =>
            {
                using (var sciTemp = new BasicScintillaControl())
                {
                    sciTemp.AttachDocument(doc.GetSciDocument());
                    src = sciTemp.GetTextUnicode();
                }
            });

            if (!String.IsNullOrWhiteSpace(src))
            {
                var ret = default(Tuple <ICompiledUnit, IEnumerable <MessageItem> >);

                try
                {
                    ret = compiler.Compile(doc, src);
                }
                catch { }

                if (ret != null)
                {
                    doc.Unit = ret.Item1;

                    if (service.HighlightErrors)
                    {
                        doc.Messages = ret.Item2;
                        sci.Invoke(() => app.GetService <IOutlinerService>().Outline(doc));
                    }
                    else
                    {
                        doc.Messages = null;
                    }

                    doc.UnitVersion = doc.Version;
                }
            }

            Thread.Sleep(1000);
            thread = null;
        }
        private void InternalCompile(object obj)
        {
            var doc = (CodeDocument)obj;
            var src = String.Empty;

            sci.Invoke(() =>
            {
                using (var sciTemp = new BasicScintillaControl())
                {
                    sciTemp.AttachDocument(doc.GetSciDocument());
                    src = sciTemp.GetTextUnicode();
                }
            });

            if (!String.IsNullOrWhiteSpace(src))
            {
                var ret = default(Tuple<ICompiledUnit, IEnumerable<MessageItem>>);

                try
                {
                    ret = compiler.Compile(doc, src);
                }
                catch { }

                if (ret != null)
                {
                    doc.Unit = ret.Item1;

                    if (service.HighlightErrors)
                    {
                        doc.Messages = ret.Item2;
                        sci.Invoke(() => app.GetService<IOutlinerService>().Outline(doc));
                    }
                    else
                        doc.Messages = null;

                    doc.UnitVersion = doc.Version;
                }
            }

            Thread.Sleep(1000);
            thread = null;
        }