UIP收获继续

使用步骤
1 把你要做的东东(程序)分成各个明确的用户界面处理过程。
      一个程序时候很多的用户界面处理组合成的,只要明确的定义区分了这些。你的代码就能很方便的重用了。因为各个窗体是单独的功能单元
2 为每一个用户界面处理过程,选择适当的导航工具(UIP内提供的几个)
3 决定持久层的提供方,保持快照用的
4在你的程序中引用UIP block
5 创建你的控制器
public control1( Navigator navigator ) : base( navigator )
        
{
            
//
            
// TODO: 在此处添加构造函数逻辑
            
//
            
        }

控制器的名称必须和你配置文件中的一样
 this.State.NavigateValue = "AddedData";

  this.Navigate();
6 启动或者resume (从快照类似于存盘)你的项目
UIPManager类来启动你的任务(StartNavigationTask, StartOpenNavigationTask, or StartUserControlsTask )
  UIPManager.StartNavigationTask ( "Shopping", task );

Parameter

Description

navigator

配置文件中定义的导航器的名称

task

一个已经存在的任务whose state should be retrieved and used.

taskId

The ID of a previously saved task.

firstViewName

Name of the first view using the open navigator.

taskArguments

Any information that is required when starting or resuming an existing task.


7 连接
 当你要处理的过程需要连接多个控制器的时候使用

There are four concepts involved in linking tasks:

    Starting tasks You can start a task by calling any of the navigation start task methods or by calling the OnStartTask on your controller.

    Ending tasks You can end a task by calling either the SuspendTask or the OnCompleteTask method on your controller. Both methods allow the user interface process to clear the state for the current task and erase the current view from memory. However, the SuspendTask method does not remove the task from the state persistence provider. To clear the State object from both memory and from the state persistence provider, you must call the OnCompleteTask method.

    Resuming tasks You can resume a task that has been suspended by calling a navigation start task method (passing the task identifier or the task object that you want to resume), or by calling the OnStartTask method of an existing controller (passing the task identifier, the task object, or task arguments).

    Passing data between tasks You can pass data between tasks by using the OnStartTask overload with the TaskArgumentsHolder parameter. You can use this parameter to pass any data you want, and if the controller of the current view implements the EnterTask method, it can handle that data appropriately.

The TaskArgumentsHolder parameter contains a property of type object, meaning that you can pass any type of data by using this property. You should not pass an instance of the controller itself, nor should you pass the controller's State object. This is because each task should have its own State object of the type specified in the graph navigator. Instead, you should pass your own types or common data classes. If you design your own structs or types, remember that you need to reference them from both the caller and the callee.

 

Note: You can link tasks that have different types of navigators. The name of the navigator that is passed to the OnStartTask method determines what type of navigator is appropriate for your task.

 

 

The UIP Application Block allows you to link tasks in two ways: by chaining, or by nesting.

8 创建用户界面

public class WebForm2 : WebFormView

 界面连接控制器的地方

private MyController MyController

{

  get{ return (MyController)this.Controller; }

}

posted on 2005-11-17 10:33  黑月  阅读(500)  评论(0编辑  收藏  举报

导航