dapplo / Dapplo.CaliburnMicro

Dapplo.CaliburnMicro is a Caliburn bootstrapper (and more) to quickly start with a WPF MVVM Application
GNU Lesser General Public License v3.0
21 stars 7 forks source link

Dapplo.CaliburnMicro

This will help you to get started with bootstrapping Caliburn.Micro (and MahApps or NotifyIcon WPF)

This project is a combination of multiple Dapplo libraries, and brings roughly:

Available Packages:

Quick-start documentation

A demo-project is supplied, see: Application.Demo, or Application.Demo.ClickOnce

Dapplo.CaliburnMicro

A Caliburn.Micro support project, with Dapplo.CaliburnMicro.Dapp taking care of bootstrapping Caliburn.Micro with Dapplo.Addons, which takes care of initializing Autofac and o.a. your IShell ViewModel

There is functionality available to support you with building:

Usage:

  1. Create ViewModels & Views for Caliburn.Micro, make sure you register your viewmodels in an AddonModule (Dapplo.Addon) to Autofac.

  2. Implement and register an IShell if you want to have a default "Window" to be opened

  3. Create a Dapplication

    // Configure your application
    var applicationConfig = ApplicationConfigBuilder
    .Create()
    // Used for logging, configuration, and thread names
    .WithApplicationName("application name")
    // Used to prevent multiple instances
    .WithMutex("<your GUID>")
    // Enable the Dapplo.CalliburnMicro libraries
    .WithCaliburnMicro()
    // Add directories to scan for dlls
    .WithScanDirectories("... directory ...")
    // Scan for all the assemblies, in the exe directory or specified scan directories, called Greenshot.Addon.*.dll
    .WithAssemblyPatterns("Greenshot.Addon*")
    .BuildApplicationConfig();

    var application = new Dapplication(applicationConfig)
    {
        ShutdownMode = ShutdownMode.OnExplicitShutdown
    };
  1. Check is the application was already running
    if (application.WasAlreadyRunning)
    {
        // Show message / exit
    }
  1. Run
            application.Run();

Dapplo.CaliburnMicro.NotifyIconWpf

This is based on a Hardcodet.Wpf.TaskbarNotification dependency, and supplies code to a have ViewModel first approach for a System-Tray icon

Usage:

Dapplo.CaliburnMicro.Metro

This is based on a MahApps.Metro dependency, and supplies a IWindowManager implementation which makes things look like "metro" apps.

Note: Dialog boxes are not yet tested or supported... I might need to have a look at this: https://dragablz.net/2015/05/29/using-mahapps-dialog-boxes-in-a-mvvm-setup/

General TODO: Add better error support