Permalink
Browse files

preview border

  • Loading branch information...
1 parent d3221e9 commit 4dacfbc3c7503f9cc0a85127336fcfbc02c65dec Ian Norton committed Jul 7, 2010
View
5 XamlPreviewer/MainWindow.cs
@@ -2,20 +2,17 @@
using System.Windows.Controls;
-using System.Windows.Markup;
using Moonlight.Gtk;
public partial class MainWindow : Gtk.Window
{
- private DateTime last_change;
private string src = String.Empty;
public MainWindow () : base(Gtk.WindowType.Toplevel)
{
Build ();
- last_change = System.DateTime.Now;
xamlpanel2.ReloadXaml (TextEditor.Buffer.Text);
@@ -49,7 +46,7 @@ public void UpdatePreview ()
Console.Error.WriteLine(src);
try {
- XamlReader.Load (src);
+
xamlpanel2.ReloadXaml (src);
statusbar1.Push (0, "ok");
} catch (System.Windows.Markup.XamlParseException ex) {
View
20 XamlPreviewer/XamlPanel.cs
@@ -2,6 +2,9 @@
using System;
using Moonlight.Gtk;
+using System.Windows.Controls;
+using System.Windows.Markup;
+
namespace XamlPreviewer
{
@@ -12,6 +15,7 @@ public partial class XamlPanel : Gtk.Bin
{
public MoonlightHost MoonHost = null;
+ Border outer;
public string Xaml = null;
@@ -20,14 +24,26 @@ public XamlPanel ()
this.Build ();
MoonHost = new MoonlightHost ();
+ Border cont = new Border ();
+ cont.Margin = new System.Windows.Thickness (8.0);
+ outer = cont;
+
+ MoonHost.Content = cont;
+
this.Add (MoonHost);
this.ShowAll ();
}
public void ReloadXaml (string xaml)
{
- lock ( MoonHost ){
- MoonHost.LoadXaml (xaml);
+ lock (MoonHost) {
+ object o = XamlReader.Load (xaml);
+
+ if (o is System.Windows.UIElement ) {
+ outer.Child = (System.Windows.UIElement)o;
+ }
+
+ // MoonHost.LoadXaml (xaml);
}
}
View
12 XamlPreviewer/XamlPreviewer.csproj
@@ -32,8 +32,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="Mono.Posix" />
- <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
- <Reference Include="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="Moonlight.Gtk, Version=3.0.0.0, Culture=neutral, PublicKeyToken=976ad8f3443f9a4d" />
<Reference Include="System.Windows, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<Reference Include="System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
@@ -52,6 +50,16 @@
<Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="pango-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="pango-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="pango-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="pango-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="pango-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="pango-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
View
2 XamlPreviewer/gtk-gui/gui.stetic
@@ -7,7 +7,7 @@
<import>
<widget-library name="Moonlight.Gtk, Version=3.0.0.0, Culture=neutral, PublicKeyToken=976ad8f3443f9a4d" />
<widget-library name="gtksourceview2-sharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
- <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <widget-library name="glade-sharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<widget-library name="../bin/Debug/XamlPreviewer.exe" internal="true" />
</import>
<widget class="Gtk.Window" id="MainWindow" design-size="932 674">

0 comments on commit 4dacfbc

Please sign in to comment.