zoukankan      html  css  js  c++  java
  • SiliverLight 动态添加菜单prism框架(一)

    (一落后了,直接看二)

    1

    shell.xml中

    代码
    btnSubMenu = new Button();
    btnSubMenu.Width
    = 65;
    btnSubMenu.Height
    = 20;
    btnSubMenu.Opacity
    = 0.5;
    btnSubMenu.Margin
    = new Thickness(10 + 65 * 4, 1, 0, 0);
    btnSubMenu.Content
    = "韩磊";
    btnSubMenu.Name
    = "btn" + "ReCheck";
    btnSubMenu.Click
    += new RoutedEventHandler(btnSubMenu_Click);
    ctrlSubMenu.Children.Add(btnSubMenu);
    代码
    btnSubMenu = new Button();
    btnSubMenu.Width
    = 65;
    btnSubMenu.Height
    = 20;
    btnSubMenu.Opacity
    = 0.5;
    btnSubMenu.Margin
    = new Thickness(10 + 65 * 7, 1, 0, 0);
    btnSubMenu.Content
    = "银行日志";
    btnSubMenu.Name
    = "btn" + "BankPenaltyLog";
    btnSubMenu.Click
    += new RoutedEventHandler(btnSubMenu_Click);
    ctrlSubMenu.Children.Add(btnSubMenu);
    btnSubMenu
    = new Button();
    btnSubMenu.Width
    = 65;
    btnSubMenu.Height
    = 20;
    btnSubMenu.Opacity
    = 0.5;
    btnSubMenu.Margin
    = new Thickness(10 + 65 * 8, 1, 0, 0);
    btnSubMenu.Content
    = "违法信息日志";
    btnSubMenu.Name
    = "btn" + "IllegalSysInterfaceLog";
    btnSubMenu.Click
    += new RoutedEventHandler(btnSubMenu_Click);
    ctrlSubMenu.Children.Add(btnSubMenu);
    btnSubMenu
    = new Button();
    btnSubMenu.Width
    = 65;
    btnSubMenu.Height
    = 20;
    btnSubMenu.Opacity
    = 0.5;
    btnSubMenu.Margin
    = new Thickness(10 + 65 * 9, 1, 0, 0);
    btnSubMenu.Content
    = "操作日志";
    btnSubMenu.Name
    = "btn" + "OperationLog";
    btnSubMenu.Click
    += new RoutedEventHandler(btnSubMenu_Click);
    ctrlSubMenu.Children.Add(btnSubMenu);

    2

    module catalog

    代码
    <!--<Modularity:ModuleInfoGroup Ref="EvidenceTidyApp.xap" InitializationMode="OnDemand">
    <Modularity:ModuleInfo ModuleName="ReCheckView" ModuleType="EvidenceTidyApp.Libs.ModuleReCheck, EvidenceTidyApp, Version=1.0.0.0" />
    </Modularity:ModuleInfoGroup>
    <Modularity:ModuleInfoGroup Ref="EvidenceTidyApp.xap" InitializationMode="OnDemand">
    <Modularity:ModuleInfo ModuleName="ReCheckView" ModuleType="EvidenceTidyApp.Libs.ModuleReCheck, EvidenceTidyApp, Version=1.0.0.0" />
    </Modularity:ModuleInfoGroup>
    <Modularity:ModuleInfoGroup Ref="EvidenceTidyApp.xap" InitializationMode="OnDemand">
    <Modularity:ModuleInfo ModuleName="ReCheckView" ModuleType="EvidenceTidyApp.Libs.ModuleReCheck, EvidenceTidyApp, Version=1.0.0.0" />
    </Modularity:ModuleInfoGroup>-->
    代码

    <Modularity:ModuleInfoGroup Ref="SysMgrApp.xap" InitializationMode="OnDemand">
    <Modularity:ModuleInfo ModuleName="BankPenaltyLogView" ModuleType="SysMgrApp.Libs.ModuleBankPenaltyLog, SysMgrApp, Version=1.0.0.0" />
    </Modularity:ModuleInfoGroup>
    <Modularity:ModuleInfoGroup Ref="SysMgrApp.xap" InitializationMode="OnDemand">
    <Modularity:ModuleInfo ModuleName="IllegalSysInterfaceLogView" ModuleType="SysMgrApp.Libs.ModuleIllegalSysInterfaceLog, SysMgrApp, Version=1.0.0.0" />
    </Modularity:ModuleInfoGroup>
    <Modularity:ModuleInfoGroup Ref="SysMgrApp.xap" InitializationMode="OnDemand">
    <Modularity:ModuleInfo ModuleName="OperationLogView" ModuleType="SysMgrApp.Libs.ModuleSysMgrApp, SysMgrApp, Version=1.0.0.0" />
    </Modularity:ModuleInfoGroup>

    3

    SysMgrApp.Libs

    Libs

    代码
    #region ModuleBankPenaltyLog
    public class ModuleBankPenaltyLog : IModule
    {
    private readonly string viewName = "BankPenaltyLogView";
    private readonly IRegionManager regionManager;

    public ModuleBankPenaltyLog(IRegionManager regionManager, IModuleManager moduleManager)
    {
    this.regionManager = regionManager;
    }

    public void Initialize()
    {
    IRegion mainRegion
    = regionManager.Regions["mainRegion"];

    object view = mainRegion.GetView(viewName);
    if (view == null)
    {
    //mainRegion.Add(new BankPenaltyLog(), viewName);
    //view = mainRegion.GetView(viewName);
    //mainRegion.Activate(view);
    }
    }
    }
    #endregion
    #region ModuleIllegalSysInterfaceLog
    public class ModuleIllegalSysInterfaceLog : IModule
    {
    private readonly string viewName = "IllegalSysInterfaceLogView";
    private readonly IRegionManager regionManager;

    public ModuleIllegalSysInterfaceLog(IRegionManager regionManager, IModuleManager moduleManager)
    {
    this.regionManager = regionManager;
    }

    public void Initialize()
    {
    IRegion mainRegion
    = regionManager.Regions["mainRegion"];

    object view = mainRegion.GetView(viewName);
    if (view == null)
    {
    //mainRegion.Add(new IllegalSysInterfaceLog(), viewName);
    //view = mainRegion.GetView(viewName);
    //mainRegion.Activate(view);
    }
    }
    }
    #endregion
    #region ModuleOperationLog
    public class ModuleOperationLog : IModule
    {
    private readonly string viewName = "OperationLogView";
    private readonly IRegionManager regionManager;

    public ModuleOperationLog(IRegionManager regionManager, IModuleManager moduleManager)
    {
    this.regionManager = regionManager;
    }

    public void Initialize()
    {
    IRegion mainRegion
    = regionManager.Regions["mainRegion"];

    object view = mainRegion.GetView(viewName);
    if (view == null)
    {
    //mainRegion.Add(new OperationLog(), viewName);
    //view = mainRegion.GetView(viewName);
    //mainRegion.Activate(view);
    }
    }
    }
    #endregion
    代码
    #region ModuleTest
    public class ModuleBankPenaltyLog : IModule
    {
    private readonly string viewName = "BankPenaltyLogView";
    private readonly IRegionManager regionManager;

    public ModuleBankPenaltyLog(IRegionManager regionManager, IModuleManager moduleManager)
    {
    this.regionManager = regionManager;
    }

    public void Initialize()
    {
    IRegion mainRegion
    = regionManager.Regions["mainRegion"];

    object view = mainRegion.GetView(viewName);
    if (view == null)
    {
    //mainRegion.Add(new TestCtrl(), viewName);
    //view = mainRegion.GetView(viewName);
    //mainRegion.Activate(view);
    }
    }
    }
    #endregion
  • 相关阅读:
    判断广播是否已注册
    Android 之使用LocalBroadcastManager解决BroadcastReceiver安全问题
    Android BroadcastReceiver 注册和反注册
    关于Android TaskAffinity的那些事儿
    文件读取方法(FileHelpers) z
    FileHelpers 用法 z
    tdf sample
    打开文件
    async/await 异步编程
    使用Topshelf创建Windows服务
  • 原文地址:https://www.cnblogs.com/hl3292/p/1864334.html
Copyright © 2011-2022 走看看