Пример #1
0
        public MonitorTimings GetMonitorTimings()
        {
            var hor = new ExpandedTimingsPart();

            hor.visible    = (UInt16)numHorVisible.Value;
            hor.border     = (UInt16)numHorBorder.Value;
            hor.frontPorch = (UInt16)numHorFrontPorch.Value;
            hor.syncWidth  = (UInt16)numHorSyncWidth.Value;
            hor.backPorch  = (UInt16)numHorBackPorch.Value;
            hor.blanking   = (UInt16)numHorBlanking.Value;
            hor.total      = (UInt16)numHorTotal.Value;
            var ver = new ExpandedTimingsPart();

            ver.visible    = (UInt16)numVerVisible.Value;
            ver.border     = (UInt16)numVerBorder.Value;
            ver.frontPorch = (UInt16)numVerFrontPorch.Value;
            ver.syncWidth  = (UInt16)numVerSyncWidth.Value;
            ver.backPorch  = (UInt16)numVerBackPorch.Value;
            ver.blanking   = (UInt16)numVerBlanking.Value;
            ver.total      = (UInt16)numVerTotal.Value;

            var dst = new MonitorTimings();

            dst.frequency = (UInt16)(numActualClock.Value * 100);
            dst.hor       = hor.ToTimingsPart();
            dst.ver       = ver.ToTimingsPart();
            return(dst);
        }
Пример #2
0
        public static ResourceTiming FromMonitorTimings(MonitorTimings tims)
        {
            var dst = new ResourceTiming();
            var hor = ExpandedTimingsPart.CreateFromTimingsPart(tims.hor);
            var ver = ExpandedTimingsPart.CreateFromTimingsPart(tims.ver);

            dst.freq10sKhz    = tims.frequency;
            dst.horActive     = hor.visible;
            dst.horBorder     = hor.border;
            dst.horFrontPorch = hor.frontPorch;
            dst.horSyncPixels = hor.syncWidth;
            dst.horTotal      = hor.total;

            dst.verActive     = ver.visible;
            dst.verBorder     = ver.border;
            dst.verFrontPorch = ver.frontPorch;
            dst.verSyncLines  = ver.syncWidth;
            dst.verTotal      = ver.total;

            if (tims.frequency != 0 && hor.total != 0 && ver.total != 0)
            {
                var frequency = (decimal)(tims.frequency) / 100;
                var refresh   = (frequency * 1000000) / (hor.total * ver.total);
                dst.refreshRateHz = (UInt16)Math.Round(refresh);
            }

            return(dst);
        }
Пример #3
0
        public static ExpandedTimingsPart CreateFromTimingsPart(TimingsPart src)
        {
            ExpandedTimingsPart dst = new ExpandedTimingsPart();

            dst.FromTimingsPart(src);
            return(dst);
        }
Пример #4
0
 public void ApplyVerTimings(ExpandedTimingsPart ver)
 {
     suppressValueChangedEvent = true;
     try
     {
         numVerVisible.Value    = ver.visible;
         numVerBorder.Value     = ver.border;
         numVerFrontPorch.Value = ver.frontPorch;
         numVerSyncWidth.Value  = ver.syncWidth;
         numVerBackPorch.Value  = ver.backPorch;
         numVerBlanking.Value   = ver.blanking;
         numVerTotal.Value      = ver.total;
     }
     finally { suppressValueChangedEvent = false; }
 }
Пример #5
0
        public void ApplyMonitorTimings(MonitorTimings all)
        {
            var frequency  = (decimal)(all.frequency) / 100;
            var hor        = ExpandedTimingsPart.CreateFromTimingsPart(all.hor);
            var ver        = ExpandedTimingsPart.CreateFromTimingsPart(all.ver);
            var horizontal = (frequency * 1000) / hor.total;
            var refresh    = (frequency * 1000000) / (hor.total * ver.total);

            suppressValueChangedEvent = true;
            try
            {
                numWantedClock.Value   = numActualClock.Value = frequency;
                numWantedHoriz.Value   = numActualHoriz.Value = horizontal;
                numWantedRefresh.Value = numActualRefresh.Value = refresh;

                ApplyHorTimings(hor);
                ApplyVerTimings(ver);
            }
            finally { suppressValueChangedEvent = false; }
        }