Пример #1
0
        private void savebtn_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < tabControl1.TabPages.Count; i++)
            {
                ResultEntity temp = new ResultEntity();
                for (int j = 0; j < tabControl1.TabPages[i].Controls[0].Controls.Count; j++)
                {
                    if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "readytimevalue")
                    {
                        Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i];
                        settingentitytemp.setreadytime(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text));
                    }
                    else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "namevalue")
                    {
                        Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i];
                        settingentitytemp.setparamatername(tabControl1.TabPages[i].Controls[0].Controls[j].Text.ToString());
                    }
                    else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "shuttertimevalue")
                    {
                        Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i];
                        settingentitytemp.setshuttertimes(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text));
                    }
                    else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "clinevalue")
                    {
                        Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i];
                        settingentitytemp.setclinevalue(tabControl1.TabPages[i].Controls[0].Controls[j].Text.ToString());
                    }
                    else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "setstartvalue")
                    {
                        temp.setresultname("Control line");
                        temp.setresultstartvalue(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text));
                    }
                    else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "setendvalue")
                    {
                        temp.setresultname("Control line");
                        temp.setresultendvalue(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text));
                    }
                }
                Settingentity settingentitytempforresult = (Settingentity)methodtemp.getsettinglist()[i];
                for (int k = 0; k < settingentitytempforresult.getresultentitylist().Count; k++)
                {
                    if (((ResultEntity)settingentitytempforresult.getresultentitylist()[k]).getresultname() == "Control line")
                    {
                        settingentitytempforresult.getresultentitylist().RemoveAt(k);
                    }
                }
                settingentitytempforresult.getresultentitylist().Add(temp);
            }

            Settingdetectsection settemp = new Settingdetectsection(method, formtemp, methodlisttemp, methodtemp, editflag);

            settemp.TopLevel        = false;
            settemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            settemp.Dock            = System.Windows.Forms.DockStyle.Fill;
            panel1.Controls.Clear();
            panel1.Controls.Add(settemp);
            settemp.Show();
            //formtemp.OnLoad();
            //method.Dispose();
        }
Пример #2
0
        public Setcontrolzone(ArrayList list, MethodEntity methodtemp, int framewightvalue, int frameheightvalue)
        {
            InitializeComponent();
            framewidth  = framewightvalue;
            frameheight = frameheightvalue;

            for (int i = 0; i < list.Count; i++)
            {
                if (((Settingimageentity)list[i]).getparamatertype() != "Color")
                {
                    Bitmap  tempbitmap = ((Settingimageentity)list[0]).getimage();//default value
                    TabPage tab        = new TabPage();
                    tab.Name = ((Settingentity)methodtemp.getsettinglist()[i]).getparamatername();
                    tab.Text = tab.Name;
                    for (int k = 0; k < list.Count; k++)
                    {
                        if (((Settingentity)methodtemp.getsettinglist()[i]).getparamatername() == ((Settingimageentity)list[i]).getparamatername())
                        {
                            tempbitmap = ((Settingimageentity)list[i]).getimage();
                        }
                    }
                    Controlzoneentity form = new Controlzoneentity(tempbitmap, (Settingentity)methodtemp.getsettinglist()[i], framewidth, frameheight);
                    form.TopLevel = false;
                    tab.Controls.Add(form.panel1);
                    tabControl1.TabPages.Add(tab);
                    form.Show();
                    tabControl1.Show();
                }
            }
        }
Пример #3
0
 private void MethodEdit_Load(object sender, EventArgs e)
 {
     methodeditmethodnametextbox.Text = methodentity.getmethodname();
     for (int i = 0; i < methodentity.getsettinglist().Count; i++)
     {
         methodeditparamatercombox.Items.Add(((Settingentity)methodentity.getsettinglist()[i]).getparamatername());
     }
 }
Пример #4
0
 private void deleteparamaterbtn_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < methodnexttemp.tabControl1.Controls.Count; i++)
     {
         TabPage tab = (TabPage)methodnexttemp.tabControl1.Controls[i];
         if (tab.Name == namevalue.Text.ToString())
         {
             methodnexttemp.tabControl1.Controls.Remove(tab);
             methodtemp.getsettinglist().Remove(settingentity);
             methodnexttemp.Refresh();
             break;
         }
     }
 }
Пример #5
0
 public MethodSettingEntity(Method formvalue, Form1 mainformvalue, MethodNext methodnexttempvalue, ArrayList valuelist, MethodEntity methodvalue, int value)
 {
     InitializeComponent();
     if (Form1.language != "")
     {
         refreshlanguage(Form1.language);
     }
     methodtemp               = methodvalue;
     methodnexttemp           = methodnexttempvalue;
     settingentity            = (Settingentity)methodvalue.getsettinglist()[value];
     methodlisttemp           = valuelist;
     form                     = formvalue;
     formtemp                 = mainformvalue;
     clinevalue.SelectedIndex = 0;
     namevalue.Text           = settingentity.getparamatername();
 }
