How can I use a generic PopUpWatcher which should close Form1 (ButtonClick on "BtnOK"), if the Form1 occurs in any recording. So I have added the PopUpWatcher() in Program.cs
Code: Select all
class Program
{
[STAThread]
public static int Main(string[] args)
{
...
PopupWatcher myPopupWatcher = new PopupWatcher();
myPopupWatcher.WatchAndClick(MyRepository1.Instance.Form1, MyRepository1.Instance.Form1.BtnOK);
// Start PopupWatcher
myPopupWatcher.Start();
...
But it does not work. It works very well if I put the code in every single Recording.UserCode.cs.
How can I use PopUpWatcher for every recordings in the solution, if during execution the Form1 appears?
Many Thanks! Best Regards