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 继承. 代码实 ...
随机推荐
- .net 大文件上传注意,修改 IIS 配置
原因 Web 服务器上的请求筛选被配置为拒绝该请求,因为内容长度超过配置的值. 可尝试的操作:确认 applicationhost.config 或 web.config 文件中的 configura ...
- spring security使用数据库资源
国内对权限系统的基本要求是将用户权限和被保护资源都放在数据库里进行管理,在这点上Spring Security并没有给出官方的解决方案,为此我们需要对Spring Security进行扩展.. 数据库 ...
- 2016HUAS暑假集训题1 A-士兵队列训练问题
A - 士兵队列训练问题 Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从 ...
- java 通过控制台输入的数字打印菱形字母
package com.rui.test; import java.util.Scanner; /** * @author sunshine * @version 1.0 * @date:2015年1 ...
- 响应式网站通用css
/* core.css v1.1 | MIT License | corecss.io */ html { font-family: sans-serif; font-size: 100%; line ...
- java基础学习总结——基础语法1
一.标识符
- EntityFramework 实体拆分与表拆分
摘录自https://msdn.microsoft.com/zh-cn/data/jj591617 * 将实体类型的 CLR 属性映射到数据库中的多个表(实体拆分) 实体拆分允许一个实体类型的属性分散 ...
- Java 实现MapReduce函数
明白了MapReduce程序的工作原理之后,下一步就是写代码来实现它.我们需要三样东西:一个map函数.一个reduce函数和一些用来运行作业的代码.map函数由Mapper类来表示,后者声明一个ma ...
- 启动Hive报错
Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not init ...
- Java学习-047-数值格式化及小数位数四舍五入
此小工具类主要用于数值四舍五入.数值格式化输出,很简单,若想深入研究,敬请自行查阅 BigDecimal 或 DecimalFormat 的 API,BigDecimal.setScale(位数,四舍 ...