PowerShell | Install-Package IdeaBlade.Cocktail -ProjectName HelloWorld.SL |
PowerShell | Install-Package IdeaBlade.DevForce.Server -ProjectName HelloWorld.SL.Web |
C# | using System.ComponentModel.Composition; using System.Threading.Tasks; using Cocktail; namespace HelloWorld.SL { [Export] public class MainViewModel { private readonly IDialogManager _dialogManager; [ImportingConstructor] public MainViewModel(IDialogManager dialogManager) { _dialogManager = dialogManager; } public async Task SayHello() { await _dialogManager.ShowMessageAsync("Hello World!", DialogButtons.Ok); } } } |
XAML | <UserControl x:Class="HelloWorld.SL.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid> <Button Content="Say Hello" x:Name="SayHello" /> </Grid> </UserControl> |
C# | using Cocktail; namespace HelloWorld.SL { public class AppBootstrapper : CocktailMefBootstrapper<MainViewModel> { } } |
XAML | <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:HelloWorld.SL" x:Class="HelloWorld.SL.App" > <Application.Resources> <local:AppBootstrapper x:Name="bootstrapper" /> </Application.Resources> </Application> |
C# | using System.Windows; namespace HelloWorld.SL { public partial class App : Application { public App() { InitializeComponent(); } } } |