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); }
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; } }