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 继承. 代码实 ...
随机推荐
- getPos封装
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- 用外部表的方式查询当天数据库alert日志文件
1环境准备 2查询ORA-开头的错误
- 【HDU 3401 Trade】 单调队列优化dp
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3401 题目大意:现在要你去炒股,给你每天的开盘价值,每股买入价值为ap,卖出价值为bp,每天最多买as ...
- hibernate 中如何用注解映射定长字符类型char(2)
如果是用xml的方式配置映射,可以在<column>标签的sql-type属性中设置char(2),比如: <property name="age" type=& ...
- EDI - Biztalk Sample
1. EDI Control - Scripting Usage:
- Choose Concurrency-Friendly Data Structures
What is a high-performance data structure? To answer that question, we're used to applying normal co ...
- shutter截图工具
安装: 1.打开ubuntu software center,搜索shutter,安装. 使用:
- 给RecyclerView实现的GridView加上HeaderView和FooterView
给RecyclerView设置布局管理器 GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); 写适配器,添加子项 ...
- Objective-C 中类属性(修饰)
Objective-C 中类属性(修饰) (2013-07-13 14:38:35) 转载▼ 标签: it 分类: IOS笔记 nonatomic: 非原子性访问,对属性赋值的时候不加锁,多线程并发访 ...
- symmetric multiprocessor
https://en.wikipedia.org/wiki/Symmetric_multiprocessor_system A symmetric multiprocessor system (SMP ...