基于WPF系统框架设计(6) 整合MVVM框架(Prism)2013-12-10 cnblogs aganqin我们基础的框架已经搭建起来了,现在整合MVVM框架Prism,在ViewModel做一些逻辑处理,真正把界面设 计分离出来。这样方便我们系统开发分工合作,同时提高系统可维护性和灵活性。具体的 Prism安装和Microsoft.Practices.Prism.dll获取,在这个网址:http://compositewpf.codeplex.com/跟Winform一样原始的模式:(1)现在看一下之前的设计的View: MainWindow.XAML源码:

(2)MainWindow.xaml.cs源码:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using Fluent;using Xceed.Wpf.AvalonDock.Layout;namespace TLAgent.SecurityManager.WPF{/// <summary>/// Interaction logic for MainWindow.xaml/// </summary>public partial class MainWindow : RibbonWindow{public MainWindow(){InitializeComponent();}private void OnExitSystem(object sender, RoutedEventArgs e){MessageBoxResult result = MessageBox.Show("确定要退出系统吗?", "确认消息", MessageBoxButton.OKCancel, MessageBoxImage.Question);if (result == MessageBoxResult.OK){Application.Current.Shutdown();}}}}