]> O.S.I.I.S - jp/crow.git/commitdiff
basic moving and selecting with SourceText as backend buffer, basic highlighting...
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 18 Feb 2020 15:52:31 +0000 (16:52 +0100)
committerj-p <jp_bruyere@hotmail.com>
Sat, 9 May 2020 22:50:02 +0000 (00:50 +0200)
Crow/src/Widgets/Border.cs
Crow/src/Widgets/PrivateContainer.cs
Crow/src/Widgets/TabView.cs
Samples/BasicTests/BasicTests.cs
Samples/HelloWorld/HelloWorld.csproj
Samples/HelloWorld/ILView.cs
Samples/HelloWorld/main.cs
Samples/HelloWorld/ui/helloworld.crow

index e5a16ec8949b3758fc0c3237ea1f1149d47b4652..b3c7203000d14f29ea388bc47a9c8dfaac896a52 100644 (file)
@@ -156,7 +156,7 @@ namespace Crow
 
                        if (BorderStyle == BorderStyle.Normal) {
                                if (BorderWidth > 0) {
-                                       Foreground.SetAsSource (gr, rBack);
+                                       Foreground?.SetAsSource (gr, rBack);
                                        CairoHelpers.CairoRectangle (gr, rBack, CornerRadius, BorderWidth);
                                }
                        } else {
index fc5cb34832203470a140d01d7317b84c13931e97..351ea2027049b4f11bf22600a289054cdcc6e781 100644 (file)
@@ -177,8 +177,6 @@ namespace Crow
                protected override void UpdateCache (Context ctx)
                {
                        Rectangle rb = Slot + Parent.ClientRectangle.Position;
-
-
                        Context gr = new Context (bmp);
 
                        if (!Clipping.IsEmpty) {
index 057afa4160cc3f589ed3b738fc891056d537457c..d93014ce36834cdc28c1ce8996439fb936949d14 100644 (file)
@@ -258,8 +258,6 @@ namespace Crow
                        if (SelectedTab < tabItms.Length && SelectedTab >= 0)
                                selTabViewIdx = (Children [SelectedTab] as TabItem).ViewIndex;
 
-                       childrenRWLock.ExitReadLock ();
-
                        int i = 0;
                        while (i < selTabViewIdx) {
                                tabItms [i].Paint (ref gr);
@@ -273,7 +271,9 @@ namespace Crow
 
                        if (selTabViewIdx >= 0)
                                tabItms [selTabViewIdx].Paint (ref gr);
-               
+
+                       childrenRWLock.ExitReadLock ();
+
                        gr.Restore ();
                }
 
index 54bb82158436391368a0d66e8770250f2e13f7fb..cc2285d6a1d055f4791e6917b33ed44d595cf397 100644 (file)
@@ -30,9 +30,9 @@ namespace tests
 
                        //testFiles = new string [] { @"Interfaces/Experimental/testDock.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
-                       testFiles = new string [] { @"Interfaces/TemplatedGroup/3.crow" };
+                       //testFiles = new string [] { @"Interfaces/TemplatedGroup/3.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/perfMeasures.crow" };
-                       //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
+                       testFiles = new string [] { @"Interfaces/Divers/colorPicker2.crow" };
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
index 908af2fc64cd8ec414bfb52b93e0b3f892ab3846..7d3574d06b69921d7ab2c9534a79e5c2de34a5aa 100644 (file)
       <LogicalName>HelloWorld.%(Filename)%(Extension)</LogicalName>
     </EmbeddedResource>                
   </ItemGroup>
-  <ItemGroup>
-    <PackageReference Include="Mono.Cecil" Version="0.11.1" />
+  <ItemGroup>    
+    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.4.0" />
+<!--           <PackageReference Include="Microsoft.CodeAnalysis.Features" Version="3.4.0" />-->
+    <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.4.0" />
+    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.4.0" />
+               <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="3.4.0" />
   </ItemGroup>
+       
+  <ItemGroup>    
+               <PackageReference Include="SQLitePCLRaw.core" Version="2.0.2" />
+               <PackageReference Include="System.Memory" Version="4.5.3" />
+  </ItemGroup> 
+       
+       <ItemGroup>
+         <PackageReference Include="Microsoft.Build" Version="16.4.0">
+                       <IncludeAssets>compile</IncludeAssets>
+               </PackageReference>
+         <PackageReference Include="Microsoft.Build.Framework" Version="16.4.0">
+                       <IncludeAssets>compile</IncludeAssets>
+               </PackageReference>
+         <PackageReference Include="Microsoft.Build.Tasks.Core" Version="16.4.0">
+                       <IncludeAssets>compile</IncludeAssets>
+               </PackageReference>
+         <PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.4.0">
+                       <IncludeAssets>compile</IncludeAssets>
+               </PackageReference>
+       </ItemGroup>
 </Project>
index 9bac22991a6c787a8addf56a6d4096daab275d81..cb974801310800ae67c0e4d8db3a0e94dd817496 100644 (file)
@@ -1,15 +1,35 @@
-// Copyright (c) 2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+/* Copyright (c) 2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+ *
+ * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+ */
+
 using System;
 using Crow;
 
+namespace test {
+       public class TestClass {
+               int a = 0;
+       }
+}
+
 namespace HelloWorld
 {
        public class ILView : Widget
        {
+               readonly int a;
+               #region CTOR
                public ILView ()
                {
+                       a = 10;
                }
+               #endregion
+               void test ()
+               {
+#if DEBUG
+Console.WriteLine ("debug" + a.ToString());
+
+#endif
+               }
+
        }
 }
index c407b04e6cf0488e7bd4a1276d337777e3d94946..75a2683b575c698b76ddee9b83bac3b193a96ba1 100644 (file)
 using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.Composition;
+using System.IO;
 using System.Linq;
 using System.Reflection;
 using System.Reflection.Emit;
+using System.Threading.Tasks;
 using Crow;
 using Crow.IML;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Completion;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Emit;
+using Microsoft.CodeAnalysis.Host.Mef;
+using Microsoft.CodeAnalysis.MSBuild;
+using Microsoft.CodeAnalysis.Text;
 
-namespace HelloWorld
+/*namespace RoslynVarRewrite
 {
-       class Program : Interface {
-               Command CMDQuit;
-               static void Main (string[] args) {
-                       using (Program vke = new Program ()) {
-                               vke.Run ();
-                       }
+       public class VarRewriter : CSharpSyntaxRewriter
+       {
+               private readonly SemanticModel model;
+
+               public VarRewriter (SemanticModel model)
+               {
+                       this.model = model;
                }
-               
-               protected override void Startup ()
+
+               public override SyntaxNode VisitLocalDeclarationStatement (LocalDeclarationStatementSyntax node)
                {
-                       CMDQuit = new Command (new Action (() => running = false)) { Caption = "Quit", Icon = new SvgPicture ("#Crow.Icons.exit-symbol.svg") };
+                       var symbolInfo = model.GetSymbolInfo (node.Declaration.Type);
+                       var typeSymbol = symbolInfo.Symbol;
+                       var type = typeSymbol.ToDisplayString (
+                         SymbolDisplayFormat.MinimallyQualifiedFormat);
 
-                       Widget w = Load ("#HelloWorld.helloworld.crow");
-                       w.KeyPress += W_KeyPress;
-                       w.DataSource = this;
+                       var declaration = SyntaxFactory
+                               .LocalDeclarationStatement (
+                                       SyntaxFactory
+                                               .VariableDeclaration (SyntaxFactory.IdentifierName (
+                                                 SyntaxFactory.Identifier (type)))
+                                                       .WithVariables (node.Declaration.Variables)
+                                                       .NormalizeWhitespace ()
+                                       )
+                                       .WithTriviaFrom (node);
+                       return declaration;
                }
+       }
 
-               public SolidColor testColor = Color.Red;
-               public SolidColor TestColor {
-                       get => testColor;
-                       set {
-                               if (testColor == value)
-                                       return;
-                               testColor = value;
-                               NotifyValueChanged ("TestColor", testColor);
-                       }
+       class Program
+       {
+               static void Main (string [] args)
+               {
+                       var tree = CSharpSyntaxTree.ParseText (@"
+using System;
+using System.Collections.Generic;
+class Program {
+  static void Main(string[] args) {
+    var x = 5;
+    var s = ""Test string"";
+    var l = new List<string>();
+    var scores = new byte[8][]; // Test comment
+    var names = new string[3] {""Diego"", ""Dani"", ""Seba""};
+  }
+}");
+
+                       // Get the assembly file, the compilation and the semantic model
+                       var Mscorlib = MetadataReference.CreateFromFile (typeof (object).Assembly.Location);
+                       var compilation = CSharpCompilation.Create ("RoslynVarRewrite",
+                         syntaxTrees: new [] { tree },
+                         references: new [] { Mscorlib });
+                       var model = compilation.GetSemanticModel (tree);
+
+                       var varRewriter = new VarRewriter (model);
+                       var result = varRewriter.Visit (tree.GetRoot ());
+                       Console.WriteLine (result.ToFullString ());
                }
+       }
+}*/
+namespace HelloWorld
+{
+       class Program : Interface
+       {
+               //static void Main ()
+               //{
+               //      using (Stream s = new FileStream("test.txt", FileMode.Create)) {
+               //              using (StreamWriter sw = new StreamWriter (s)) {
+               //                      foreach (SyntaxKind v in Enum.GetValues(typeof(SyntaxKind))) {
+               //                              //sw.WriteLine ($"{v,-50} = {(int)v:X8}");
+               //                              //sw.WriteLine ($"{v,-50} = {Convert.ToString ((int)v, 2).PadLeft (16, '0')}");
+               //                              sw.WriteLine ($"case SyntaxKind.{v}:");
+               //                              sw.WriteLine ($"\ttf = editor.formatting [\"default\"];");
+               //                              sw.WriteLine ($"\tbreak;");
+               //                      }
+               //              }
+               //      }
+               //}
+               //              public class CustomWalker : CSharpSyntaxWalker
+               //              {
+               //                      static int Tabs = 0;
+               //                      bool cancel;
+               //                      int visibleLines, firstLine, currentLine, printedLines;
+
+               //                      public CustomWalker (int firstLine = 0, int visibleLines = 1) : base (SyntaxWalkerDepth.StructuredTrivia)
+               //                      {
+               //                              this.visibleLines = visibleLines;
+               //                              this.firstLine = firstLine;
+               //                              currentLine = 0;
+               //                              printedLines = (firstLine == 0) ? 0 : - 1;//<0 until firstLine is reached
+
+               //                      }
+               //                      public override void DefaultVisit (SyntaxNode node)
+               //                      {
+               //                              if (!cancel)
+               //                                      base.DefaultVisit (node);
+               //                      }
+               //                      public override void Visit (SyntaxNode node)
+               //                      {
+               //                              if (cancel)
+               //                                      return;
 
-               Color [] colors = { Color.Blue, Color.DarkGoldenRod, Color.Red, Color.Azure, Color.Brown, Color.Black, Color.White, Color.Pink };
-               int ptr = 0;
+               //                              FileLinePositionSpan ls = node.SyntaxTree.GetLineSpan(node.FullSpan);
+               //                              currentLine = ls.StartLinePosition.Line;
+               //                              if (ls.EndLinePosition.Line >= firstLine)
+               //                                      base.Visit (node);
+               //                      }
+               //                      public override void VisitToken (SyntaxToken token)
+               //                      {
+               //                              if (cancel)
+               //                                      return;
 
-               void W_KeyPress (object sender, KeyPressEventArgs e)
+               //                              if ((int)Depth >= 2) {
+               //                                      Console.ForegroundColor = ConsoleColor.Blue;
+               //                                      VisitLeadingTrivia (token);
+               //                                      if (cancel)
+               //                                              return;
+               //                                      if (printedLines >= 0) {
+               //                                              Console.ForegroundColor = ConsoleColor.White;
+               //                                              Console.Write ($"{(token.RawKind)}{token.ToString ()}");
+               //                                      }
+               //                                      Console.ForegroundColor = ConsoleColor.Green;
+               //                                      VisitTrailingTrivia (token);
+               //                              }
+               //                      }
+
+               //                      bool print => printedLines >= 0 && printedLines < visibleLines;
+
+               //                      //public override void VisitLeadingTrivia (SyntaxToken token)
+               //                      //{
+               //                      //      leadingTrivia = true;
+               //                      //      base.VisitLeadingTrivia (token);
+               //                      //}
+               //                      //public override void VisitTrailingTrivia (SyntaxToken token)
+               //                      //{
+               //                      //      if (cancel)
+               //                      //              return;
+               //                      //      leadingTrivia = false;
+               //                      //      base.VisitTrailingTrivia (token);
+               //                      //}
+               //                      //bool leadingTrivia;
+               //                      public override void VisitTrivia (SyntaxTrivia trivia)
+               //                      {
+
+               //                              if (cancel)
+               //                                      return;
+
+               //                              base.VisitTrivia (trivia);
+
+               //                              if (print) {
+               //                                      if (trivia.IsKind (SyntaxKind.EndOfLineTrivia)) {
+               //                                              Console.Write ($"(eof)");
+               //                                              printedLines++;
+               //                                              cancel = printedLines == visibleLines;
+               //                                      }
+               //                                      Console.Write ($"{trivia.ToString ()}");
+               //                              }
+
+               //                              if (trivia.IsKind (SyntaxKind.EndOfLineTrivia)) {
+               //                                      currentLine++;
+               //                                      if (printedLines < 0) {
+               //                                              if (currentLine == firstLine)
+               //                                                      printedLines = 0;
+               //                                      }
+               //                              }
+
+               //                      }
+               //              }
+
+               //              static void Main (string [] args)
+               //              {
+               //                      var tree = CSharpSyntaxTree.ParseText (@"// Copyright (c) 2013-2019  Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+               ////
+               //// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+               //using System;
+               //using System.IO;
+
+               //public class MyClass
+               //{
+               //      //this is a leading trivia
+               //      public void MyMethod()
+               //      {
+               //              int a = 10;
+               //#if DEBUG
+               //              int b = a + 10;
+               //#endif
+               //      }
+               ///* this is a block comment
+               //*/
+               //      public void MyMethod(int n)
+               //      {
+               //      }
+               //}");
+
+               //      var walker = new CustomWalker (4,5);
+               //      walker.Visit (tree.GetRoot ());
+               //}
+
+               //Command CMDQuit;
+               static void Main (string [] args)
                {
-                       switch (e.KeyChar) {
-                       case 'w':
-                               LoadIMLFragment ($"<DockWindow Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>");
-                               break;
-                       case 'x':
-                               LoadIMLFragment ($"<Window Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>");
-                               break;
+                       Environment.SetEnvironmentVariable ("MSBUILD_EXE_PATH", Path.Combine (msbuildRoot, "MSBuild.dll"));
+                       Environment.SetEnvironmentVariable ("MSBUILD_NUGET_PATH", "/home/jp/.nuget/packages");
+                       Environment.SetEnvironmentVariable ("COREHOST_TRACE", "1");
+
+                       AppDomain currentDomain = AppDomain.CurrentDomain;
+                       currentDomain.AssemblyResolve += msbuildAssembliesResolve;
+
+                       using (Program vke = new Program ()) {
+                               vke.Run ();
                        }
+               }
+
+               //const string msbuildRoot = "/usr/lib/mono/msbuild/Current/bin/";
+               const string msbuildRoot = "/usr/share/dotnet/sdk/3.1.101/";
+               const string toolsVersion = "Current";
 
-                       ptr++;
-                       if (ptr == colors.Length)
-                               ptr = 0;
+               static Assembly msbuildAssembliesResolve (object sender, ResolveEventArgs args)
+               {
+                       string assemblyPath = Path.Combine (msbuildRoot, new AssemblyName (args.Name).Name + ".dll");
+                       /*Console.BackgroundColor = ConsoleColor.DarkBlue;
+                       Console.ForegroundColor = ConsoleColor.White;
+                       Console.WriteLine ($"Probing: {assemblyPath}");
+                       Console.ResetColor ();*/
+                       if (!File.Exists (assemblyPath)) return null;
+                       Assembly assembly = Assembly.LoadFrom (assemblyPath);
+                       return assembly;
                }
+
+               //protected override void Startup ()
+               //{
+               //      CMDQuit = new Command (new Action (() => running = false)) { Caption = "Quit", Icon = new SvgPicture ("#Crow.Icons.exit-symbol.svg") };
+
+               //      Widget w = Load ("#HelloWorld.helloworld.crow");
+               //      w.DataSource = this;
+               //}
+
+               //public string source = @"
+               //  using System;
+
+               //  namespace RoslynCompileSample
+               //  {
+               //      public class Writer
+               //      {
+               //          public void Write(string message)
+               //          {
+               //              Console.WriteLine(message);
+               //          }
+               //      }
+               //  }";
+               //public string Source {
+               //      get => source;
+               //      set {
+               //              if (source == value)
+               //                      return;
+               //              source = value;
+               //              NotifyValueChanged ("Source", source);
+               //      }
+               //}
+
+
+
                public override bool OnKeyDown (Key key)
                {
                        switch (key) {
-                       case Key.d:
-                               dump ();
-                               break;
-                       case Key.space:
-                               TestColor = Color.Green;
+                       //case Key.F2:
+                       //compile ();
+                       //break;
+                       case Key.F3:
+                               Task t = new Task (testWS);
+                               t.Start ();
                                break;
                        default:
                                return base.OnKeyDown (key);
@@ -68,33 +298,135 @@ namespace HelloWorld
                        return true;
                }
 
-               void dump ()
+               //void printChild (IndentedTextWriter stream, CSharpSyntaxNode n)
+               //{
+               //      stream.WriteLine ($"{n.Kind()} {n.ToString()}");
+               //      stream.Indent++;
+               //      foreach (CSharpSyntaxNode item in n.ChildNodes()) {
+               //              printChild (stream, item);
+               //      }
+               //      stream.Indent--;
+               //}
+               string slnPath = "/mnt/devel/glfw-sharp/glfw-sharp.sln";
+               async void testWS ()
                {
-                       Instantiator inst = Instantiators ["#HelloWorld.helloworld.crow"];
+                       if (!File.Exists (slnPath)) {
+                               Console.WriteLine ($"File not found: {slnPath}");
+                               return;
+                       }
+                       Dictionary<String, String> globalProperties = new Dictionary<String, String> ();
 
-                       foreach (Delegate cd in inst.CachedDelegates) {
-                               FieldInfo mb = typeof(Delegate).GetField("original_method_info", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
+                       Console.WriteLine ("starting Compilation.");
 
-                               DynamicMethod dynMethod = mb.GetValue (cd) as DynamicMethod;
-                               /*Console.WriteLine (typeof (ILGenerator).GetFields (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField));
+                       //globalProperties ["NuGetPackageRoot"] = "/home/jp/.nuget/packages";
+                       //globalProperties ["RoslynTargetsPath"] = Path.Combine (msbuildRoot, "Roslyn/");
+                       //globalProperties ["MSBuildSDKsPath"] = Path.Combine (msbuildRoot, "Sdks/");
+                       //globalProperties ["AdditionalLibPaths"] = msbuildRoot;
+                       //globalProperties ["AssemblySearchPaths"] = msbuildRoot;
+                       foreach (var item in MSBuildMefHostServices.DefaultAssemblies) {
+                               Console.WriteLine ($"{item.FullName}");
+                       }
+
+                       var host = MefHostServices.Create (MSBuildMefHostServices.DefaultAssemblies);
 
-                               var ilgen = dynMethod.GetILGenerator ();
-                                
+                       using (var workspace = MSBuildWorkspace.Create (globalProperties)) {
+                               //workspace. Properties["BuildingInsideVisualStudio"] = "false";
+                               workspace.WorkspaceFailed += (sender, e) => Console.WriteLine ($"Workspace error: {e.Diagnostic}");
+                               Console.WriteLine ($"Opening Solution {slnPath}");
+                               var solution = await workspace.OpenSolutionAsync (slnPath, new ProgressLog ());
+                               Console.WriteLine ($"Proj Count:{solution.Projects.Count ()}");
+                               foreach (Project project in solution.Projects) {
+                                       Console.WriteLine ($"Compiling project:{project.FilePath}");
 
+                                       Compilation compilation = await project.GetCompilationAsync ();
+                                       Document doc = project.Documents.First ();
 
-*/
+                                       CompletionService.GetService (doc);
+                                       using (var ms = new MemoryStream ()) {
+                                               EmitResult result = compilation.Emit (ms);
 
-                               MethodBody body = dynMethod.GetMethodBody ();
+                                               if (!result.Success) {
+                                                       IEnumerable<Diagnostic> failures = result.Diagnostics.Where (diagnostic =>
+                                                                diagnostic.IsWarningAsError ||
+                                                                diagnostic.Severity == DiagnosticSeverity.Error);
+
+                                                       foreach (Diagnostic diagnostic in failures) {
+                                                               Console.Error.WriteLine ("{0}: {1}", diagnostic.Id, diagnostic.GetMessage ());
+                                                       }
+                                               } else {
+                                                       Console.WriteLine ("Compilation ok.");
+                                               }
+                                       }
 
-                               byte [] il = body.GetILAsByteArray ();
-                               foreach (byte b in il) {
-                                       Console.Write ($"{b:x2} ");
-                                       //Console.WriteLine (b);
                                }
 
+                               //workspace.TryApplyChanges()
                        }
-
+                       Console.WriteLine ($"end.");
+               }
+       }
+       class ProgressLog : IProgress<ProjectLoadProgress>
+       {
+               public void Report (ProjectLoadProgress value)
+               {
+                       Console.WriteLine ($"{value.ElapsedTime} {value.Operation} {value.TargetFramework}");
                }
-
        }
+
 }
+//void compile ()
+//{
+//     string assemblyName = Path.GetRandomFileName ();
+//     MetadataReference [] references = new MetadataReference []
+//     {
+//             MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
+//             MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location)
+//     };
+//     SourceText txt = SourceText.From (source);
+
+//     SyntaxTree syntaxTree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (txt);
+//     //CSharpCompilationOptions options = new CSharpCompilationOptions ();
+//     CSharpCompilation compilation = CSharpCompilation.Create(
+//             assemblyName,
+//             syntaxTrees: new [] { syntaxTree },
+//             references: references,
+//             options: new CSharpCompilationOptions (OutputKind.DynamicallyLinkedLibrary));
+
+
+//     CSharpSyntaxNode n = (CSharpSyntaxNode)syntaxTree.GetRoot ();
+
+//     using (StringWriter sw = new StringWriter ()) {
+//             using (IndentedTextWriter itw = new IndentedTextWriter (sw))
+//                     printChild (itw, n);
+
+//             Console.Write (sw);
+//     }
+
+//     using (var ms = new MemoryStream ()) {
+//             EmitResult result = compilation.Emit (ms);
+
+//             if (!result.Success) {
+//                     IEnumerable<Diagnostic> failures = result.Diagnostics.Where (diagnostic =>
+//                              diagnostic.IsWarningAsError ||
+//                              diagnostic.Severity == DiagnosticSeverity.Error);
+
+//                     foreach (Diagnostic diagnostic in failures) {
+//                             Console.Error.WriteLine ("{0}: {1}", diagnostic.Id, diagnostic.GetMessage ());
+//                     }
+//             } else {
+//                     ms.Seek (0, SeekOrigin.Begin);
+//                     Assembly assembly = Assembly.Load (ms.ToArray ());
+//                     Type type = assembly.GetType ("RoslynCompileSample.Writer");
+//                     object obj = Activator.CreateInstance (type);
+//                     type.InvokeMember ("Write", BindingFlags.Default | BindingFlags.InvokeMethod,
+//                             null,
+//                             obj,
+//                             new object [] { "Hello World" });
+//             }
+//     }
+
+
+
+//}
+//     }
+//}
index 1bc9601f3e15e743ad4ff9aaed1ef0a4e1dfa0c5..f18e4bd87860320a8130a17be0ebd79598759d8e 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version="1.0"?>
 <VerticalStack>
-       <TextBox Text="{TestColor}"/>
-       <ColorPicker CurrentColor="{²TestColor}" />
+       <TextBox Text="{²Source}" Multiline="true" Height="50%" Width="Stretched" TextAlignment="TopLeft" />   
 </VerticalStack>
 <!--<ScrollBar Orientation="Vertical" Height="Stretched" Width="10" />-->
\ No newline at end of file