Shell框架XECA

shell.xaml主要起到是一个容器或壳的作用

<Window x:Class="XECA.Shell"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       
        xmlns:inf="clr-namespace:MyGlobal.Infrustructure;assembly=MyGlobal.Infrustructure"
        xmlns:prism="http://prismlibrary.com/"
        xmlns:Controls="clr-namespace:MyGlobal.Infrustructure.Controls;assembly=MyGlobal.Infrustructure"
        Title="工作平台" Height="300" Width="300" Background="{StaticResource myGraybrush}">
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Border Margin="5" Grid.Row="1" CornerRadius="5,5,5,5" BorderBrush="Black" BorderThickness="1">
            <Grid  Width="auto" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.15*"></ColumnDefinition>
                    <ColumnDefinition Width="0.85*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

<!--<Controls:RoundedBox Margin="10" />-->
                <Border Grid.Column="0" CornerRadius="10"  Background="{StaticResource myGraybrush}" BorderBrush="#193441" BorderThickness="1" Margin="3" Padding="1">
                    <ItemsControl prism:RegionManager.RegionName="{x:Static inf:RegionNames.MenuRegion }"/>
                </Border>

<Border Grid.Column="1" CornerRadius="10" Background="#FCFFf5" BorderBrush="#193441" BorderThickness="0" Margin="1" Padding="0">
                    <Grid x:Name="ContentGrid"   Grid.Row="1" RenderTransformOrigin="0.5,0.5">
                        <Grid.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform/>
                                <SkewTransform/>
                                <RotateTransform/>
                                <TranslateTransform/>
                            </TransformGroup>
                        </Grid.RenderTransform>
                        <Border BorderThickness="1" Width="auto" Height="auto" CornerRadius="10,10,10,10" BorderBrush="Black" >
                            <Controls:AnimatedTabControl
                                        x:Name="TabName"
                                        SelectedIndex="0" 
                                        VerticalAlignment="Stretch"
                                        ItemContainerStyle="{StaticResource ShellTabItemStyle}"
                                        Background="{StaticResource headerBarBG}"
                                        prism:RegionManager.RegionName="{x:Static inf:RegionNames.MCWrapRegion}"
                                        AutomationProperties.AutomationId="TabId" />
                        </Border>
                    </Grid>
                </Border>

</Grid>

</Border>
        <StackPanel Orientation="Horizontal">
            <Label HorizontalAlignment="Left" Margin="10,0,0,0" Width="Auto" Content="U-Project" FontWeight="Bold" Foreground="#fff" FontSize="24" FontFamily="Corbel"/>
          
        </StackPanel>
    </Grid>

</Window>

这里涉及两个关键技术点,一个是style的全局共享,另一个是采用AnimatedTabControl控件

App.config删除起始访问设置

<Application x:Class="XECA.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:XECA">  
</Application>

Bootstrap.cs代码

using Prism.Unity;
using System.Windows;
using Microsoft.Practices.Unity;
using Prism.Modularity;
 
using XECA.Views;
using Prism.Mef;
using System.ComponentModel.Composition.Hosting;
using MyGlobal.Infrustructure.Behaviors;
using System;
using MyGlobal.Infrustructure;
using Prism.Logging;
using EntityFW;
using TestTabItems;

namespace XECA
{
     [CLSCompliant(false)]
    public partial class Bootstrapper : MefBootstrapper//采用MefBootstrapper
    {

//程序运行日志管理
        private readonly EnterpriseLibraryLoggerAdapter _logger = new EnterpriseLibraryLoggerAdapter();

protected override ILoggerFacade CreateLogger()
        {
            return _logger;
        }
        protected override void ConfigureAggregateCatalog()
        {
            base.ConfigureAggregateCatalog();
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(RICommands).Assembly));
           
           
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(EntityFWModule).Assembly));
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(TabTestModule).Assembly));
            //业务模块采用目录catlog加载方式,即后续业务模块开发完成,将DLL扔到目录下即可

this.AggregateCatalog.Catalogs.Add(new DirectoryCatalog("../../Modules"));
        }

protected override void ConfigureContainer()
        {
            base.ConfigureContainer();
        }

protected override void InitializeShell()
        {
            base.InitializeShell();

Application.Current.MainWindow = (Window)this.Shell;
            Application.Current.MainWindow.Show();
        }

protected override Prism.Regions.IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            var factory = base.ConfigureDefaultRegionBehaviors();

factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));

return factory;
        }

protected override DependencyObject CreateShell()
        {
            DependencyObject x= this.Container.GetExportedValue<Shell>();
            return x;
        }
    }
}

