Exemple #1
0
        private void OnConfirm(object sender, EventArgs e)
        {
            if (sender is ConfirmationButton && (sender as ConfirmationButton) == m_cbtn_confirm)
            {
                LocationState new_spot = new LocationState(
                    (double)m_nud_old_distance.Value,
                    (double)((m_nud_old_azimuth.Value + 180) % 360) // Point the other way
                    );

                foreach (string team in m_teams)
                {
                    foreach (RenamableButton key in m_locations[team])
                    {
                        LocationState location = m_states[team][key];
                        if (!location.Default)
                        {
                            location.Assign(LocationState.CalculateVector(new_spot, location));
                        }
                    }
                    m_locations[team].First().ActiveButton().PerformClick();
                }

                m_nud_old_distance.Value = 1;
                m_nud_old_azimuth.Value  = 0;
            }
        }
Exemple #2
0
        private void OnTextBoxValueUpdate(object sender, EventArgs e)
        {
            OnLocationSave(sender, e);

            string team  = m_teams.First();
            string other = m_teams.Last();

            // Get friend location state
            RenamableButton key    = m_locations[team].First().ActiveButton();
            LocationState   friend = m_states[team][key];

            // Get target location state
            key = m_locations[other].First().ActiveButton();
            LocationState target = m_states[other][key];

            // run calculation
            LocationState result = LocationState.CalculateVector(friend, target);

            double distance = Math.Round(result.Distance, 1);

            Color result_text = (distance < 75 || distance > 150) ? (new ColorPalette.BasePalette()).Accent : Color.White;

            m_lbl_result_dist_value.ForeColor = m_lbl_result_azim_value.ForeColor = result_text;

            m_lbl_result_dist_value.Text = distance.ToString("F1");
            m_lbl_result_azim_value.Text = Math.Round(result.Azimuth, 1).ToString("F1");
        }