Welcome to MSDN Blogs Sign in | Join | Help

The Hosted Application Toolkit (HAT) is a non-intrusive automation framework. With HAT, legacy systems (or not !) can be automated at the User Interface level without modifying the application itself. The different components are represented in the diagram below :

image

HAT Software Factory enables to visually inspect a legacy application right within Visual Studio and to build automation leveraging Windows Workflow Foundation.

Data-Driven Adapters (DDA) are specific to a particular application type and handle the interaction between the automation and the user interface. CCF 2009 provides DDAs for Windows, Web and Java applications. DDAs can also be extended and new DDAs can be developed by third party. This is the purpose of this post.

Let's assume we want to listen to a custom event "TextChanged" on the TextBox of a Calculator. First, extend the WinDataDrivenAdapter class and identify when this event is occurring:

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Text;
   4: using Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter;
   5: using System.Collections.ObjectModel;
   6:  
   7: namespace ExtendedDDA
   8: {
   9:     public class ExtendedWinDDA : WinDataDrivenAdapter
  10:     {
  11:         const string EventNameTextChanged = "TextChanged";
  12:  
  13:         public ExtendedWinDDA(System.Xml.XmlDocument initStr, object appObj)
  14:             : base(initStr, appObj)
  15:         {
  16:             this.AccEventListener.AccEventOccurred += new EventHandler<Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter.AccEventArgs>(AccEventListener_AccEventOccurred);
  17:         }
  18:  
  19:         public override ReadOnlyCollection<string> GetAvailableApplicationEvents()
  20:         {
  21:             return base.GetAvailableApplicationEvents();
  22:         }
  23:  
  24:         public override ReadOnlyCollection<string> GetAvailableControlEvents()
  25:         {
  26:             ReadOnlyCollection<string> baseColl = base.GetAvailableControlEvents();
  27:             string[] coll = new string[baseColl.Count + 1];
  28:             coll[0] = EventNameTextChanged;
  29:             baseColl.CopyTo(coll, 1);
  30:             return new ReadOnlyCollection<string>(coll);
  31:         }
  32:  
  33:         void AccEventListener_AccEventOccurred(object sender, Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter.AccEventArgs e)
  34:         {
  35:  
  36:             if (e.WinEvent == "EVENT_OBJECT_VALUECHANGE")
  37:             {
  38:                 System.Diagnostics.Trace.WriteLine("************* AccEventOccurred - RAISED ON TEXT CHANGED **************");
  39:  
  40:                 // Get the control name
  41:                 string strControlName = KnownControls.GetControlName(e.AutomationId);
  42:  
  43:                 // for the given control raise the "TextChanged" event
  44:                 base.RaiseEvent(sender, EventNameTextChanged, strControlName, e.Value);
  45:             }
  46:         }
  47:  
  48:         public override bool RegisterEventListener(string eventName, string controlName, EventHandler<ControlChangedEventArgs> listenerCallback)
  49:         {
  50:             bool isSuccessful = false;
  51:  
  52:             switch (eventName)
  53:             {
  54:                 case "TextChanged":
  55:                     isSuccessful = base.RegisterEventListenerBase(eventName, controlName, listenerCallback);
  56:                     if (isSuccessful)
  57:                     {
  58:                         this.StartAccEventListenerIfNecessary();
  59:                         if (((controlName != null) && !this.KnownControls.IsKnown(controlName)) && !this.OperationHandler(OperationType.FindControl, controlName, null).Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase))
  60:                         {
  61:                             throw new DataDrivenAdapterException("DDA0400: Unable to find control on the user interface.");
  62:                         }
  63:                     }
  64:                     return isSuccessful;
  65:             }
  66:             base.RegisterEventListener(eventName, controlName, listenerCallback);
  67:             return isSuccessful;
  68:         }
  69:     }
  70: }


Declare the Calculator application in the CCF Administration console, update its application definition (initstring) and specify which DDA needs to be exercised on the UI (in this sample, the DDA is deployed in the root directory of the CCF integrated desktop):

   1: <initstring>
   2:   <showmenu />
   3:   <interopAssembly>
   4:     <URL>%WINDIR%\System32\calc.exe</URL>
   5:     <WorkingDirectory></WorkingDirectory>
   6:     <hostInside />
   7:   </interopAssembly>
   8:   <adapter>
   9:     <URL>Microsoft.Ccf.HostedApplicationToolkit.AutomationHosting</URL>
  10:     <type>Microsoft.Ccf.HostedApplicationToolkit.AutomationHosting.AutomationAdapter</type>
  11:   </adapter>
  12:   <DataDrivenAdapterBindings>
  13:     <Type>ExtendedDDAs.ExtendedWinDDA, ExtendedDDAs</Type>
  14:     <Controls>
  15:       <AccControl name="TextBox" type="editable text">
  16:   <Path>
  17:     <FindWindow>
  18:       <Find>
  19:         <Class>Edit</Class>
  20:       </Find>
  21:     </FindWindow>
  22:   </Path>
  23: </AccControl>
  24:     </Controls>
  25:   </DataDrivenAdapterBindings>
  26:   <displayGroup>MainPanel</displayGroup>
  27:   <optimumSize x="0" y="0" />
  28:   <minimumSize x="0" y="0" />
  29: </initstring> 

Design an automation and listen to the newly created "TextChanged" event using the RegisterActionForEvent HAT activity:

image 

Configure the Automation in the Administration Console and you are done !

1 Comments
Filed under: ,

Competitive pressures force companies providing customer care - such as banks, insurance and utilities companies, healthcare providers, and telecommunications firms - to constantly improve their sales, marketing, and service operations, both in terms of efficiency and quality of service. Companies that deliver excellent customer care at less cost hold a tremendous advantage over their competitors. At the same time, companies struggle to reduce costs and increase service quality and availability by allowing a strong use of self service channels, to be delivered across a wide spectrum of devices and technologies. In order to maintain an optimal customer experience in those scenarios, one must struggle to maintain a seamless experience among all the customer interaction channels, so that customers will have:

  1. Choice of Channel, either self assisted or operator assisted, on the device and technology that better suits them at that moment
  2. Consistency of Information, so that each process taken from a different channel will expose the same capability, avoiding the bad perception of a “limited” experience on some of the channels
  3. Continuity of Experience, so that it becomes possible to start a long running process in a channel and continue it on a different channel. This also implies the ability to divert a self assisted process to an operator for support and then return it to the customer for finalization.

Customer Care Framework 2009 (CCF 2009) is addressing these challenges by providing an end-to-end application infrastructure with the following core assets:

  • User Interface Composition: CCF enables the creation of composite applications with the Application Integration Framework (AIF)
  • Integration and Automation: CCF provides non-intrusive application integration and automation both on the front-end (UI automation of legacy systems) with the Hosted Application Toolkit (HAT) and back-end (service composition) with the Distributed Connectivity Services (DCS)
  • Multi-channel UI process development: CCF delivers the Multi-channel Engine (MCE) enabling the reuse of the same UI logic across different customer interaction channels
  • Distributed Architecture: CCF allows the creation of centrally managed  distributed components, reducing latency, infrastructure costs and enabling offline operations
  • Developer Agility: CCF empowers developers through software factories in order to reduce application development time while increasing quality and standardization
  • Security: CCF fully leverages modern standards (WS-*) for securing communications. CCF authorization model allows centrally managed role-based restriction at the UI level. CCF also provides E-SSO services to allow mapping of user identities across systems


Official site: http://www.microsoft.com/ccf

1 Comments
Filed under: , , , ,
 
Page view tracker