Prism&MEF构建开发框架 (一)的更多相关文章

  1. Prism&MEF构建开发框架 (三)

    菜单管控模块EntityFW 菜单的加载采用MEF技术,程序实现思路: 1 .主菜单加载页面MainMenuView.xaml指向MenuRegion 2. 菜单Item点击及内容加载,采用订阅模式, ...

  2. Prism&MEF构建开发框架

    系统框架构想效果图 平台简单由左侧菜单和右侧内容区以及顶部系统和用户信息区构成 菜单根据系统模块动态加载 右侧,根据左侧选中菜单动态加载子模块,子模块集合以tab选项卡方式布局 系统模块划分为Shel ...

  3. 一步步实现 Prism + MEF(一)--- 搭建框架

    第一步:构建一个名为Bootstrapper的类作为引导程序. class Bootstrapper : MefBootstrapper { } 第二步:在MainWindow窗体中添加一个Coont ...

  4. UWP应用程序使用Prism框架构建MVVM

    在我们创建的UWP解决方案中选择引用->管理NuGet包程序包 NuGet管理包 2. 搜索Prism.Core,并安装 搜索Prism.Core 3. 搜索Prism.Unity,并安装 搜索 ...

  5. Prism MEF example

    Related Attributes These attributes are under namespace System.ComponentModel.Composition Import The ...

  6. 一步步实现 Prism + MEF(二)--- 绑定命令

    Prism程序集为我们提供了DelegateCommand命令,使用该命令可实现窗口直接绑定.第一步:在ViewModel中定义一个DelegateCommand属性. public Delegate ...

  7. 【翻译】WPF应用程序模块化开发快速入门(使用Prism+MEF)

    编译并运行快速入门 需要在VisualStudio 2010上运行此快速入门示例 代码下载:ModularityWithMef.zip 先重新生成解决方案 再按F5运行此示例 说明: 在此快速入门示例 ...

  8. Prism for WPF初探(构建简单的模块化开发框架)

    先简单的介绍一下Prism框架,引用微软官方的解释: Prism provides guidance to help you more easily design and build, flexibl ...

  9. 【MEF】构建一个WPF版的ERP系统

    原文:[MEF]构建一个WPF版的ERP系统 引言 MEF是微软的一个扩展性框架,遵循某种约定将各个部件组合起来.而ERP系统的一大特点是模块化,它们两者的相性很好,用MEF构建一个ERP系统是相当合 ...

随机推荐

  1. LIB 配置文件读写器

    由于读写配置文件的次数比较频繁,而且拥有众多的类库,到最后,直接被各种各样的类库烦死. 顺手封一个简单,实用的.主要功能: 读写AppSetting 读取连接字符串 读取自定义配置节 using Sy ...

  2. JavaScript 变量、函数与原型链

    定义 || 赋值 1-函数的定义 函数定义的两种方式: “定义式”函数:function fn(){ alert("哟,哟!"); } “赋值式”函数:var fn = funct ...

  3. CSS3 选择器——伪类选择器

    前面花了两节内容分别在<CSS3选择器——基本选择器>和<CSS3选择器——属性选择器>介绍了CSS3选择器中的基本选择器和属性选择器使用方法,今天要和大家一起学习CSS3选择 ...

  4. 【BZOJ】1089: [SCOI2003]严格n元树(递推+高精度/fft)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1089 题意:求深度为d的n元树数目.(0<n<=32, 0<=d<=16) ...

  5. 【BZOJ】1221: [HNOI2001] 软件开发(最小费用最大流)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1221 先吐槽一下,数组依旧开小了RE:在spfa中用了memset和<queue>的版本 ...

  6. HttpClient_httpclient中使用HTTPS的方法

    import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustMa ...

  7. html5文章 -- HTML5开发实例-网易微博手机Web App开发过程

    HTML5在国内外越来越受到互联网开发团队的青睐.国外,谷歌兴致勃勃地开发Chrome Web Store,微软发布了支持使用HTML5技术开发的“Irish Spring”主题网站,诺基亚斥巨资购得 ...

  8. 记在thinkPHP中一个创建模型的小错误

    在创建好模型以后,访问说没有该方法,如图 看代码 class ManagerModel { //put your code here function checkDenglu($name,$pwd){ ...

  9. 【iHMI43 4.3寸液晶模块】demo例程(版本1.03)发布

    ============================== 技术论坛:http://www.eeschool.org 博客地址:http://xiaomagee.cnblogs.com 官方网店:h ...

  10. CodeForces 621C 数学概率期望计算

    昨天训练赛的题..比划了好久才想出来什么意思 之前想的是暴力for循环求出来然后储存数组 后来又想了想 自己萌的可以.. 思路就是求出来每个人与他的右边的人在一起能拿钱的概率(V(或)的关系)然后*2 ...