示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {

                using (var db = new testResultContext())
                {

                    var modelAll = from b in db.testResult select b.Model;

                    var models = modelAll.Distinct();

                    if (models.Contains(textBox1.Text))
                    {
                        Form5 message = new Form5();
                        message.ShowDialog();
                    }
                    else
                    {
                        File.Delete("Repeat.txt");
                    }
                }

                this.Close();
            }

            else
            {
                button1.Enabled = false;
                label2.Visible = true;
                label2.Text = "Поле не может быть пустым!";
            }
        }
示例#2
0
        private void Form2_Load(object sender, EventArgs e)
        {
            string[] modelMon;

            bool chFlag = false;

            if (File.Exists("Repeat.txt"))
            {
                string[] allText = File.ReadAllLines("Repeat.txt");
                chFlag = Convert.ToBoolean(allText.First());
            }

            using (var db = new testResultContext())
            {
                int max = (from b in db.testResult select b.Id).Max();

                var modelM = from b in db.testResult
                             where b.Id == max
                             select b.Model;

                modelMon = modelM.ToArray();
                monitor = modelMon[0];
            }

            using (var db = new testResultContext())
            {
                var query = from b in db.testResult where b.Model == monitor select b;

                if (chFlag)
                {
                    repeatMonitor(monitor);
                }

                else
                {
                    chart1.Series.Add(monitor);
                    chart1.Series[monitor].ChartType = SeriesChartType.SplineArea;
                    foreach (var item in query)
                    {
                        switch (item.Check)
                        {
                            case 0:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 30);
                                break;
                            case 1:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 25);
                                break;
                            case 2:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 14);
                                break;
                            case 3:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 12);
                                break;
                            case 4:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 10);
                                break;
                            case 5:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 8);
                                break;
                            case 6:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 6);
                                break;
                            case 7:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 5);
                                break;
                            case 8:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 2);
                                break;
                            case 9:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 1);
                                break;
                            case 10:
                                chart1.Series[monitor].Points.AddXY(item.Hue, 0);
                                break;
                        }

                    }
                }
            }

            using (var db = new testResultContext())
            {
                var models = from b in db.testResult select b.Model;
                foreach (var item_model in models.Distinct())
                {
                    listBox1.Items.Add(item_model.ToString());
                }
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (string choice in listBox1.SelectedItems)
            {
                string yep = choice.ToString();

                using (var db = new testResultContext())
                {
                    var query = from b in db.testResult where b.Model == yep select b;
                    if (query.Count() > 73)
                    {
                        repeatMonitor(yep);
                    }

                    else
                    {
                        chart1.Series.Add(yep);
                        chart1.Series[yep].ChartType = SeriesChartType.SplineArea;

                        foreach (var item in query)
                        {
                            switch (item.Check)
                            {
                                case 0:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 30);
                                    break;
                                case 1:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 25);
                                    break;
                                case 2:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 14);
                                    break;
                                case 3:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 12);
                                    break;
                                case 4:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 10);
                                    break;
                                case 5:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 8);
                                    break;
                                case 6:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 6);
                                    break;
                                case 7:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 5);
                                    break;
                                case 8:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 2);
                                    break;
                                case 9:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 1);
                                    break;
                                case 10:
                                    chart1.Series[yep].Points.AddXY(item.Hue, 0);
                                    break;
                            }

                        }
                    }
                }
            }
        }
