private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxVolumeOne.Text) <= 0 ||
                    Convert.ToDecimal(TextBoxSlipage.Text) <= 0 ||
                    Convert.ToInt32(TextBoxheightSoldiers.Text) <= 0 ||
                    Convert.ToInt32(TextBoxprocHeightTake.Text) <= 0 ||
                    Convert.ToInt32(TextBoxprocHeightStop.Text) <= 0)
                {
                    throw new Exception("");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("В одном из полей недопустимые значения. Процесс сохранения прерван");
                return;
            }
            Enum.TryParse(ComboBoxRegime.Text, true, out _strategy.Regime);
            _strategy.Slipage          = Convert.ToDecimal(TextBoxSlipage.Text);
            _strategy.VolumeFix        = Convert.ToInt32(TextBoxVolumeOne.Text);
            _strategy.HeightSoldiers   = Convert.ToInt32(TextBoxheightSoldiers.Text);
            _strategy.MinHeightSoldier = Convert.ToInt32(TextBoxminHeightSoldier.Text);
            _strategy.ProcHeightTake   = Convert.ToInt32(TextBoxprocHeightTake.Text);
            _strategy.ProcHeightStop   = Convert.ToInt32(TextBoxprocHeightStop.Text);

            _strategy.Save();
            Close();
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToDecimal(TextBoxVolumeOne.Text) <= 0 ||
                    Convert.ToDecimal(TextBoxSlipage.Text) <= 0 ||
                    Convert.ToInt32(TextBoxheightSoldiers.Text) <= 0 ||
                    Convert.ToInt32(TextBoxprocHeightTake.Text) <= 0 ||
                    Convert.ToInt32(TextBoxprocHeightStop.Text) <= 0)
                {
                    throw new Exception("");
                }
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }
            Enum.TryParse(ComboBoxRegime.Text, true, out _strategy.Regime);
            _strategy.Slipage          = Convert.ToDecimal(TextBoxSlipage.Text);
            _strategy.VolumeFix        = Convert.ToDecimal(TextBoxVolumeOne.Text);
            _strategy.HeightSoldiers   = Convert.ToInt32(TextBoxheightSoldiers.Text);
            _strategy.MinHeightSoldier = Convert.ToInt32(TextBoxminHeightSoldier.Text);
            _strategy.ProcHeightTake   = Convert.ToInt32(TextBoxprocHeightTake.Text);
            _strategy.ProcHeightStop   = Convert.ToInt32(TextBoxprocHeightStop.Text);

            _strategy.Save();
            Close();
        }