SC.UI
IController
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity; namespace SC.UI
{
public interface IController : ISingletonDependency
{
void SubscribeEvents(); void UnsubscribeEvents(); IUnityContainer UnityContainer { get; set; } IRegionManager RegionManager { get; set; } IEventAggregator EventAggregator { get; set; } void AttachView(IViewModel viewModel); void RemoveView(IViewModel viewModel); void AttachView(string zoneName, IViewModel viewModel); void RemoveView(string zoneName, IViewModel viewModel);
}
}
Controller
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity; namespace SC.UI
{
public abstract class Controller : NotificationObject, IController
{
public Controller(
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
{
RegionManager = regionManager;
EventAggregator = eventAggregator;
UnityContainer = unityContainer;
} public IUnityContainer UnityContainer { get; set; } public IRegionManager RegionManager { get; set; } public IEventAggregator EventAggregator { get; set; } public virtual void SubscribeEvents() { } public virtual void UnsubscribeEvents() { } public void AttachView(IViewModel viewModel)
{
AttachView(RegionNames.MainRegion, viewModel);
} public void AttachView(string regionName, IViewModel viewModel)
{
var zone = RegionManager.Regions[regionName]; if (null != zone && !zone.Views.Contains(viewModel))
{
zone.Add(viewModel);
}
} public void RemoveView(IViewModel viewModel)
{
RemoveView(RegionNames.MainRegion, viewModel);
} public void RemoveView(string regionName, IViewModel viewModel)
{
var region = RegionManager.Regions[regionName]; if (null != region && region.Views.Contains(viewModel))
{
region.Remove(viewModel);
}
}
}
}
ModuleBase
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity; namespace SC.UI
{
public class ModuleBase : IModule
{
protected IUnityContainer UnityContainer { get; private set; }
protected IEventAggregator EventAggregator { get; private set; }
protected IRegionManager RegionManager { get; private set; } public ModuleBase(
IUnityContainer unityContainer,
IEventAggregator eventAggregator,
IRegionManager regionManager)
{
UnityContainer = unityContainer;
EventAggregator = eventAggregator;
RegionManager = regionManager;
} public void Initialize()
{
ConfigureContainer();
InitializeModule();
SubscribeEvents();
} protected virtual void ConfigureContainer() { } protected virtual void InitializeModule() { } protected virtual void SubscribeEvents() { } protected virtual void UnSubscribeEvents() { }
}
}
IViewModel
using System.ComponentModel; namespace SC.UI
{
public interface IViewModel : INotifyPropertyChanged, ISingletonDependency
{ }
}
ViewModelBase
namespace SC.UI
{
public class ViewModelBase : NotificationObject, IViewModel
{
public ViewModelBase()
{ }
}
}
ISingletonDependency
namespace SC.UI
{
public interface ISingletonDependency
{
}
}
http://files.cnblogs.com/files/zisezhixin/SC.UI.zip
SC.UI的更多相关文章
- Spark UI (基于Yarn) 分析与定制
转载自:https://yq.aliyun.com/articles/60194 摘要: 这篇文章的主旨在于让你了解Spark UI体系,并且能够让你有能力对UI进行一些定制化增强.在分析过程中,你也 ...
- Spark源码系列(四)图解作业生命周期
这一章我们探索了Spark作业的运行过程,但是没把整个过程描绘出来,好,跟着我走吧,let you know! 我们先回顾一下这个图,Driver Program是我们写的那个程序,它的核心是Spar ...
- 【Spark Core】任务运行机制和Task源代码浅析1
引言 上一小节<TaskScheduler源代码与任务提交原理浅析2>介绍了Driver側将Stage进行划分.依据Executor闲置情况分发任务,终于通过DriverActor向exe ...
- Spark里面的任务调度:离SparkContext开始
SparkContext这是发达国家Spark入学申请,它负责的相互作用和整个集群,它涉及到创建RDD.accumulators and broadcast variables.理解力Spark架构, ...
- Spark Scheduler模块源码分析之TaskScheduler和SchedulerBackend
本文是Scheduler模块源码分析的第二篇,第一篇Spark Scheduler模块源码分析之DAGScheduler主要分析了DAGScheduler.本文接下来结合Spark-1.6.0的源码继 ...
- Spark技术内幕:Executor分配详解
当用户应用new SparkContext后,集群就会为在Worker上分配executor,那么这个过程是什么呢?本文以Standalone的Cluster为例,详细的阐述这个过程.序列图如下: 1 ...
- Spark技术内幕之任务调度:从SparkContext开始
SparkContext是开发Spark应用的入口,它负责和整个集群的交互,包括创建RDD,accumulators and broadcast variables.理解Spark的架构,需要从这个入 ...
- Spark分析之SparkContext启动过程分析
SparkContext作为整个Spark的入口,不管是spark.sparkstreaming.spark sql都需要首先创建一个SparkContext对象,然后基于这个SparkContext ...
- cocos代码研究(23)Widget子类ScrollView学习笔记
基础理论 一个能够被用户触摸滚动的一个层次型布局容器视图,允许其尺寸大于屏幕显示的物理尺寸,其内部维护有一个布局用于水平的或垂直的存放子节点.继承自 Layout,被 ListView 继承. 代码实 ...
随机推荐
- ArcEngine:空间索引格网大小无效
参考如下帖子:http://www.cnblogs.com/linhugh/archive/2012/07/24/2606439.html\ C# 代码如下 IFeatureClass pNewFtC ...
- php获取真实IP地址
function user_realip() { if (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif (g ...
- Mongodb数据库加密存储(python)
需求: 不知道大家有没有遇到过这样的需求:自己的服务器出于对数据库安全的保护,需要对存储的数据进行加密保护.这样万一数据库被人拿到,别人也不能拿到数据库里面的内容.这里还有一个前提:前端的展示页面是 ...
- Yii源码阅读笔记(二十五)
Module类中剩余部分代码,通过控制器ID实例化当前模块的控制器,当前模块的Action方法的前置和后置方法: /** * This method is invoked right before a ...
- C/C++相对论——C++中为什么要使用异常(跳转语句会造成对象没有被析构)
C++中为什么要使用异常? 很多人也许知道C++中的异常机制,很多人也许不知道.很多人知道C中常用的assert,也知道在编译时候指定NODEBUG来忽略它. 对于C语言,使用正常的if-else即是 ...
- ASP.NET Global Application_Error事件中访问Session报错 解决
报错信息:会话状态在此上下文中不可用 protected void Application_Error(object sender, EventArgs e) { //以此判断是否可用Session ...
- 服务设计模式一:Web服务概述
目录 1. Web服务是什么 2.为什么要使用Web服务 3.Web服务考虑的因素和替代方案 4.SOA是什么 Web服务是什么? 所谓服务,通俗的理解就是别人帮你做一些事情,比如说,腰酸背痛了,找个 ...
- centos 修改网卡名为eth0
centos7和centos6的命名规则不同,centos6网卡名由udev控制 网卡名以eth开头然后第一块网卡叫eth0第二块网卡叫eth1,然后centos7的网卡命名规则截然不同 centos ...
- 配置fabric-crashlytics教程
1. 注册账户 登录网站 https://try.crashlytics.com/ 来注册新的账户,审核通过时间为几个小时或者1到2天不等.然后注册时候输入的邮箱就会收到如下的邀请涵 2. acco ...
- tcpdump教程入门
tcpdump是一个最基本重要的网络分析工具, 掌握好这, 对于学习tcp/ip协议也是很有帮助的. 理解了tcp/ip协议栈的知识, 分析调优网络的能力才会更高. 所以使用tcpdump相比其它的工 ...