Example #1
0
        private void accept_Click(object sender, RoutedEventArgs e)
        {
            Stars star = new WPF_Material_Design.Source.Stars();

            decimal?weight;
            decimal?radius;

            decimal?apparent_Star_Magnitude;
            decimal?star_Luminosity;


            try
            {
                weight = Convert.ToDecimal(Weight.Text);
            }

            catch (Exception ex)
            {
                Weight.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                radius = Convert.ToDecimal(Radius.Text);
            }

            catch (Exception ex)
            {
                Radius.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                apparent_Star_Magnitude = Convert.ToDecimal(Apparent_Star_Magnitude.Text);
            }

            catch (Exception ex)
            {
                Apparent_Star_Magnitude.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                star_Luminosity = Convert.ToDecimal(Star_Luminosity.Text);
            }

            catch (Exception ex)
            {
                Star_Luminosity.Clear();

                MessageBox.Show("Введите заново");
                return;
            }


            if (new_star)
            {
                star.Create(Name.Text, Constellatoin.Text, Declination.Text, Right_Ascension.Text, weight, radius, apparent_Star_Magnitude, star_Luminosity, Star_Type.Text, Info.Text);
                Stars.Add(star);
            }
            else
            {
                this.star.Create(Name.Text, Constellatoin.Text, Declination.Text, Right_Ascension.Text, weight, radius, apparent_Star_Magnitude, star_Luminosity, Star_Type.Text, Info.Text);
            }

            Close();
        }
Example #2
0
        private void accept_Click(object sender, RoutedEventArgs e)
        {
            NGCObjects NGCObject = new WPF_Material_Design.Source.NGCObjects();

            decimal?apparent_Star_Magnitude;
            decimal?redshift;

            ulong?distance;


            try
            {
                apparent_Star_Magnitude = Convert.ToDecimal(Apparent_Star_Magnitude.Text);
            }

            catch (Exception ex)
            {
                Apparent_Star_Magnitude.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                redshift = Convert.ToDecimal(Redshift.Text);
            }

            catch (Exception ex)
            {
                Redshift.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                distance = Convert.ToUInt64(Distance.Text);
            }

            catch (Exception ex)
            {
                Distance.Clear();

                MessageBox.Show("Введите заново");
                return;
            }


            if (new_NGCObject)
            {
                NGCObject.Create(Name.Text, Constellatoin.Text, Declination.Text, Right_Ascension.Text, apparent_Star_Magnitude, redshift, distance, Type.Text, Info.Text);
                NGCObjects.Add(NGCObject);
            }
            else
            {
                this.NGCObject.Create(Name.Text, Constellatoin.Text, Declination.Text, Right_Ascension.Text, apparent_Star_Magnitude, redshift, distance, Type.Text, Info.Text);
            }

            Close();
        }