This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy



Download 21,46 Mb.
Pdf ko'rish
bet1766/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1762   1763   1764   1765   1766   1767   1768   1769   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Adding a While Activity

Recall that our sequential process will prompt the end user for his or her name until the input can

be validated against a custom business rule (that is yet to be defined). Such looping behavior can be

represented using the While activity. Specifically, a While activity allows us to define a set of related

activities that will continuously execute until a specified condition is true.

To illustrate, begin by dragging a While activity from the Windows Workflow Toolbox directly

below the previous Code activity and rename this new activity to AskForNameLoopActivity. The

next step is to define the condition that will be used to exit the loop itself by setting the Condition

value from the Properties window. 

The Condition value (which is a common property of many activities) can be set in two key

ways. First of all, you can establish a 

code condition. As the name implies, this option allows you to

specify a method in your class that will be called by the activity in order to determine if it should

proceed. To inform the activity of this fact, the method specified will eventually need to return a

Boolean value (true to repeat, false to exit). 

The second way the Condition value can be set is by establishing a declarative rule condition.

This option can be useful in that you are able to specify a single code statement that evaluates to

true or false; however, this statement is not hard-coded in your assembly, but is instead offloaded

to a *.rules file. One benefit of this approach is that it makes it possible to modify rules in a declar-

ative manner.

Our condition will be based on some custom code that we have yet to author; however, the first

step is to select the Code Condition option from the Condition value, and then specify the name of

the method that will perform the test. Again using the Properties window, name this method

GetAndValidateUserName (see Figure 26-7).

As soon as you specify the name of the code condition used to test the While activity, the IDE

will generate a method stub where the second parameter is of type ConditionalEventArgs. This type

contains a property named Result, which can be set to true or false based on the success or failure

of the condition you are modeling. 

C H A P T E R   2 6  




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1762   1763   1764   1765   1766   1767   1768   1769   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish