Exemple #1
0
        private void PrepareEditForm(Sky sky, Star star)
        {
            Text         = "Редактирование звезды";
            bDel.Visible = true;
            this.sky     = sky;
            this.star    = star;

            // Настройка созвездий.
            cBoxCons.DataSource = sky.Constellations;
            cons = Filter.GetConstellationFromStar(star, sky);
            cBoxCons.SelectedIndex = sky.Constellations.IndexOf(cons);

            // Заполнение данными.
            tBoxName.Text       = star.Name;
            tBoxUrl.Text        = star.Url;
            cBoxUnit.DataSource = units;

            tBoxDist.Text = Editor.ToString(star.Distance);
            tBoxMagn.Text = Editor.ToString(star.Magnitude);

            EquatorialCS   equa = star.Location;
            VerticalCord   decl = equa.Declination;
            HorizontalCord RA   = equa.RightAscension;

            numDeclDegree.Value  = decl.Degrees;
            numDeclMinutes.Value = decl.Minutes;
            numDeclSeconds.Value = decl.Seconds;

            numRADegree.Value  = RA.Degrees / 15;
            numRAMinutes.Value = RA.Minutes;
            numRASeconds.Value = RA.Seconds;
        }
Exemple #2
0
 public Star(EquatorialCS location, string name,
             double magnitude, double distance, string url = "")
 {
     Location  = location;
     Name      = name;
     Url       = url;
     Magnitude = magnitude;
     Distance  = distance;
 }
Exemple #3
0
        private void SaveData()
        {
            string name = tBoxName.Text;


            if (!ValidateName(name) || !IsAllFieldsFilled())
            {
                return;
            }

            double distance = GetDistance();
            double magn     = Editor.ToDouble(tBoxMagn.Text);
            string url      = tBoxUrl.Text;

            VerticalCord   vert = GetDeclination();
            HorizontalCord hor  = GetRightAscension();
            EquatorialCS   equa = new EquatorialCS(vert, hor);

            if (isAddForm)
            {
                Star star = new Star(equa, name, magn, distance, url);
                cons.Stars.Add(star);
            }
            else
            {
                star.Name      = name;
                star.Distance  = distance;
                star.Magnitude = magn;
                star.Location  = equa;
                star.Url       = url;

                Constellation old = Filter.GetConstellationFromStar(star, sky);
                if (!cons.Equals(old))
                {
                    cons.Stars.Add(star);
                    old.Stars.Remove(star);
                }
            }
            DialogResult = DialogResult.OK;
            Close();
        }
Exemple #4
0
 public Star()
 {
     Location  = new EquatorialCS();
     Magnitude = 0;
     Distance  = 10;
 }