1 Star 0 Fork 0

泡泡时空 / Caliburn.MahApps.Metro.Template

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Caliburn.Micro and MahApps.Metro project template

Project template for Caliburn.Micro WPF application using MahApps.Metro windows.

What it uses

  • Caliburn.Micro is the chosen MVVM framework, to bind your ViewModels to your Views. If you're not already using MVVM, use it.
  • MahApps.Metro provides a quick and easy way to get a nice-looking application from the start.
  • MahApps.Metro.SimpleChildWindow (referenced but not used) will help you create nice-looking modal popups.
  • IPropertyChanged notifications are implemented using Fody.PropertyChanged. Just use using PropertyChanged; and add the [ImplementPropertyChanged] attribute to your ViewModel classes.
  • NLog takes care of logging purposes; see App.xaml.cs for a sample usage using Caliburn.Micro.Logging.

How to install

  1. Run the generate.bat file. It will generate the Visual Studio template using the latest sources.
  2. Restart Visual Studio.

The template is now located in new project > Visual C#. You might need to enable Nuget package restore by right clicking on the solution file and selecting Enable NuGet Package Restore.

Alternatively, you can use Visual Studio to generate the template :

  • Open the CaliburnTemplate solution and make it so it can be built properly.
  • Export the project as a template by following the steps under File > Export template. Choose "project template" and the project CaliburnTemplate, add a name/description/symbol to it and check the Import template into Visual Studio option.

Logging

The sample logging is using the Caliburn.Micro logging facade, with the Caliburn.Micro.Logging.NLog nuget package. In the App.xaml.cs static constructor, the C.M logging is initialized by setting the LogManager GetLog delegate.

By default, when you're using the C.M logging facade to log, it logs every single C.M debug message. You might not want that. The provided nlog config file ignores the C.M messages (check the rules pointing to the nil logger). If you need the C.M debug messages, just comment out those lines.

If this configuration is not to your liking, either use another Caliburn logging nuget package, or create a new one. A sample is provided in the Caliburn.Micro.Logging folder.

How it works

  • A bootstrapper is registered in the App.xaml resources
  • This bootstrapper then loads the MasterViewModel and the AppWindowManager through IoC
  • The AppWindowManager instantiates either the BaseWindow or the BaseDialogWindow, which use MahApps.Metro
  • The MasterViewModel is a Caliburn Conductor, which means it only "wires" the screens together. By default, it loads the MainViewModel.
The MIT License (MIT) Copyright (c) 2015 Thomas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Template project for Caliburn.Micro WPF application 展开 收起
C# 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/lanicon/Caliburn.MahApps.Metro.Template.git
git@gitee.com:lanicon/Caliburn.MahApps.Metro.Template.git
lanicon
Caliburn.MahApps.Metro.Template
Caliburn.MahApps.Metro.Template
master

搜索帮助