예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoonDesk.MoonWindow"/> class.
 /// </summary>
 public MoonWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     _host = new MoonArea();
       this.Add (_host);
       this.ShowAll ();
 }
예제 #2
0
        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 ();
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoonDesk.ViewLoader"/> class.
 /// </summary>
 public ViewLoader(MoonArea mhost)
 {
     Host = mhost;
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoonDesk.MoonWindow"/> class.
 /// </summary>
 public MoonWindow() : base(Gtk.WindowType.Toplevel)
 {
     _host = new MoonArea();
     this.Add(_host);
     this.ShowAll();
 }