canopy icon indicating copy to clipboard operation
canopy copied to clipboard

pinToMonitor is still mentioned in documentation even though it is no longer supported in code.

Open avargaslopez24 opened this issue 7 years ago • 5 comments

I don't know if this was an intentional reversion or not, but pinToMonitor is no longer defined in the source code. It does still show up on the website documentation however.

avargaslopez24 avatar Nov 15 '18 15:11 avargaslopez24

Good find. Looking at the old code I think I can add it back, but if you tell it to pin to a monitor that does not exist it will move the browser off the screen and it will be lost.

It depended on a function to get monitor count that does not exist in .net core 2.

lefthandedgoat avatar Nov 15 '18 16:11 lefthandedgoat

Looking at the code, a workaround may be just make it a user defined value rather than a function call. Something along the lines of forcing users to set a canopy.screenmonitorCount value of non 1 before calling pintoMonitor?

Otherwise it's not a huge deal since I believe most users are running their UI tests headless making this a minor inconvenience.

avargaslopez24 avatar Nov 15 '18 16:11 avargaslopez24

ah yes I could check that.

lefthandedgoat avatar Nov 15 '18 16:11 lefthandedgoat

Any update on this? pinToMonitor is still in the documentation but not defined. Will .NET Core 3.0 support this?

olivercoad avatar May 02 '19 10:05 olivercoad

@olivercoad

let pinToMonitor n =
    let n' = if n < 1 then 1 else n
    if System.Windows.Forms.SystemInformation.MonitorCount >= n' then
        let workingArea = System.Windows.Forms.Screen.AllScreens.[n'-1].WorkingArea
        browser.Manage().Window.Position <- new System.Drawing.Point(workingArea.X, 0)
        browser.Manage().Window.Maximize()

That is the old code. I dont know if System.Windows.Forms.SystemInformation.MonitorCount is in .net Core 3.0 or System.Windows.Forms.Screen.AllScreens

For now I will remove from documentation

lefthandedgoat avatar May 03 '19 03:05 lefthandedgoat