蜗牛的天空

慢慢爬.慢慢游.很快就可以到知识海洋的彼岸
  博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
<configSections>
    
<section name="uipConfiguration" type="Microsoft.ApplicationBlocks.UIProcess.UIPConfigHandler,  Microsoft.ApplicationBlocks.UIProcess, Version=1.0.1.0,Culture=neutral,PublicKeyToken=null" />
  
</configSections>

  
<uipConfiguration>
    
<objectTypes>
      
<iViewManager 
             
name="APMViewManager"
             type
="Microsoft.ApplicationBlocks.UIProcess.WindowsFormViewManager, Microsoft.ApplicationBlocks.UIProcess, Version=1.0.1.0,Culture=neutral,PublicKeyToken=null"/>
      
<state 
          
name="State" 
          type
="Microsoft.ApplicationBlocks.UIProcess.State, Microsoft.ApplicationBlocks.UIProcess, Version=1.0.1.0,Culture=neutral,PublicKeyToken=null"/>
      
<controller  name="APMControl"
                   type
="APMFlowControl.APMControl,APMFlowControl,Version=1.0.1.0, Culture=neutral, PublicKeyToken=null"/>
      
<statePersistenceProvider 
                    
name="MemoryPersistState"  
                    type
="Microsoft.ApplicationBlocks.UIProcess.MemoryStatePersistence, Microsoft.ApplicationBlocks.UIProcess, Version=1.0.1.0,Culture=neutral,PublicKeyToken=null"/>
    
</objectTypes>
    
<views>
      
<view
        
name="MainMenu"
        type
="APMFlowControl.frmMainMenu,APMFlowControl,Version=1.0.1.0,Culture=neutral,PublicKeyToken=null"
        controller
="APMControl"/>
      
<view
        
name="Comm"
        type
="APMFlowControl.frmComm,APMFlowControl,Version=1.0.1.0,Culture=neutral,PublicKeyToken=null"    
        controller
="APMControl"/>
      
<view
        
name="Success"
        type
="APMFlowControl.frmSuccess,APMFlowControl,Version=1.0.1.0,Cultrue=neutral,PublicKeyToken=null"
        controller
="APMControl"/>
      
<view
        
name="Menu"
        type
="APMFlowControl.frmMenu,APMFlowControl,Version=1.0.1.0,Cultrue=neutral,PublicKeyToken=null"
        controller
="APMControl"/>
    
</views>

    
<sharedTransitions>
      
<sharedTransition navigateValue="ReturnMain" navigateTo="MainMenu"/>
    
</sharedTransitions>

    
<navigationGraph
      
iViewManager="APMViewManager"
      name
="APMClient"
      state
="State"
      statePersist
="MemoryPersistState"
      startView
="MainMenu">
      
<node view="MainMenu">
        
<navigateTo navigateValue="Mobile" view="Menu" />
        
<navigateTo navigateValue="Query" view="Comm" />
      
</node>
        
<node view="Comm">
          
<navigateTo navigateValue="Print" view="Success" />
        
</node>
        
<node view="Success">
          
<navigateTo navigateValue="good" view="Comm" />  
        
</node>
        
<node view="Menu">
          
<navigateTo navigateValue="FZConnect" view="Comm"/>
          
<navigateTo navigateValue="XMConnect" view="Comm" />
          
<!--navigateTo navigateValue="ReturnMain" view="MainMenu" /-->  
       
</node>
    
</navigationGraph>
  
</uipConfiguration>
</configuration>
APMFlowControl.cs
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.UIProcess;

namespace APMFlowControl
{
    
class APMControl : ControllerBase
    
{
        
public APMControl(Navigator navigator)
            : 
base(navigator)
        
{

        }

        
//实现窗体的Navigate
        public void GotoForm(string Value)
        
{
            
this.Navigator.CurrentState.NavigateValue = Value;
            Navigate();
        }



    }

}

frmComm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.UIProcess;

namespace APMFlowControl
{
    
public partial class frmComm : WindowsFormView
    
{
        
public frmComm()
        
{
            InitializeComponent();
        }


        
private void btnRetrun_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"ReturnMain");
        }

        
private APMControl FormControl
        
{
            
get
            
{
                
return (APMControl)Controller;
            }

        }


        
private void frmComm_Load(object sender, EventArgs e)
        
{

            
        }


        
private void btnGo_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"Print");
        }


        
private void frmComm_KeyPress(object sender, KeyPressEventArgs e)
        
{
 
        }


        
private void btnRetrun_KeyPress(object sender, KeyPressEventArgs e)
        
{
         
        }


        
private void frmComm_Activated(object sender, EventArgs e)
        
{

        }


        
private void frmComm_Shown(object sender, EventArgs e)
        
{
            
if (Navigator.CurrentState["TradeCode"].ToString() == "0001")
                Text 
= "福州手机";
            
if (Navigator.CurrentState["TradeCode"].ToString() == "0002")
                Text 
= "厦门手机";
            
if (Navigator.CurrentState["TradeCode"].ToString() == "0003")
                Text 
= "查询";
        }


        
private void pictureBox1_Click(object sender, EventArgs e)
        
{

        }

    }

}
界面:

frmMainMenu.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.UIProcess;

namespace APMFlowControl
{
    
public partial class frmMainMenu : WindowsFormView
    
{
        
public frmMainMenu()
        
{
            InitializeComponent();
        }


        
private void btnCapture_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"Mobile");
        }

        
//取得当前窗体的控制流
        private APMControl FormControl
        
{
            
get
            
{
                
return (APMControl)Controller;
            }

        }


        
private void btnQuery_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"Query");
            Navigator.CurrentState[
"TradeCode"= "0003";
            
        }


        
private void frmMainMenu_Load(object sender, EventArgs e)
        
{
            pictureBox1.Load(
"imges/20050531151334326.jpg");
        }

    }

}
界面:

frmMenu.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.UIProcess;

namespace APMFlowControl
{
    
public partial class frmMenu : WindowsFormView
    
{
        
public frmMenu()
        
{
            InitializeComponent();
        }


        
private void btnFZ_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"FZConnect");
            
this.Navigator.CurrentState["TradeCode"= "0001";
        }


        
private APMControl FormControl
        
{
            
get
            
{
                
return (APMControl)Controller;
            }

        }


        
private void btnXM_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"XMConnect");
            
this.Navigator.CurrentState["TradeCode"= "0002";
        }


        
private void btnReturn_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"ReturnMain");
        }


    }

}
界面:

frmSuccess.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.UIProcess;

namespace APMFlowControl
{
    
public partial class frmSuccess : WindowsFormView
    
{
        
public frmSuccess()
        
{
            InitializeComponent();
        }


        
private void btnReturn_Click(object sender, EventArgs e)
        
{
            FormControl.GotoForm(
"ReturnMain");
        }


        
private void btnExit_Click(object sender, EventArgs e)
        
{
            Close();
        }


        
private void frmSuccess_Load(object sender, EventArgs e)
        
{
          
        }

        
private APMControl FormControl
        
{
            
get
            
{
                
return (APMControl)Controller;
            }

        }

    }

}
界面:

Start.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.UIProcess;

namespace APMFlowControl
{
    
public partial class Start : Form,IShutdownUIP       
    
{
        
public Start()
        
{
            InitializeComponent();
        }


        
private void btnInput_Click(object sender, EventArgs e)
        
{
            
//关闭所有已经打开的View
            UIPManager.RegisterShutdown(this);
            
this.Visible = false;
            
//开启任务
            UIPManager.StartNavigationTask("APMClient");
        }


        
IShutdownUIP 成员
    }

}
界面:

Program.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace APMFlowControl
{
    
static class Program
    
{
        
/// <summary>
        
/// 应用程序的主入口点。
        
/// </summary>

        [STAThread]
        
static void Main()
        
{
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(
false);
            Application.Run(
new Start());
        }

    }

}