Giter Site home page Giter Site logo

csuffyy / dapplo.caliburnmicro Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dapplo/dapplo.caliburnmicro

0.0 1.0 0.0 2.64 MB

Dapplo.CaliburnMicro is a Caliburn bootstrapper (and more) to quickly start with a WPF MVVM Application

License: GNU Lesser General Public License v3.0

C# 100.00%

dapplo.caliburnmicro's Introduction

Dapplo.CaliburnMicro

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

  • Documentation can be found here (soon)
  • Current build status: Build status
  • Coverage Status: Coverage Status
  • NuGet package Dapplo.CaliburnMicro: NuGet package
  • NuGet package Dapplo.CaliburnMicro.Dapp: NuGet package
  • NuGet package Dapplo.CaliburnMicro.Configuration: NuGet package
  • NuGet package Dapplo.CaliburnMicro.Translation: NuGet package
  • NuGet package Dapplo.CaliburnMicro.Security: NuGet package
  • NuGet package Dapplo.CaliburnMicro.Security.ActiveDirectory: NuGet package
  • NuGet package Dapplo.CaliburnMicro.ClickOnce: NuGet package
  • NuGet package Dapplo.CaliburnMicro.Wizard: NuGet package
  • NuGet package Dapplo.CaliburnMicro.NotifyIconWpf: NuGet package

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

  • A bootstrapper for Caliburn.Micro with Autofac
  • addons to your application, via Dapplo.Addons. Use MVVM via composition (e.g. you can make a context menu and have the items provided by addons)
  • configuration & translations based on interfaces via Dapplo.Config
  • Some UI components like System-tray icon, menus, wizard are provided with a MVVM first approach.
  • Automatically style your Views via MahApps (if there is a reference to the Dapplo.CaliburnMicro.Metro.dll this will be used automatically)

Available Packages:

  • Dapplo.CaliburnMicro, Caliburn.Micro Bootstrapper for Dapplo.Addons which takes care of initializing Autofac and o.a. your IShell ViewModel
  • Dapplo.CaliburnMicro.Dapp, adds a replacement for Application which helps to bootstrap
  • Dapplo.CaliburnMicro.Configuration, adds a MVVM configuration component and automatic Dapplo.Ini importing
  • Dapplo.CaliburnMicro.Translation, adds automatic Dapplo.Language importing
  • Dapplo.CaliburnMicro.Security, adds security to your UI
  • Dapplo.CaliburnMicro.Security.ActiveDirectory, adds AD-Role based permissions to your UI
  • Dapplo.CaliburnMicro.Wizard, adds a MVVM wizard component
  • Dapplo.CaliburnMicro.Menu, adds a MVVM menu component
  • Dapplo.CaliburnMicro.Toasts, adds a MVVM toasts
  • Dapplo.CaliburnMicro.Cards, adds a MVVM adaptive card implementation
  • Dapplo.CaliburnMicro.Metro, contains a MetroWindowManager to make it work with MahApps
  • Dapplo.CaliburnMicro.NotifyIconWpf, adds functionality to display a system tray icon ViewModel first, via Hardcodet.NotifyIcon.Wpf
  • Dapplo.CaliburnMicro.ClickOnce, adds ClickOnce supporting functionality to simplify your

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:

  • Simplified binding of properties
  • Some build in behaviors, like Visibility, IsEnabled and authentication behaviors which hide/disable elements depending on a value.
  • Dapplo.CaliburnMicro.Configuration a structured configuration, with a tree where you can hang your "config screens"
  • Dapplo.CaliburnMicro.Menu Context menus (with tree support)
  • Dapplo.CaliburnMicro.Translations to support translations
  • Dapplo.CaliburnMicro.Wizard a simple wizard component
  • Dapplo.CaliburnMicro.Security add security behaviour (enables / visible) depending on rights

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:

  • Annotate your ViewModel class with the ExportAttribute, give it the typeof(ITrayIconViewModel) parameter. This make sure it's found and instanciated, you can set the initial visibility (as expected) in the view.
  • Make your ViewModel extend the TrayIconViewModel, this forces you to implement the IViewAware from Caliburn.Micro but this can be done by extending e.g. Screen or ViewAware.
  • Create a View with a TrayIcon, you don't NEED code behind, e.g. <ni:TrayIcon xmlns:ni="clr-namespace:Dapplo.CaliburnMicro.NotifyIconWpf;assembly=Dapplo.CaliburnMicro.NotifyIconWpf" />
  • TrayIcon extends TaskbarIcon (from Hardcodet.Wpf.TaskbarNotification) and only adds an interface and a minimal implementation. This allows you to use it exactly like the documentation of Hardcodet.Wpf.TaskbarNotification describes. Also due to the way things are wired, all Caliburn.Micro logic works as designed (even cal:Message.Attach="[Event TrayLeftMouseDown] = [Action xxxx]")
  • ToolTipText -> The IHasDisplayName interface forces the DisplayName property, this is automatically bound to the ToolTipText

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

dapplo.caliburnmicro's People

Contributors

lakritzator avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.