private void targetFrameBox_ValueChanged(object sender, EventArgs e) { frameDifference = targetFrameBox.Value - startingFrameBox.Value; //warn user if they select an exorbitantly high frame if (gen7RadioButton.Checked == false) { if (frameDifference >= 100000000 && wasExecuted == false) { popupWindow popupWindow = new popupWindow(); popupWindow.ShowDialog(); wasExecuted = true; } } else if (gen7RadioButton.Checked == true) { if (frameDifference >= 99999028 && wasExecuted == false) { popupWindow popupWindow = new popupWindow(); popupWindow.ShowDialog(); wasExecuted = true; } } }
public void calculateButton_Click(object sender, EventArgs e) { starter = (int)startingFrameBox.Value; target = (int)targetFrameBox.Value; //turn frame difference into time for gen 6 use g6SecondsFraction = (int)targetFrameBox.Value - (int)startingFrameBox.Value / 120; g6Seconds = (int)Math.Ceiling((decimal)g6SecondsFraction); while (g6Seconds >= 60) { g6Minutes += 1; g6Seconds -= 60; } while (g6Minutes >= 60) { g6Hours += 1; g6Minutes -= 60; } while (g6Hours >= 24) { g6Days += 1; g6Hours -= 24; } void frames(ref int starter, ref decimal target) { Calculator.startingFrame = starter; Calculator.targetFrame = target; } if (targetFrameBox.Value < startingFrameBox.Value) { //failsafe popupWindow targetFrameLowerError = new popupWindow(); targetFrameLowerError.ShowDialog(); } else { if (gen6RadioButton.Checked == true) { //more failsafes, inserted here in specific as it only applies to gen 6 if (targetFrameBox.Value % 2 == 1 && startingFrameBox.Value % 2 == 0) { popupWindow popupWindow2 = new popupWindow(); popupWindow2.ShowDialog(); } else if (targetFrameBox.Value % 2 == 0 && startingFrameBox.Value % 2 == 1) { popupWindow popupWindow3 = new popupWindow(); popupWindow3.ShowDialog(); } else if (g6Seconds > 0 && g6Minutes == 0 && g6Hours == 0 && g6Days == 0) { timeOutputBox.Text = "You will hit your target frame in: /n {0} seconds." + g6Seconds; } else if (g6Hours == 0 && g6Minutes > 0) { timeOutputBox.Text = "You will hit your target frame in: /n {0} minutes and {1} seconds." + g6Minutes + g6Seconds; } else if (g6Days == 0 && g6Hours > 0) { timeOutputBox.Text = "You will hit your target frame in: /n {0} hours, {1} minutes, and {2} seconds." + g6Hours + g6Minutes + g6Seconds; } else { timeOutputBox.Text = "You will hit your target frame in: /n {0} days, {1} hours, {2} minutes, amd {3} seconds" + g6Days + g6Hours + g6Minutes + g6Seconds; } } else if (gen7RadioButton.Checked == true) { timeOutputBox.Text = "You will hit your target frame in: /n {0}" + gen7Result; } } }