/* * All controls are calculated from cm/360 so: * -> Calculate cm/360 from the _changed_ control * -> Check active control to prevent infinite loop * -> Update all other controls using the cm/360 value * * m_yaw, mouse dpi, and pubg fov are essenitally constants only changed by the user */ private void UpdateAllNumBoxes(decimal cm) { // Constant short hands decimal dpi = NumBoxDPI.Value; decimal yaw = NumBoxSourceYaw.Value; decimal pfov = NumBoxPubgFov.Value; try { // Overwatch if (NumBoxOWSense != ActiveControl) { NumBoxOWSense.Value = Overwatch.SenseFromCm(cm, dpi); } // Source if (NumBoxSourceSense != ActiveControl) { NumBoxSourceSense.Value = Quake.SenseFromCm(cm, dpi, yaw); } // PUBG if (NumBoxPubgSense != ActiveControl) { NumBoxPubgSense.Value = PUBG.SenseFromCm(cm, dpi, pfov); } // PUBG (Converted) if (NumBoxPubgConv != ActiveControl) { NumBoxPubgConv.Value = PUBG.ConvFromCm(cm, dpi, pfov); } // Measurements if (NumBoxCmPer360 != ActiveControl) { NumBoxCmPer360.Value = cm; } if (NumBoxInPer360 != ActiveControl) { NumBoxInPer360.Value = cm / 2.54M; } if (NumBoxDePerCm != ActiveControl) { NumBoxDePerCm.Value = 360 / cm; } if (NumBoxDePerIn != ActiveControl) { NumBoxDePerIn.Value = 914.4M / cm; } } catch (ArgumentOutOfRangeException) { MessageBox.Show( "Went out of range you pleblord.", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } }
private void NumBoxSourceYaw_ValueChanged(object sender, EventArgs e) { if (NumBoxSourceYaw != ActiveControl) { return; } decimal cm = Quake.CmFromSense( NumBoxSourceSense.Value, NumBoxDPI.Value, NumBoxSourceYaw.Value ); UpdateAllNumBoxes(cm); }