I can achieve this like so:
Code: Select all
public static void Screenshotting_1()
{
Image newimg = Ranorex.Imaging.CaptureImage(myrepo.repoItem.Self);
newimg.Save(filepathandname, System.Drawing.Imaging.ImageFormat.Jpeg);
}
Now I want to take 100 screenshots of 100 different repo items, so I want to pass in the repo item to one method, rather than write 100 methods. So I have tried this, pieced together from various forum posts:
Code: Select all
public static void Screenshotting_2(RepoItemInfo item_in)
{
Ranorex.Unknown itemAdapter = item_in.CreateAdapters<Ranorex.Unknown>();
Image newimg = Ranorex.Imaging.CaptureImage(itemAdapter);
newimg.Save(filepathandname, System.Drawing.Imaging.ImageFormat.Jpeg);
}
Cannot implicitly convert type 'System.Collections.Generic.IList<Ranorex.Unknown>' to 'Ranorex.Unknown'. An explicit conversion exists (are you missing a cast?) (CS0266)
I guess I am missing a cast, but am past the limit of my coding ability. Can anyone help?