示例#4
0
        private void repeatMonitor(string monic)
        {
            chart1.Series.Add(monic);
            chart1.Series[monic].ChartType = SeriesChartType.SplineArea;

            int sum = 0;
            using (var db = new testResultContext())
            {
                for (int i = 0; i <= 360; i += 5)
                {
                    var stat = from b in db.testResult where b.Model == monic where b.Hue == i select b;
                    int len = stat.Count();
                    foreach (var item in stat)
                    {
                        sum += item.Check.Value;
                    }
                    sum = sum / len;

                    switch (sum)
                    {
                        case 0:
                            chart1.Series[monic].Points.AddXY(i, 30);
                            break;
                        case 1:
                            chart1.Series[monic].Points.AddXY(i, 25);
                            break;
                        case 2:
                            chart1.Series[monic].Points.AddXY(i, 14);
                            break;
                        case 3:
                            chart1.Series[monic].Points.AddXY(i, 12);
                            break;
                        case 4:
                            chart1.Series[monic].Points.AddXY(i, 10);
                            break;
                        case 5:
                            chart1.Series[monic].Points.AddXY(i, 8);
                            break;
                        case 6:
                            chart1.Series[monic].Points.AddXY(i, 6);
                            break;
                        case 7:
                            chart1.Series[monic].Points.AddXY(i, 5);
                            break;
                        case 8:
                            chart1.Series[monic].Points.AddXY(i, 2);
                            break;
                        case 9:
                            chart1.Series[monic].Points.AddXY(i, 1);
                            break;
                        case 10:
                            chart1.Series[monic].Points.AddXY(i, 0);
                            break;

                    }

                    sum = 0;
                }
            }
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            var array = new[] { 2, 5, 10, 17, 20, -3, -8, -16, -20, -10 };
            Random rand = new Random(((int)DateTime.Now.Ticks));
            array = array.OrderBy(x => rand.Next()).ToArray();
            progressBar1.PerformStep();

            if (page < 74)
            {
                if ((page==24)||(page==49))
                {
                    Form6 timer = new Form6();
                    timer.ShowDialog();
                }

                /*Считаем поставленные галки*/
                foreach (Control control in Controls)
                    if (control is Panel)
                    {
                        foreach (Control control_check in ((Panel)control).Controls)
                            if ((control_check is CheckBox) && ((CheckBox)control_check).Checked)
                            {
                                check++;
                                ((CheckBox)control_check).Checked = false;
                            }
                    }

                matrix[page - 1] = new Class1(model, hue,check);

                    check = 0;

                /*Переход на новую страницу*/
                page++;
                label1.Text = Convert.ToString(page) + "/74";

                /*Следующий оттенок*/
                hue += 5;

                foreach (Control control in this.Controls)
                    if (control is Panel)
                    {
                        if (control.Tag == "Etalon")
                        {
                            HsbToRgb(hue, 1, 1, out r, out g, out b);
                            control.BackColor = Color.FromArgb(r, g, b);
                        }

                            if (hue < 20) x = 0;
                            else x = -20;

                            switch (control.Name)
                            {
                                case "panel1":
                                    HsbToRgb(hue + array[0], 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel2":
                                    HsbToRgb(hue + array[1] + 10, 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel3":
                                    HsbToRgb(hue + array[2] + 16, 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel4":
                                    HsbToRgb(hue + array[3] + 5, 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel5":
                                    HsbToRgb(hue + array[4] + 18, 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                            }

                            switch (control.Name)
                            {
                                case "panel15":
                                    HsbToRgb(hue + array[5], 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel14":
                                    HsbToRgb(hue + array[6], 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel13":
                                    HsbToRgb(hue + array[7], 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel12":
                                    HsbToRgb(hue + array[8], 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                                case "panel11":
                                    HsbToRgb(hue + array[9], 1, 1, out r, out g, out b);
                                    control.BackColor = Color.FromArgb(r, g, b);
                                    break;
                            }
                        }
                    }

            else
            {
                {
                    using (var db = new testResultContext())
                    {
                        for (int i = 0; i < matrix.Length; i++)
                        {
                            testResult step = new testResult
                            {
                                Model = matrix[i].model,
                                Hue = matrix[i].hue,
                                Check = matrix[i].check
                            };
                            db.testResult.Add(step);
                            db.SaveChanges();
                        }
                    }
                }

                Form2 graphic = new Form2();
                graphic.Show();
            }
        }