Пример #6
0
        private void nextbtn_Click(object sender, EventArgs e)
        {
            MySqlDataReader mysqlreader = database.select("Methodtable", "Methodname");

            while (mysqlreader.Read())
            {
                if (mysqlreader[0].ToString().Equals(methodnamevalue.Text) && editflag == 0)
                {
                    MessageBox.Show("method has been created");
                    return;
                }
            }
            ArrayList namelisttemp = new ArrayList();

            methodtemp.setmethodname(methodnamevalue.Text);
            methodtemp.setsensitive(5);
            string line = namevalue.Text;

            //Regex reg = new Regex("[A-Za-z0-9]+");
            string[] match = Regex.Split(line, ",| ,|, ");
            //MatchCollection match = reg.Matches(line);
            if (Paramaternumbertextbox.Text != "" && match.Length == int.Parse(Paramaternumbertextbox.Text))
            {
                for (int i = 0; i < match.Length; i++)
                {
                    Settingentity settingentity = new Settingentity();
                    string        value         = match[i].ToString();
                    namelisttemp.Add(value);
                    settingentity.setparamatername(value);
                    if (methodtemp.getsettinglist().Count > 0)
                    {
                        for (int j = 0; j < methodtemp.getsettinglist().Count; j++)
                        {
                            if (((Settingentity)methodtemp.getsettinglist()[j]).getparamatername() == value)
                            {
                                break;
                            }
                            else if (j == methodtemp.getsettinglist().Count - 1)
                            {
                                methodtemp.getsettinglist().Add(settingentity);
                            }
                        }
                    }
                    else
                    {
                        methodtemp.getsettinglist().Add(settingentity);
                    }
                }
                //namelist = namelisttemp;
                MethodNext temp = new MethodNext(this, formtemp, methodlist, methodtemp, editflag);
                //MethodNext temp = new MethodNext();
                temp.TopLevel        = false;
                temp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                temp.Dock            = System.Windows.Forms.DockStyle.Fill;
                panel1.Controls.Clear();
                panel1.Controls.Add(temp);
                for (int i = 0; i < namelisttemp.Count; i++)
                {
                    TabPage tab = new TabPage();
                    tab.Name = (string)namelisttemp[i];
                    tab.Text = (string)namelisttemp[i];

                    MethodSettingEntity form = new MethodSettingEntity(this, formtemp, temp, methodlist, methodtemp, i);
                    form.TopLevel = false;
                    tab.Controls.Add(form.panel1);
                    temp.tabControl1.TabPages.Add(tab);
                    form.Show();
                }
                temp.Show();
            }
            else
            {
                MessageBox.Show("Please input correct number");
            }
        }
