コード例 #1
0
        public static void Energize(this UIElement source)
        {
            source.Hook();
            source.Measure(new Size(2560, 1440));
            source.Arrange(new Rect(source.DesiredSize));

            LightweigtTestsUtils.RunInNewDispathcerFrame(source, () => { });
        }
コード例 #2
0
        public static byte[] TakeSnapshot(this UIElement source, Size size)
        {
            if (source.Hook())
            {
                return(source.GetJpgImage(2));
            }

            source.Measure(size);
            source.Arrange(new Rect(size));

            byte[] snapshot = null;
            LightweigtTestsUtils.RunInNewDispathcerFrame(source, () =>
            {
                snapshot = source.GetJpgImage(2);
            });

            if (snapshot == null)
            {
                throw new Exception(":(");
            }
            return(snapshot);
        }