示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBox1.Text) == true || string.IsNullOrEmpty(comboBox2.Text) == true)
            {
                MessageBox.Show("Ԥ���������㷨����Ϊ��");
            }
            else if (dateTimePicker2.Value > DateTime.Now)
            {
                MessageBox.Show("��ֹʱ�䲻�ܳ�������");
            }
            else
            {
                //double[,] dx = new double[10, 2] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 }, { 9, 0 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 0, 1 } };
                //��ȡ����

                getdata(dateTimePicker1.Value.ToString(), "T_station", dateTimePicker2.Value.ToString());
                bool result = changdat(timeList);
                if (result == true)
                {
                    label7.BackColor = Color.Transparent;
                    label7.Text = "������...";
                    if ("��ָ��Ԥ��" == stragl)
                    {
                        SVMpredictone.SVMpredictoneclassClass tmp1 = new SVMpredictone.SVMpredictoneclassClass();
                        tmp1.SVMpredictone(1, ref y, dsvmdat, strdaynum);
                        textBox1.Text = (((double)y / 2) * 2).ToString();
                        label7.Text = null;
                        if (10 >= (double)y)
                        {
                            label7.BackColor = Color.Lime;
                        }
                        else if (20 >= (double)y && 10 < (double)y)
                        {
                            label7.BackColor = Color.CornflowerBlue;
                        }
                        else if (40 >= (double)y && 20 < (double)y)
                        {
                            label7.BackColor = Color.Yellow;
                        }
                        else if (60 >= (double)y && 40 < (double)y)
                        {
                            label7.BackColor = Color.LightCoral;
                        }
                        else
                        {
                            label7.BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        //waterwlc3.waterwlc3classClass tmp1 = new waterwlc3.waterwlc3classClass();
                        //tmp1.waterwlc3(1, ref y, ddatx, strdaynum, p);
                        label7.Text = null;
                        textBox1.Text = ((double)y).ToString();
                        if (10 >= (double)y)
                        {
                            label7.BackColor = Color.Lime;
                        }
                        else if (20 >= (double)y && 10 < (double)y)
                        {
                            label7.BackColor = Color.CornflowerBlue;
                        }
                        else if (40 >= (double)y && 20 < (double)y)
                        {
                            label7.BackColor = Color.Yellow;
                        }
                        else if (40 >= (double)y && 60 < (double)y)
                        {
                            label7.BackColor = Color.LightCoral;
                        }
                        else
                        {
                            label7.BackColor = Color.Red;
                        }
                    }
                }
            }
        }
示例#2
0
        public void GetResult()
        {
            Log moniterLog = null;
            try
            {
                string strPath = System.Windows.Forms.Application.StartupPath + "\\Log\\";
                if (Directory.Exists(strPath) == false)
                {
                    Directory.CreateDirectory(strPath);
                }
                moniterLog = new Log(strPath, LogType.Daily);

                setWaitEventHandler(true);
                moniterLog.Write("Auto Predite, begin in GetResult", MsgType.Information);
                SVMpredictone.SVMpredictoneclassClass tmp1 = new SVMpredictone.SVMpredictoneclassClass();
                tmp1.SVMpredictone(1, ref Global.result, Mainfrm.dsvmdat, 1);
                moniterLog.Write("Auto Predite, end in GetResult", MsgType.Information);
                if (((double)Global.result) <= 40)
                {
                    setRetEventHandler(true);
                }
                else if (((double)Global.result) > 40)
                {
                    setRetEventHandler(false);
                }
                setWaitEventHandler(false);
                tmp1 = null;
                GC.Collect(0);

                moniterLog.Write("Auto Predite, done in GetResult", MsgType.Information);
            }
            catch
            {
                if (moniterLog != null)
                {
                    moniterLog.Write("Auto Predite, GetResult function error", MsgType.Error);
                }
            }
        }