Permalink
Browse files

fixed up to use the newest MoonBase (single dll)

  • Loading branch information...
1 parent ffa0e08 commit 54680af056eff05066921642d08c0aceb3a03a57 @inorton committed Jul 22, 2011
@@ -42,12 +42,8 @@
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Windows.Browser, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
- <Reference Include="Mono.MoonDesk.Commands, Version=1.0.4164.14519, Culture=neutral, PublicKeyToken=5d2e4455728fa780">
- <Package>mono.moondesk.commands</Package>
- <SpecificVersion>False</SpecificVersion>
- </Reference>
- <Reference Include="Mono.MoonDesk.ViewLoader, Version=1.0.4164.14518, Culture=neutral, PublicKeyToken=5d2e4455728fa780">
- <Package>mono.moondesk.viewloader</Package>
+ <Reference Include="Mono.MoonDesk.MoonBase, Version=1.0.4165.13854, Culture=neutral, PublicKeyToken=5d2e4455728fa780">
+ <Package>mono.moondesk.moonbase</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
@@ -19,7 +19,7 @@ public class XamlPanelViewModel : ViewModelBase
value.DataContext = new Object();
}
_userContent = value;
- OnPropertyChanged("UserContent");
+ NotifyPropertyChanged("UserContent");
}
}
@@ -30,8 +30,8 @@ public class XamlPanelViewModel : ViewModelBase
}
set {
_scaleValue = value;
- OnPropertyChanged("ScaleValue");
- OnPropertyChanged("ScalePercent");
+ NotifyPropertyChanged("ScaleValue");
+ NotifyPropertyChanged("ScalePercent");
}
}
View
@@ -12,81 +12,81 @@
namespace XamlPreviewer
{
- public class MainClass
- {
- public static void Main (string[] args)
- {
- var libs = new List<Assembly>();
- var opts = new OptionSet();
+ public class MainClass
+ {
+ public static void Main (string[] args)
+ {
+ var libs = new List<Assembly> ();
+ var opts = new OptionSet ();
- opts.Add( "r=", "load extra {ASSEMBLY}",
+ opts.Add ("r=", "load extra {ASSEMBLY}",
x => {
- try {
- libs.Add( System.Reflection.Assembly.LoadFile(x) );
- } catch ( System.IO.FileNotFoundException ){
- Console.Error.WriteLine("Error: no such assembly file " + x );
- System.Environment.Exit(1);
- } catch ( Exception e ){
- Console.Error.WriteLine("Error: " + e.Message );
- System.Environment.Exit(1);
- }
- } );
-
-
- opts.Add( "help","print this message",
+ try {
+ libs.Add (System.Reflection.Assembly.LoadFile (x));
+ } catch (System.IO.FileNotFoundException) {
+ Console.Error.WriteLine ("Error: no such assembly file " + x);
+ System.Environment.Exit (1);
+ } catch (Exception e) {
+ Console.Error.WriteLine ("Error: " + e.Message);
+ System.Environment.Exit (1);
+ }
+ });
+
+
+ opts.Add ("help", "print this message",
x => {
- Console.WriteLine("Usage: xamlpreviewer [OPTIONS] [FILE.xaml]");
- Console.WriteLine();
- opts.WriteOptionDescriptions(Console.Out);
- Console.WriteLine();
- System.Environment.Exit(1);
- } );
-
- var remain = opts.Parse( args );
- string file = null;
- if ( remain.Count > 0 ) file = remain[0];
-
- Start( file, libs );
- }
-
-
- static void Start( string loadxaml, IEnumerable<Assembly> libs )
- {
- Gtk.Application.Init ();
- MoonBase.Init();
-
- foreach ( var lib in libs )
- MoonBase.Assemblies.Add( lib );
-
- var mw = new MoonArea();
- mw.Content = new System.Windows.Controls.TextBlock(){ Text = "Loading..." };
-
- MainWindow win = new MainWindow ();
- win.Title = "Xaml Source";
- win.Show ();
- win.Resize( 750, 600 );
-
- win.MoonAreaContainer.Add( mw );
-
- ViewResolver resolver = new ViewResolver( mw );
- var xp = resolver.Loader.LoadView<XamlPanelViewModel>("Views;Views/XamlPanel.xaml");
- win.XpVM = xp.ViewModel;
- mw.Content = xp.View as FrameworkElement;
-
- if ( loadxaml != null ){
- try {
- win.LoadFile( loadxaml );
- } catch ( Exception e ) {
- xp.ViewModel.UserContent = new System.Windows.Controls.TextBlock()
- { Text = String.Format("Error\n\n{0}", e.Message ),
- Padding = new System.Windows.Thickness(10.0),
- FontStyle = System.Windows.FontStyles.Italic };
+ Console.WriteLine ("Usage: xamlpreviewer [OPTIONS] [FILE.xaml]");
+ Console.WriteLine ();
+ opts.WriteOptionDescriptions (Console.Out);
+ Console.WriteLine ();
+ System.Environment.Exit (1);
+ });
+
+ var remain = opts.Parse (args);
+ string file = null;
+ if (remain.Count > 0)
+ file = remain [0];
+
+ Start (file, libs);
}
- }
-
- Gtk.Application.Run ();
- }
- }
+ static void Start (string loadxaml, IEnumerable<Assembly> libs)
+ {
+ Gtk.Application.Init ();
+ MoonBase.Init ();
+
+ foreach (var lib in libs)
+ MoonBase.Assemblies.Add (lib);
+
+ var mw = new MoonArea ();
+ mw.Content = new System.Windows.Controls.TextBlock (){ Text = "Loading..." };
+
+ MainWindow win = new MainWindow ();
+ win.Title = "Xaml Source";
+ win.Show ();
+ win.Resize (750, 600);
+
+ win.MoonAreaContainer.Add (mw);
+
+ var loader = new ViewLoader (mw);
+ var xp = loader.LoadViewViewModel<XamlPanelViewModel> ("Views;component/Views/XamlPanel.xaml");
+ mw.Content = xp.View;
+ win.XpVM = (XamlPanelViewModel)xp.ViewModel;
+
+ if (loadxaml != null) {
+ try {
+ win.LoadFile (loadxaml);
+ } catch (Exception e) {
+ ((XamlPanelViewModel)xp.ViewModel).UserContent
+ = new System.Windows.Controls.TextBlock ()
+ {
+ Text = String.Format("Error\n\n{0}", e.Message ),
+ Padding = new System.Windows.Thickness(10.0),
+ FontStyle = System.Windows.FontStyles.Italic };
+ }
+ }
+ Gtk.Application.Run ();
+ }
+ }
}
Oops, something went wrong.

0 comments on commit 54680af

Please sign in to comment.