Beispiel #1
0
        private void OkEditEgdeButton_Click(object sender, EventArgs e)
        {
            if (nameStreetComboBox.SelectedItem == null)
            {
                MessageBox.Show("Выберите название улицы");
                return;
            }
            else if (coatingComboBox.SelectedItem == null)
            {
                MessageBox.Show("Выберите покрытие");
                return;
            }
            else
            {
                bool isPolice = policemanCheckBox.Checked;

                if (isPolice)
                {
                    if (policemanComboBox.SelectedItem == null)
                    {
                        MessageBox.Show("Выберите полицейского");
                        return;
                    }
                }

                bool isSignMaxSpeed = signMaxSpeedCheckBox.Checked;

                if (isSignMaxSpeed)
                {
                    if (signMaxSpeedComboBox.SelectedItem == null)
                    {
                        MessageBox.Show("Выберите знак");
                        return;
                    }
                }

                if (isPolice)
                {
                    Edge.Policemen = Police.CreatePolice(policemanComboBox.SelectedItem.ToString());
                }
                else
                {
                    Edge.Policemen = null;
                }

                if (isSignMaxSpeed)
                {
                    List <object> sign = Sign.ListSigns.First(sg => int.Parse(sg[0].ToString()) == int.Parse(signMaxSpeedComboBox.SelectedItem.ToString()));
                    Edge.SignMaxSpeed = Sign.CreateSign(int.Parse(sign[0].ToString()));
                }
                else
                {
                    Edge.SignMaxSpeed = null;
                }

                Edge.NameStreet = nameStreetComboBox.SelectedItem.ToString();

                List <object> coat = Coating.ListSurface.First(coating => coating[0].ToString().Equals(coatingComboBox.SelectedItem.ToString()));
                Edge.Coat = Coating.CreateCoating(coat[0].ToString(), double.Parse(coat[1].ToString()));

                Edge.IsBilateral = !signOneWayCheckBox.Checked;
            }

            DialogResult = DialogResult.OK;
            MakeMap.ViewPort.Invalidate();
            Close();
        }