Tham khảo tài liệu 'microsoft press windows workflow foundation step by step phần 7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 10 Event Activities 215 Figure 10-2 Adding a new watched stock Selecting a symbol in the ticker symbol list enables the Remove button. Clicking the Remove button removes the item from the watched stock list. The removal action is shown in Figure 10-3. The stocks you are monitoring are stored in the application s Settings file in XML form . The next time you execute eBroker it will remember your stocks and begin checking anew. Figure 10-3 Removing an existing watched stock In Figure 10-2 you see that the application needs to know how many shares you currently have so that it can calculate the total value of the shares you own. These figures are used to calculate the current market value. If you later want to adjust the number of shares by buying and selling stock select the stock in the market value list and click either Buy or Sell The dialog box you see in Figure 10-4 will request the number of shares you want to buy or sell and the workflow will be notified. Figure 10-4 Dialog box requesting number of shares to buy or sell The Add dialog box in Figure 10-2 also requests buy and sell trigger amounts. The workflow contains business logic that uses these values to notify you when not you should buy or sell shares in any of the companies you are currently monitoring. If the stock price exceeds the sell trigger value a red flag is displayed in the market list. If the stock price drops below the buy trigger value a green flag appears. You can buy and sell shares at any flags are just visual indicators. You see a couple of flags in Figure 10-5. 216 Part II Working with Activities Figure 10-5 The eBroker user interface indicating buy sell recommendations Note DO NOT think for a microsecond that the simulation I ve provided here in any way truly simulates any stock market or company on the planet. The simulation is completely fabricated for demonstration purposes only. Each of these four buttons Add Remove Buy and Sell fires an event to the workflow .