User interface process application block CEO Application blocks
User interface process application block Владимир Чалков CEO
Application blocks Показват как архитектурно се подхожда към някои типични проблеми n Разпространяват се заедно със изходния код и могат да се използват като основа n Някои блокове: n Data access application block n Offline application block n Configuration management application block n User interface process application block n
Основни термини Navigation graph n Navigator n State persistence provider n Task n Controller n
Persistence providers Isolated. Storage. Persistence n Secure. Isolated. Storage. Persistence n Sql. Server. Persist. State n Secure. Sql. Server. Persist. State n Session. State. Persistence n Memory. State. Persistence n
Избор на persistence provider
A user interface process frm. Main start end previous frm. List next frm. Person
Промени по формите public class frm. Person : Windows. Form. View { …. private void frm. Person_Load(object sender, Event. Args e) { this. txt. First. Text = Type. Safe. Controller. Current. Person. Firstname; this. txt. Last. Text = Type. Safe. Controller. Current. Person. Lastname;
Controller класа (1/2) public class My. Controller : Controller. Base { public Array. List Person. List; public Person Current. Person { get { return (Person)this. Navigator. Current. State["Current. Person"]; } set { this. Navigator. Current. State["Current. Person"]=value; } }
Controller класа (2/2) public void frm. List. New. Button() { State. Navigate. Value = "next"; Navigate(); } public void frm. Person. End. Button() { State. Navigate. Value = "previous"; Navigate(); }
Конфигурационен файл (1/3) <navigation. Graph name="Main. Navigation" start. View=“frm. Main" state="State" state. Persist="Isolated. Storage. Persistence" i. View. Manager="Windows. Form. View. Manager"> <node view='frm. List'> <navigate. To navigate. Value="next" view='frm. Person' /> <navigate. To navigate. Value="end" view=‘frm. Main' /> </node> <node view='frm. Person'> <navigate. To navigate. Value="previous“ view='frm. List' /> </node> <node view='Form 1'> <navigate. To navigate. Value="Start" view='frm. List' /> </node> </navigation. Graph>
Конфигурационен файл (2/3) <object. Types> <i. View. Manager name="Windows. Form. View. Manager" type="Microsoft. Application. Blocks. UIProcess. Windows. Form. View. Ma nager, Microsoft. Application. Blocks. UIProcess, Version=1. 0, Culture=neutral, Public. Key. Token=null" /> <state name="State" type="Microsoft. Application. Blocks. UIProcess. State, Microsoft. Application. Blocks. UIProcess, Version=1. 0, Culture=neutral, Public. Key. Token=null" /> <controller name="My. Controller" type="Crossroad. UIPAB. Common. My. Controller, Crossroad. UIPAB. Common, Version=1. 0. 1. 5, Culture=neutral, Public. Key. Token=null" /> <state. Persistence. Provider name="Isolated. Storage. Persistence" type="Microsoft. Application. Blocks. UIProcess. Isolated. Storage. Pe rsistence, Microsoft. Application. Blocks. UIProcess, Version=1. 0, Culture=neutral, Public. Key. Token=null" /> </object. Types>
Конфигурационен файл (3/3) <views> <view name="frm. Person" type="Crossroad. UIPAB. UI. frm. Person, Crossroad. UIPAB. UI, Version=1. 0. 1. 5, Culture=neutral, Public. Key. Token=null" controller="My. Controller" stay. Open="false" open. Modal="true" /> <view name="frm. List" type="Crossroad. UIPAB. UI. frm. List, Crossroad. UIPAB. UI, Version=1. 0. 1. 5, Culture=neutral, Public. Key. Token=null" controller="My. Controller" stay. Open="false" open. Modal="false" /> <view name="frm. Main" type="Crossroad. UIPAB. UI. frm. Main, Crossroad. UIPAB. UI, Version=1. 0. 1. 5, Culture=neutral, Public. Key. Token=null" controller="My. Controller" stay. Open="false" open. Modal="false" /> </views>
Стартиране на процеса { UIPManager. Navigate. Event+=new. Microsoft. Application Bl ocks. UIProcess. UIPManager. Navigate. Event. Handler (UIPM anager_Navigate. Event); UIPManager. Register. Shutdown(this); UIPManager. Start. Navigation. Task("Main. Navigation "); this. Hide();
Навигация във формите private void Persons. List_Double. Click(object sender, System. Event. Args e) { if (Persons. List. Selected. Indices. Count>0) { Type. Safe. Controller. Current. Person=(Person)Ty pe. Safe. Controller. Person. List[Persons. List. Se lected. Indices[0]]; Type. Safe. Controller. frm. List. Edit(); } }
Връзки http: //www. microsoft. com/patterns n http: //msdn. microsoft. com n http: //www. gotdotnet. com n News: //microsoft. public. bg. developer n n Сървър: news. micrsoft. com
Q&A
- Slides: 33