Last active
December 10, 2015 09:30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using Cirrious.MvvmCross.ExtensionMethods; | |
using Cirrious.MvvmCross.Interfaces.ServiceProvider; | |
using Cirrious.MvvmCross.Interfaces.ViewModels; | |
namespace Casino.UI.Wpf | |
{ | |
public partial class App | |
: Application | |
, IMvxServiceConsumer | |
{ | |
protected override void OnStartup(StartupEventArgs e) | |
{ | |
base.OnStartup(e); | |
var start = this.GetService<IMvxStartNavigation>(); | |
start.Start(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="Casino.UI.Wpf.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="350" Width="525"> | |
<Grid x:Name="TheGrid"> | |
</Grid> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
namespace Casino.UI.Wpf | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
public void Present(FrameworkElement toShow) | |
{ | |
TheGrid.Children.Clear(); | |
TheGrid.Children.Add(toShow); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Casino.UI.Wpf | |
{ | |
public class Program | |
{ | |
[STAThread] | |
public static void Main() | |
{ | |
var app = new App(); | |
var ourWindow = new MainWindow(); | |
var presenter = new SimplePresenter(ourWindow); | |
var setup = new Setup(app.Dispatcher, presenter); | |
setup.Initialize(); | |
app.MainWindow.Show(); | |
app.Run(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows.Threading; | |
using Cirrious.MvvmCross.Application; | |
using Cirrious.MvvmCross.Wpf.Interfaces; | |
using Cirrious.MvvmCross.Wpf.Platform; | |
namespace Casino.UI.Wpf | |
{ | |
public class Setup | |
: MvxBaseWpfSetup | |
{ | |
public Setup(Dispatcher dispatcher, IMvxWpfViewPresenter presenter) | |
: base(dispatcher, presenter) | |
{ | |
} | |
protected override MvxApplication CreateApp() | |
{ | |
return new Core.App(); | |
} | |
protected override void InitializeDefaultTextSerializer() | |
{ | |
Cirrious.MvvmCross.Plugins.Json.PluginLoader.Instance.EnsureLoaded(true); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using Cirrious.MvvmCross.Wpf.Views; | |
namespace Casino.UI.Wpf | |
{ | |
public class SimplePresenter : MvxWpfViewPresenter | |
{ | |
private readonly MainWindow _mainWindow; | |
public SimplePresenter(MainWindow mainWindow) | |
{ | |
_mainWindow = mainWindow; | |
} | |
public override void Present(FrameworkElement frameworkElement) | |
{ | |
_mainWindow.Present(frameworkElement); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment