private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 6; i++)
            {
                Program.F1.chart1.Series[i].Points.Clear();
                Program.F1.chart1.Series[i].IsVisibleInLegend = false;
            }

            //if (radioButton2.Checked) Program.F1.GetMAssFromFile();

            Program.mas.Sort();
            if (checkBox7.Checked)
            {
                Program.masn = PowerLift.Correct(Program.mas.ToArray());
            }
            else
            {
                Program.masn = Program.mas.ToArray();
            }

            if (checkBox1.Checked)
            {
                Program.F1.chart1.Series[0].IsVisibleInLegend = true;
            }
            if (checkBox2.Checked)
            {
                Program.F1.chart1.Series[1].IsVisibleInLegend = true;
            }
            if (checkBox3.Checked)
            {
                Program.F1.chart1.Series[2].IsVisibleInLegend = true;
            }
            if (checkBox4.Checked)
            {
                Program.F1.chart1.Series[3].IsVisibleInLegend = true;
            }
            if (checkBox5.Checked)
            {
                Program.F1.chart1.Series[4].IsVisibleInLegend = true;
            }
            if (checkBox6.Checked)
            {
                Program.F1.chart1.Series[5].IsVisibleInLegend = true;
            }

            if (radioButton4.Checked)
            {
                ShowAbsolete();
            }
            else
            {
                try { ShowOtn(); }
                catch { ShowAbsolete(); }
            }


            Program.F1.pictureBox1.Hide();

            this.Dispose();
        }
Пример #2
0
        private PowerLift GetNew()
        {
            double press1 = Convert.ToDouble(textBox1.Text),
                   sq1    = Convert.ToDouble(textBox3.Text),
                   l1     = Convert.ToDouble(textBox5.Text),
                   w      = Convert.ToDouble(textBox7.Text);
            int press2    = Convert.ToInt32(numericUpDown6.Value),
                sq2       = Convert.ToInt32(numericUpDown7.Value),
                l2        = Convert.ToInt32(numericUpDown8.Value);

            if (!checkBox1.Checked)
            {
                sq1 = sq2 = 0;
            }
            if (!checkBox2.Checked)
            {
                press1 = press2 = 0;
            }
            if (!checkBox3.Checked)
            {
                l1 = l2 = 0;
            }

            PowerLift res = new PowerLift(PM(sq1, sq2), PM(press1, press2), PM(l1, l2), w, GetTime());

            res.Tonnage = tonn;

            if (textBox13.Text.Length > 0)
            {
                s += $"| Комментарий: {textBox13.Text}";
            }
            res.Comment = new string(s.ToCharArray());

            return(res);
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Program.mas.Add(GetNew());

            PowerLift.PrintInFile(new StreamWriter(Program.filename), Program.mas.ToArray());
            s = "";
            listBox1.Items.Clear();
            this.Close();
        }
Пример #4
0
        private void button7_Click(object sender, EventArgs e)
        {
            PowerLift p = GetNew();
            string    s = p.ToString();

            if (listBox1.Items.Count > 0)
            {
                string ss = (string)listBox1.Items[0];
                if (ss.Contains("Date"))
                {
                    listBox1.Items.RemoveAt(0);
                }
            }
            listBox1.Items.Insert(0, s.Substring(0, s.IndexOf("Another")));
        }
Пример #5
0
        static void Main(string[] args)
        {
            //MakeDirectories.Make(1, 47);
            //PowerLift.Generate(30,3,2,2, true,false,false);
            PowerLift[] p = new PowerLift[3];
            p[0] = new PowerLift(10, 90, 30);
            p[1] = new PowerLift(20, 30, 40);
            p[2] = new PowerLift(10, 40, 50);

            PowerLift[] t = PowerLift.Correct(p);
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(t[i].Squat + " " + t[i].Press + " " + t[i].Lift);
            }

            Console.ReadKey();
        }
Пример #6
0
        private void button7_Click(object sender, EventArgs e)
        {
            GetMass();
            if (Program.mas.Count > 0)
            {
                Program.mas.Sort();
                Program.masn = PowerLift.Correct(Program.mas.ToArray());
                PowerLift p    = Program.masn.Last();
                string    text = $"Присед = {p.Squat};  жим = {p.Press};  тяга = {p.Lift};  последний вес = {p.Weight}.{Environment.NewLine}Последняя тренировка: \t{p.Time.Date.ToString().Substring(0, 10)}."
                                 + Environment.NewLine + $"Всего тренировок: \t{Program.masn.Length}"
                                 + Environment.NewLine + $"Сумма = {p.Sum}, процентное соотношение присед-жим-тяга от суммы:  {p.SquatPercent}-{p.PressPercent}-{p.LiftPercent}."
                                 + Environment.NewLine + $"Отношение приседа/жима/тяги к собственному весу:  {p.SquatWeight}/{p.PressWeight}/{p.LiftWeight}.";

                /*Flexible*/ MessageBox.Show(text, "Максимальные результаты по дневнику", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Невозможно посчитать статистики при пустых входных данных! Чтобы отслеживать прогресс, требуется иметь данные хотя бы о двух тренировках! Проверьте, правильно ли выбран файл данных, либо добавьте новые данные в файл", "Файл пуст", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #7
0
        /// <summary>
        /// Задать массив из файла, сперва выбрав файл
        /// </summary>
        /// <returns></returns>
        public bool GetMAssFromFile()
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.IO.StreamReader sr = new System.IO.StreamReader(openFileDialog1.FileName);
                Program.filename = openFileDialog1.FileName;
                try
                {
                    Program.mas = PowerLift.GetFromFile(sr).ToList();
                }
                catch (Exception es)
                {
                    MessageBox.Show(es.Message);
                }

                sr.Close();
                return(true);
            }
            return(false);
        }
Пример #8
0
        public void GetMass()
        {
            Program.filename = Program.F5.textBox1.Text;
            StreamReader s;

            if (File.Exists(Program.filename))
            {
                s = new StreamReader(Program.filename);
            }
            else
            {
                Program.filename         = "Набор данных по умолчанию.txt";
                Program.F5.textBox1.Text = Program.filename;
                s = new StreamReader(Program.filename);
            }

            try { Program.mas = PowerLift.GetFromFile(s).ToList(); }
            catch
            {
                Program.mas = new List <PowerLift>();
            }
            finally { s.Dispose(); }
        }