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. POJ3057 Evacuation(二分图最大匹配)

    人作X部:把门按时间拆点,作Y部:如果某人能在某个时间到达某门则连边.就是个二分图最大匹配. 时间可以二分枚举,或者直接从1枚举时间然后加新边在原来的基础上进行增广. 谨记:时间是个不可忽视的维度. ...

  2. css3中的几何图形shape研究

    前言 估计大家在日常工作中都会用到css形状,但是目前天朝中使用到最多的估计就是圆(circle).椭圆(ellipse).各种三角形形状,但是你肯定很少看见过用几何图形或者多边图形.假如你不懂什么叫 ...

  3. How to Programmatically Switch between the HubTile Visual States

    In this post I am going to talk about how to programmatically switch between different HubTile Visua ...

  4. elasticsearch1.0 升级2.2的数据备份和恢复

    近期由于elasticsearch的版本升级,需要研究下elasticsearch的快照(snapshot)和恢复(restore)功能.   先说下背景,目前环境采用的是elasticsearch1 ...

  5. Centos下设置静态IP

    使用VirtualBox装了很多虚拟机,默认采用的DHCP的方式,但是随着虚拟机越来越多以后,这种方式很不方便,所以需要将机器的IP都设置为静态IP 需要添加的几项内容的解释:IPADDR    IP ...

  6. td也可以溢出隐藏显示

    或许我这篇文章一取这样的名字,就会有人要问了:你怎么还在关注table啊,那早就过时了…赶紧Xhtml…div好…ul好…ol好…dl好…完了,不知道还有什么好了. table真的过时了么?你真的了解 ...

  7. CSS中zoom:1的作用 ,小标签大作用

    CSS中zoom:1的作用兼容IE6.IE7.IE8浏览器,经常会遇到一些问题,可以使用zoom:1来解决,有如下作用:触发IE浏览器的haslayout解决ie下的浮动,margin重叠等一些问题. ...

  8. php广告显示设置存放记录的目录代码

    <?php #########随机广告显示########## function myads(){ $dir="ads"; #设置存放记录的目录 //$dir="a ...

  9. Powershell的内置变量

    ls Variable:     Name Value Description $     ? TRUE Status of last command ^     args System.Object ...

  10. 【新产品发布】【iCore2 ARM / FPGA 双核心板】

    iCore2是一款包含ARM / FPGA两大利器的双核心板.ARM方面,采用意法半导体高性能的32位Cortex-M3内核STM32F103VE微处理器,主频达72MHz,并包含丰富外设接口.FPG ...