Пример #1
0
        bool Set(IScreen Screen)
        {
            var outputs = new Factory1()
                          .Adapters1
                          .SelectMany(M => M.Outputs
                                      .Select(N => N.QueryInterface <Output1>()));

            var match = outputs.FirstOrDefault(M =>
            {
                var r1 = M.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 DeskDuplItem(match, _previewWindow);

            return(true);
        }
Пример #2
0
        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);
        }
Пример #3
0
        static Output1 FindOutput(IScreen Screen)
        {
            var outputs = new Factory1()
                          .Adapters1
                          .SelectMany(M => M.Outputs);

            var match = outputs.FirstOrDefault(M =>
            {
                var r1 = M.Description.DesktopBounds;
                var r2 = Screen.Rectangle;

                return(r1.Left == r2.Left &&
                       r1.Right == r2.Right &&
                       r1.Top == r2.Top &&
                       r1.Bottom == r2.Bottom);
            });

            return(match?.QueryInterface <Output1>());
        }