示例#1
0
        /// <summary>
        /// Retrieve the page ranges.
        /// </summary>
        public CefPageRange[] GetPageRanges()
        {
            var count = GetPageRangesCount();

            if (count == 0)
            {
                return(new CefPageRange[0]);
            }

            var     n_ranges = new cef_page_range_t[count];
            UIntPtr n_count  = (UIntPtr)count;

            fixed(cef_page_range_t *n_ranges_ptr = n_ranges)
            {
                cef_print_settings_t.get_page_ranges(_self, &n_count, n_ranges_ptr);
            }

            count = (int)n_count;
            if (count == 0)
            {
                return(new CefPageRange[0]);
            }

            var ranges = new CefPageRange[count];

            for (var i = 0; i < count; i++)
            {
                ranges[i].From = n_ranges[i].from;
                ranges[i].To   = n_ranges[i].to;
            }

            return(ranges);
        }
示例#2
0
        /// <summary>
        /// Set the page ranges.
        /// </summary>
        public void SetPageRanges(CefPageRange[] ranges)
        {
            var count    = ranges != null ? ranges.Length : 0;
            var n_ranges = new cef_page_range_t[count];

            for (var i = 0; i < count; i++)
            {
                n_ranges[i].from = ranges[i].From;
                n_ranges[i].to   = ranges[i].To;
            }

            fixed(cef_page_range_t *n_ranges_ptr = n_ranges)
            {
                cef_print_settings_t.set_page_ranges(_self, (UIntPtr)count, n_ranges_ptr);
            }
        }