Hi telerik,
I'm automation an Silverlight app that invoke a dialogs that looks like windows dialog (see attach image)
So I used this code and it works but when it handle the second dialog, it just stop there and it doesn't click the OK button.
Please help me figure this out.
Thanks
I'm automation an Silverlight app that invoke a dialogs that looks like windows dialog (see attach image)
So I used this code and it works but when it handle the second dialog, it just stop there and it doesn't click the OK button.
Please help me figure this out.
Thanks
try
{
Button btnRemoveDashboard = GlobalObject.SILVERLIGHTAPP.Find.ByName<Button>(
"btnRemoveDashboard"
);
GlobalObject.MANAGER.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
GenericDialog altDlg =
new
GenericDialog(SM2Utilities.GlobalObject.BROWSER,
"Close"
+ strDBName,
true
,
"OK"
,
"Are you sure you want to remove this dashboard and all of its panels?"
);
altDlg.HandlerDelegate = MyCustomAlertHandler;
altDlg.DismissButton = DialogButton.OK;
GlobalObject.MANAGER.DialogMonitor.AddDialog(altDlg);
GlobalObject.MANAGER.DialogMonitor.Start();
btnRemoveDashboard.User.Click();
altDlg.WaitUntilHandled(5000);
GlobalObject.MANAGER.DialogMonitor.RemoveDialog(altDlg);
GlobalObject.MANAGER.DialogMonitor.Stop();
GlobalObject.MANAGER.Dispose();
}
catch
(Exception)
{
}
public
static
void
MyCustomAlertHandler(IDialog dialog)
{
Window okButton = WindowManager.FindWindowRecursively(dialog.Window.Handle,
"OK"
,
false
, 0);
GlobalObject.MANAGER.Desktop.Mouse.Click(MouseClickType.LeftClick, okButton.Rectangle);
dialog.HandleCount++;
}