This work is heavily inspired by the Caliburn.Micro framework. Which is one of the nicest frameworks, I had ever the pleasure to use. It is also named the after the character Caliban in Shakespeare's play The Tempest (hence the projects symbol). As the writer Russell Hoban put it:
Caliban is one of the hungry ideas, he's always looking for someone to word him into being ... Caliban is a necessary idea.
Which seems very fitting.
Compose your app with loosely coupled objects that will inject by creation.
new Bootstrap().Register<IBattery, Battery>();
public IBattery? Battery { get; init; }
public class Remote
{
public Remote(IBattery battery)
{
...
}
}
Communicate between view models with event aggregating.
public class Remote
{
public Remote(IEventAggregator events)
{
events.Publish(new BatteryLowEvent());
}
}
public class Television : IHandle<BatteryLowEvent>
{
public Television(IEventAggregator events)
{
events.Subscribe<BatteryLowEvent>(this);
}
public void Handle(BatteryLowEvent event)
{
...
}
}
Apply methods and properties between your view and view model automatically and guard them.
<Button x:Name="DoSomething"/>
public bool CanDoSomething => true;
public void DoSomething()
{
...
}
<TextBox x:Name="SomeInput"/>
private string _someInput = "";
public string SomeInput
{
get => _someInput;
set => SetProperty(ref _someInput, value);
}
Decouple view models with the built in composition pattern.
<ContentControl x:Name="ActiveItem"/>
public class EditorViewModel : ViewModel.Single
{
public async Task NewTabAsync()
{
await ActivateItem(new TabViewModel());
}
}
Match your views, view models and models automatically by consistent naming alone.
public class MainView
{
...
}
public class MainViewModel
{
...
}
public class MainModel
{
...
}
Write concise code by using implicit model members.
public class SheepModel : Model
{
public int Count
{
get => Get<int>();
set => Set<int>(value);
}
}
Use registered services with the supplied service locator.
new Bootstrap().Register<ILogger>(new Logger());
var logger = IoC.Get<ILogger>();
There is also the full API Documentation available (generated by DefaultDocumentation).