[SOLVED] Use Automation Workflow Assembly on WebHostedApplication with CustomAdapter

Apr 6, 2013 at 1:14 PM
Hi everybody,

we are using a custom adpater in an WebHostedControl to gain control over the embedded browser instance.

Everything is working fine so far but we are facing some troubles when it comes to the execution of Actions on the WebHostedControl which are using WorkflowAssemblies for Automation.

In short, the Automations arent executed by our CustomAdapter which makes sense because it isnt a AutomationAdapter.

Does anybody have a solution for that? How can we use a CustomAdapter but keep the ability to execute Workflow Assemblies that are associated to an UII Action.

Any help is highly appriciated

Thx in advance

niklas
Apr 7, 2013 at 7:11 PM
Hello Niklas,

I use that all the time and it works,

Maybe something wrong with your configuration? In the adapter configuration section of the UII Hosted App, what did you choose?, if your choose use adapter and pointed to your DLLs then that's the problem. you need to leave that with HAT, the point where you tell UII to use your DLL is in the AutomationXML of the Automation Bindings, in the <Type> of the DataDrivenAdapterBindings.
Apr 8, 2013 at 9:49 AM
Edited Apr 8, 2013 at 10:17 AM
Hey Dtriana,

thanks for pointing us in the right direction! In fact, this seems to be our error but trying to bind out CustomAdapter (WebApplicationAdapter) by using the AutomationXML leads to an DDA Exception:
Microsoft.Uii.HostedApplicationToolkit.DataDrivenAdapter.DataDrivenAdapterException: DDA0107: Unable to instantiate specified Data Driven Adapter type. 
---> Microsoft.Uii.Common.TypeProvider.TypeProviderException: TPV011: Unable to create instance. 
---> __System.MissingMethodException: Der Konstruktor für den Typ "KnowledgebaseAdapter.WebAdapter" wurde nicht gefunden.__
It seems, that our Adapter needs a special Constructor - so far we only provide a default Constructor. Do you have any information on that issue?
We need to derive from WebApplicationAdapter because we need the OnNewWindow Event.

thanks

niklas
Apr 8, 2013 at 5:02 PM
Hello Niklas,

The adapter I use derive from WebDataDrivenAdapter , I haven't needed the event you mention, I'm subscribed to DocumentCompleted, however I just checked and it offers NewWindow and BeforeNewWindow so I think it can work for you.

Use the code from C:...\Microsoft Uii\Quickstarts\Hat\QsDataDrivenAdapterExt\WebDDAExt.cs

Then in the constructor cast the appObject to a WebBrowserExtended from Microsoft.Uii.Csr.Browser.Web, then subscribe to the event or events you need.

something like this:
public class WebAdapter : WebDataDrivenAdapter
    {
        public WebBrowserExtended Browser;
        public WebAdapter(XmlDocument appInitString, object appObject)
            : base(appInitString, appObject)
        {
                this.Browser = appObject as WebBrowserExtended;
                if (this.Browser != null)
                {
                    this.Browser.DocumentComplete += new EventHandler<DocumentCompleteEventArgs>(Browser_DocumentComplete);
                }
        }
Apr 9, 2013 at 8:34 AM
Edited Apr 9, 2013 at 8:40 AM
Hello Dtriana,

thanks again for your time, your support is outstanding.

This solution leads in the right direction. And there is the NewWindow event on the Browser object.

The WebApplicationAdapter offers a OnNewWindow event where one can control whether or not the new window should raise normally. We use this to redirect popups into a new Tab inside of the AgentDesktop and then supress the original popup.
public override bool OnNewWindow(string newUrlString, string fromUrlString, long flags)
{
   ...
}
The WebDataDrivenAdapter doesnt offer that event, and within the OnNewWindow3 event on the Browser object you dont have the option to supress the original popup - or am i missing somethin here?

Anyway, we now have a deeper understanding of the whole topic and i think we can handle the situation of not having the automation-support in this particular case.

regards

niklas