private bool Set(IScreen screen) { var outputs = new Factory1() .Adapters1 .SelectMany(adapter1 => adapter1.Outputs .Select(output => output.QueryInterface <Output1>())); var match = outputs.FirstOrDefault(output1 => { var r1 = output1.Description.DesktopBounds; var r2 = screen.Rectangle; return(r1.Left == r2.Left && r1.Right == r2.Right && r1.Top == r2.Top && r1.Bottom == r2.Bottom); }); if (match == null) { return(false); } Source = new DesktopDuplicationItem(match); return(true); }
private bool SelectFirst() { var output = new Factory1() .Adapters1 .SelectMany(adapter1 => adapter1.Outputs .Select(output1 => output1.QueryInterface <Output1>())) .FirstOrDefault(); if (output == null) { return(false); } Source = new DesktopDuplicationItem(output); return(true); }