Пример #7
0
        public Settingsensitive(ArrayList list, MethodEntity methodtempvalue)
        {
            System.Collections.ArrayList namelist = new ArrayList();
            imagelist  = list;
            methodtemp = methodtempvalue;
            // TODO: Complete member initialization
            Pointentity temp = new Pointentity();

            InitializeComponent();
            if (Form1.language != "")
            {
                refreshlanguage(Form1.language);
            }
            Sensitivevalue.Text = "5";
            scanpicture(list);
            //this.colorlist = colorlist;
            for (int i = 0; i < methodtemp.getsettinglist().Count; i++)
            {
                namelist.Add(((Settingentity)methodtemp.getsettinglist()[i]).getparamatername());
            }
            for (int i = 0; i < namelist.Count; i++)
            {
                if (((Settingentity)methodtemp.getsettinglist()[i]).getlinevalue() != "Color")
                {
                    DateTime  currenttime      = DateTime.Now;
                    int       colorvaluetop    = 255;
                    int       colorvaluebottom = 255;
                    ArrayList templist         = new ArrayList();
                    int       averagevalue     = 0;
                    if (i < chartlist.Count)
                    {
                        TabPage tabPage = new TabPage();
                        tabPage.Text       = "page" + i.ToString();
                        tabPage.ClientSize = new Size(749, 368);
                        tabPage.BackColor  = Color.White;
                        Chart chart2 = new Chart();
                        chart2.Series.Clear();
                        chart2.ChartAreas.Add("ChartArea2");
                        chart2.Location   = new Point(24, 17);
                        chart2.ClientSize = new Size(672, 300);
                        chart2.Margin     = new Padding(3, 3, 3, 3);
                        chart2.ChartAreas["ChartArea2"].AxisX.Interval = 1;
                        chart2.ChartAreas["ChartArea2"].AxisY.Maximum  = 300;
                        Series series = new Series("Spline");
                        chart2.Legends.Add(new Legend("Spline1"));

                        series.LegendText = namelist[i].ToString();
                        //series.Tag = "asda";
                        series.ChartType   = SeriesChartType.Spline;
                        series.BorderWidth = 3;
                        colorlist          = (System.Collections.ArrayList)chartlist[i];
                        for (int k = 0; k < colorlist.Count; k++)
                        {
                            temp = (Pointentity)colorlist[k];
                            series.Points.AddY(temp.getcolor());
                            if (temp.getcolor() < colorvaluetop && k < colorlist.Count / 2)
                            {
                                colorvaluetop = temp.getcolor();
                            }
                            else if (temp.getcolor() < colorvaluebottom && k > colorlist.Count / 2)
                            {
                                colorvaluebottom = temp.getcolor();
                            }
                        }
                        chart2.Series.Add(series);
                        tabPage.Controls.Add(chart2);
                        chart2.Show();
                        tabPage.Name = namelist[i].ToString();
                        tabPage.Text = namelist[i].ToString();
                        tabgroup.TabPages.Add(tabPage);
                        temp             = (Pointentity)colorlist[0];
                        averagevalue     = temp.getcolor();
                        colorvaluetop    = averagevalue - colorvaluetop;
                        colorvaluebottom = averagevalue - colorvaluebottom;
                        TextAnnotation text = new TextAnnotation();
                        text.Text = "C:";
                        text.X    = 85;
                        text.Y    = 20;
                        chart2.Annotations.Add(text);
                        text      = new TextAnnotation();
                        text.Text = colorvaluetop.ToString();
                        text.X    = 90;
                        text.Y    = 20;
                        chart2.Annotations.Add(text);
                        text      = new TextAnnotation();
                        text.Text = "T:";
                        text.X    = 85;
                        text.Y    = 27;
                        chart2.Annotations.Add(text);
                        text      = new TextAnnotation();
                        text.Text = colorvaluebottom.ToString();
                        text.X    = 90;
                        text.Y    = 27;
                        chart2.Annotations.Add(text);
                        text      = new TextAnnotation();
                        text.Text = "Loading:";
                        text.X    = 85;
                        text.Y    = 34;
                        chart2.Annotations.Add(text);
                        text = new TextAnnotation();
                        System.DateTime timetemp = new DateTime();
                        TimeSpan        ts       = currenttime - timetemp;
                        text.Text = "0." + ts.Milliseconds.ToString() + "/s";
                        text.X    = 92;
                        text.Y    = 34;
                        chart2.Annotations.Add(text);
                    }
                }
            }
        }
Пример #8
0
        private void Settingdetectsection_Load(object sender, EventArgs e)
        {
            try
            {
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException();
                }
                int i = 0;
                foreach (FilterInfo device in videoDevices)
                {
                    if (device.Name == "USB2.0 Camera")
                    {
                        devicename = device.Name;
                        VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[i].MonikerString);
                        videoSource.VideoResolution = videoSource.VideoCapabilities[0];
                        framewidth  = videoSource.VideoResolution.FrameSize.Width / 320;
                        frameheight = videoSource.VideoResolution.FrameSize.Height / 240;
                        videoSource.DesiredFrameSize = new Size(320, 240);
                        videoSource.DesiredFrameRate = 1;
                        videPlayer.VideoSource       = videoSource;
                        videPlayer.Start();
                    }
                    i++;
                }
                neededboxes = methodtemp.getsettinglist().Count;
                settingdetectsectionneededvaluelabel.Text = neededboxes.ToString();
                for (int j = 0; j < methodtemp.getsettinglist().Count; j++)
                {
                    TabPage tab = new TabPage();
                    tab.Name = ((Settingentity)methodtemp.getsettinglist()[j]).getparamatername();
                    tab.Text = ((Settingentity)methodtemp.getsettinglist()[j]).getparamatername();
                    Settingimagedetection tempentity = new Settingimagedetection(this, ((Settingentity)methodtemp.getsettinglist()[j]).getparamatername(), framewidth, frameheight);
                    tempentity.TopLevel = false;
                    tab.Controls.Add(tempentity);
                    this.tabControl1.TabPages.Add(tab);
                    tempentity.Show();
                    tabControl1.SelectedIndex = 0;
                    tabControl1_SelectedIndexChanged(null, null);
                }
            }
            catch (ApplicationException)
            {
                videoDevices = null;
            }
        }