string strUri_get_stripinfos = strUri + DMCMD_get_stripinfos;


            try

            {

                WebRequest wrGETURL;

                wrGETURL = WebRequest.Create(strUri_get_stripinfos);


                Stream objStream;

                objStream = wrGETURL.GetResponse().GetResponseStream();


                StreamReader objReader = new StreamReader(objStream);


                string sLine = "";

                int i = 0;


                while (sLine != null)

                {

                    i++;

                    sLine = objReader.ReadLine();

                    if (sLine != null)

                    {

                        Console.WriteLine("{0}:{1}", i, sLine);

                        if (sLine.Contains("stripinfos") == true)

                        {

                            string response = sLine.Replace("\\", "");

                            response = sLine.Replace("\"", "");

                            response = response.Replace("{", "");

                            response = response.Replace("}", "");

                            response = response.Replace("stripinfos:", "");

                            response = response.Replace("[", "");

                            response = response.Replace("]", "");

                            string[] valuelist = response.Split(',');

                            if (valuelist.Count() > 0)

                            {

                                int selectedindex = -1;

                                List<string> striplist = new List<string>();

                                stripinfolist.Clear();

                                for (int k = 0; k < valuelist.Count(); k++)

                                {

                                    string[] temp = valuelist[k].Split('/');

                                    int tempvalue = 0;

                                    StripInfo info = new StripInfo();

                                    info.lot_number = temp[0];

                                    striplist.Add(temp[0]);

                                    if (temp.Length > 1 && temp[1] == "true")

                                    {

                                        selectedindex = k;

                                        info.aisdefaultatportable = true;

                                    }


                                    if (temp.Length > 2 && int.TryParse(temp[2], out tempvalue) == true)

                                    {

                                        info.min_cs_A_value = tempvalue;

                                    }


                                    if (temp.Length > 3 && int.TryParse(temp[3], out tempvalue) == true)

                                    {

                                        info.max_cs_A_value = tempvalue;

                                    }


                                    if (temp.Length > 4 && int.TryParse(temp[4], out tempvalue) == true)

                                    {

                                        info.min_cs_B_value = tempvalue;

                                    }


                                    if (temp.Length > 5 && int.TryParse(temp[5], out tempvalue) == true)

                                    {

                                        info.max_cs_B_value = tempvalue;

                                    }


                                    stripinfolist.Add(info);                                    

                                }                               


                                stripinfocombobox.IsEnabled = true;

                                stripinfocombobox.ItemsSource = striplist;

                                stripinfocombobox.SelectedIndex = selectedindex;

                                break;

                            }

                            else

                            {

                                

                            }

                        }

                    }

                }


            }

            catch (Exception err)

            {

                string error_msg = "서버에 접속하지 못했거나 해당 기능이 서버에 반영되지 않았습니다. \r\n접속 주소는 " + strUri_get_stripinfos + " 입니다\r\n메세지 :: " + err.Message;

                LogManager.Log(3, error_msg);

                stripinfocombobox.ItemsSource = null;

                stripinfocombobox.IsEnabled = false;

            }

by 무위자연 2018. 1. 10. 17:12
| 1 |