Exemple #1
0
        /*********************************
         *
         *   Message Send Button Event
         *
         **********************************/
        private void btn_Send_Click(object sender, EventArgs e)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                string[] str;

                str = tx_msg.Text.Split(' ');

                m_Sendbuffer = new Byte[str.Length]; //버퍼 크기 동적 할당

                for (int i = 0; i < str.Length; i++)
                {
                    m_Sendbuffer[i] = Convert.ToByte(str[i], 16);                                                       //사용자 입력 메시지(String -> Byte Array)
                }
                tx_msg.Clear();                                                                                         //사용자 입력 텍스트박스 지우기

                tx_msg.Focus();                                                                                         //포커스를 텍스트박스로 지정

                m_client.BeginSend(m_Sendbuffer, 0, m_Sendbuffer.Length, 0, new AsyncCallback(SendCallBack), m_client); //서버에 메시지를 보낼 준비

                Receive();                                                                                              //메시지 보내는 함수 호출
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #2
0
        private ERR_RESULT inner_CreateTest(TaskClass tskObj, XElement objectsNode)
        {
            ERR_RESULT result     = new ERR_RESULT();
            XElement   testNode   = null;
            XElement   imgRefNode = null;

            try
            {
                testNode = new XElement("test");

                foreach (UInt32 key in tskObj.p_ImageFileKeys)
                {
                    TaskClass.IMAGEFILEPATH img = tskObj.p_ImageFileMaps[key];
                    imgRefNode = new XElement("ImgRef", new XAttribute("Ref", img.id));
                    testNode.Add(imgRefNode);
                }

                objectsNode.Add(testNode);
                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #3
0
        /// <summary>
        /// XML Export
        /// </summary>
        /// <returns></returns>
        public ERR_RESULT XML_ExportStart(WorkSpaceClass workSpaceObj)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                if (workSpaceObj != null)
                {
                    m_WorkSpaceObj = workSpaceObj;
                }

                //Project 노드 생성
                result = inner_SelfCreateNode <ProjectClass>(m_WorkSpaceObj.p_Solutions[0].p_Projects);

                //파일생성
                m_xDoc.Save(m_CurrLocal);

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #4
0
        /*********************************
         *
         *    Write Message Function
         *
         **********************************/
        void ReturnClientSignal()
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                for (int i = m_clientList.Count - 1; i >= 0; i--)
                {
                    Socket socket = m_clientList[i];

                    socket.Send(Encoding.ASCII.GetBytes("[" + DateTime.Now + "] " +
                                                        "Received Data : " + m_recvData + Environment.NewLine)); //받은 데이터 다시 리턴
                }
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #5
0
        /*********************************
         *
         *   Receive Message Input Invoke
         *
         **********************************/
        void WriteLogMsg(string msg)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                StringBuilder msgLog = new StringBuilder();

                msgLog.Append("[" + DateTime.Now + "]");
                msgLog.Append(msg + Environment.NewLine);

                msg = Convert.ToString(msgLog);

                this.Invoke(new del_thread(InputText), new object[] { msg }); //메시지 출력 함수 Invoke
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #6
0
        /***********************************
        *
        *     Accept CallBack Function
        *
        * *********************************/
        void AcceptCallBack(IAsyncResult ar)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                Socket client = m_server.EndAccept(ar);                                                           //클라이언트의 접속을 완료

                m_server.BeginAccept(AcceptCallBack, null);                                                       //다른 클라이언트 접속 대기

                m_clientList.Add(client);                                                                         //클라이언트 List에 추가

                m_asyncObject.WorkingSocket = client;                                                             //비동기 처리를 위한 클래스의 소켓에 클라이언트 저장

                client.BeginReceive(m_asyncObject.Buffer, 0, m_asyncObject.Size, 0, DataReceived, m_asyncObject); //Message 받을 준비
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #7
0
        /*********************************
         *
         *    Receive Call Back Function
         *
         **********************************/
        void DataReceived(IAsyncResult ar)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_asyncObject = (AsyncObjectClass)ar.AsyncState;
                Byte[] recvByte;                                           //받은 데이터 바이트 배열

                int RecvSize = m_asyncObject.WorkingSocket.EndReceive(ar); //받은 메시지 크기
                recvByte = new Byte[RecvSize];                             //크기만틈 배열 동적 할당

                Array.Copy(m_asyncObject.Buffer, recvByte, RecvSize);

                m_recvData = System.Text.Encoding.Default.GetString(recvByte);                                                         //Byte Array -> String

                WriteLogMsg(m_recvData);                                                                                               //받은 메시지 출력

                m_asyncObject.ClearBuffer();                                                                                           //버퍼 비우기

                ReturnClientSignal();                                                                                                  //Message 보내는 함수 호출

                m_asyncObject.WorkingSocket.BeginReceive(m_asyncObject.Buffer, 0, m_asyncObject.Size, 0, DataReceived, m_asyncObject); //다시 메세지를 받을 준비
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #8
0
        /*
         * *method
         */
        /// <summary>
        /// Root 노드 생성
        /// </summary>
        /// <param name="rootName">루트네임</param>
        /// <returns>ERR_RESULT</returns>
        public ERR_RESULT XML_ExportInit(WorkSpaceClass workspaceobj)
        {
            ERR_RESULT result = new ERR_RESULT();

            m_WorkSpaceObj = workspaceobj;

            try
            {
                if (m_xDoc == null)
                {
                    m_xDoc = new XDocument();
                }

                m_Xroot = new XElement(m_WorkSpaceObj.p_Solutions[0].p_Name);
                m_xDoc.Add(m_Xroot);

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #9
0
        /***********************************
        *
        *     Accept CallBack Function
        *
        * *********************************/
        void AcceptCallBack(IAsyncResult ar)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                Socket client = m_server.EndAccept(ar);                           //클라이언트의 접속을 완료

                this.Invoke(new del_thread(InputText), new object[] { 1, null }); //접속 상태 변경

                m_server.BeginAccept(AcceptCallBack, null);                       //다른 클라이언트 접속 대기

                m_clientList.Add(client);                                         //클라이언트 List에 추가

                m_asyncObject.WorkingSocket = client;                             //비동기 처리를 위한 클래스의 소켓에 클라이언트 저장

                m_queue.Queue.Enqueue(MSG_STATUS.MSG_READ);                       //Read Event를 Queue에 저장
                m_queue.NewEvent.Set();                                           //Read Event 발생
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #10
0
        /***********************************
        *
        *       Queue Event Loop Sart
        *
        * *********************************/
        void Loop_Start()
        {
            ERR_RESULT result = new ERR_RESULT();
            MSG_STATUS msg;

            try
            {
                msg = m_queue.Queue.Dequeue(); //Queue에 저장된 Event 목록을 가져옴
                switch (msg)
                {
                case MSG_STATUS.MSG_READ:                                 //Read Event
                    m_task = Task.Factory.StartNew(() => DataReceived()); //Read Thread 실행
                    break;

                case MSG_STATUS.MSG_WRITE:                                      //Write Event
                    m_task = Task.Factory.StartNew(() => ReturnClientSignal()); //Write Thread 실행
                    break;
                }
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #11
0
        /***********************************
        *
        *        Check Event Queue
        *
        * *********************************/
        void CheckFunc()
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                int EventIdx = -1;

                while (!(EventIdx == 1))                                  //Event 종료 인덱스 1로 설정
                {
                    EventIdx = WaitHandle.WaitAny(m_queue.Handler, 1000); //1초 간격으로 Event 발생 체크
                    if (EventIdx == 0)                                    //Event 시작 인덱스 0으로 설정
                    {
                        Loop_Start();                                     //Event 처리 Loop
                        m_queue.NewEvent.Reset();
                    }
                }
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #12
0
        /***********************************
        *
        *      Connect Status Invoke
        *
        * *********************************/
        void InputText(int idx, StringBuilder msg)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                if (idx == 1)
                {
                    pictureBox1.BackColor = Color.Green; //접속시 색상 Green으로 변경
                    lb_Status.Text        = "Connected"; //클라이언트 접속 상태 변경
                }
                else
                {
                    tx_log.Text += msg;
                }
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #13
0
        private ERR_RESULT inner_CreateImgFilesNode(XElement tskNode, TaskClass tskObj)
        {
            ERR_RESULT result    = new ERR_RESULT();
            XElement   imageNode = null;

            try
            {
                //tsk FilePath
                String tskPath = Environment.CurrentDirectory + "\\" + tskObj.p_Pareants.p_Pareants.p_Name; //solution
                tskPath += "\\" + tskObj.p_Pareants.p_Name;                                                 //Project
                tskPath += "\\" + tskObj.p_Name;                                                            //task

                int fileCount = tskObj.p_ImageFileMaps.Count();
                //1. ImageFile 노드 생성
                XElement   imgFilesNode = new XElement("ImageFiles");
                XAttribute countAtt     = new XAttribute("Count", fileCount);
                XAttribute pathAtt      = new XAttribute("Path", tskPath);//

                imgFilesNode.Add(countAtt);
                imgFilesNode.Add(pathAtt);

                String idName = null;
                for (int index = 0; index < fileCount; index++)
                {
                    UInt32 key = tskObj.p_ImageFileKeys[index];
                    //2. Image 노드 생성
                    //Name att
                    idName    = "IMG_" + ((UInt32)key).ToString();
                    imageNode = new XElement("Image", new XAttribute("Name", idName));

                    //LDH9999 type att 속성은 추후
                    imageNode.Value = tskObj.p_ImageFileMaps[key].FileName;
                    imgFilesNode.Add(imageNode);
                }

                //tsk노드에 추가
                tskNode.Add(imgFilesNode);
                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #14
0
        /*********************************
         *
         *  Received Messge Input Function
         *
         **********************************/
        void InputText(StringBuilder msg)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                this.BeginInvoke(new del_thread2(InputData), new object[] { msg, 1 });
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
        private ERR_RESULT inner_FilesImageValid(String[] dropfiles)
        {
            ERR_RESULT result = new ERR_RESULT();

            String[] tokenPath = null;
            String   fileName  = null;

            String[] fileInform = null;
            String   fileType   = null;

            try
            {
                foreach (String path in dropfiles)
                {
                    tokenPath  = path.Split('\\');
                    fileName   = tokenPath[tokenPath.Length - 1];
                    fileInform = fileName.Split('.');
                    fileType   = fileInform[fileInform.Length - 1];

                    if (fileType.ToLower().Equals("jpg") || fileType.ToLower().Equals("png") || fileType.ToLower().Equals("bmp"))
                    {
                        //return result;
                        result.errCode = 0;
                    }
                    else
                    {
                        throw new _ImageListViewException(-50);
                    }
                }

                return(result);
            }
            catch (_ImageListViewException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #16
0
        public ERR_RESULT inner_CreateObjects(List <ImageObject> objects, XElement node, String nodeName)
        {
            ERR_RESULT result      = new ERR_RESULT();
            XElement   tempNode    = new XElement(nodeName);
            XElement   objectsNode = null;

            try
            {
                foreach (ImageObject obj in objects)
                {
                    //픽처 박스 정보가 없으면 skip
                    if (obj.objects.Count == 0)
                    {
                        continue;
                    }

                    objectsNode = new XElement("objects", new XAttribute("ImgRef", obj.imgRef));

                    //objects 추가
                    result = inner_AddImgObject(obj, objectsNode);
                    if (result.errCode != 0)
                    {
                        return(result);
                    }

                    tempNode.Add(objectsNode);
                }

                node.Add(tempNode);
                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #17
0
        /*********************************
         *
         *          Form Close Event
         *
         **********************************/
        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_server.Shutdown(SocketShutdown.Both); //Socket ShutDown(Server and Client)
                m_server.Close();                       //Server Close
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #18
0
        /*********************************
         *
         *    Connect Call Back Function
         *
         **********************************/
        void ConnectCallBack(IAsyncResult ar)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_client = (Socket)ar.AsyncState;
                m_client.EndConnect(ar); //소켓 연결 완료
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #19
0
        /*********************************
         *
         *     Send Call Back Function
         *
         **********************************/
        void SendCallBack(IAsyncResult ar)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_client = (Socket)ar.AsyncState;
                int SentSize = m_client.EndSend(ar); //메시지 전송 완료
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #20
0
        private ERR_RESULT inner_CreatePropertyParams(ToolClass tolObj, XElement tolNode)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                XElement paramNode = new XElement("PropertyParams");

                //LDH9999 추후 상수값으로 지정되어있음
                //LDH8282 xml 수정
                XElement classNameNode         = new XElement("className", "ID_1");
                XElement epochNode             = new XElement("epoch", 300);
                XElement batch_sizeNode        = new XElement("batch_size", 10);
                XElement weight_decayNode      = new XElement("weight_decay", 0.005);
                XElement learning_rateNode     = new XElement("learning_rate", "0.0002,0.0001,0.00001");
                XElement global_stepNode       = new XElement("global_step", "10000,20000");
                XElement continue_trainingNode = new XElement("continue_training", 0);

                paramNode.Add(classNameNode);
                paramNode.Add(epochNode);
                paramNode.Add(batch_sizeNode);
                paramNode.Add(weight_decayNode);
                paramNode.Add(learning_rateNode);
                paramNode.Add(global_stepNode);
                paramNode.Add(continue_trainingNode);

                tolNode.Add(paramNode);

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #21
0
        private ERR_RESULT inner_AddImgObject(ImageObject obj, XElement objectsNode)
        {
            ERR_RESULT result    = new ERR_RESULT();
            XElement   objNode   = null;
            XElement   labelNode = null;
            XElement   posNode   = null;
            XElement   sizeNode  = null;

            try
            {
                foreach (ImageObject.IMAGEPOSITION pos in obj.objects)
                {
                    objNode   = new XElement("object");
                    labelNode = new XElement("label", pos.label);

                    String posVal = pos.LT_pos.X.ToString() + "," + pos.LT_pos.Y.ToString();
                    posNode = new XElement("pos", posVal);

                    String sizeVal = pos.width + "," + pos.height;
                    sizeNode = new XElement("size", sizeVal);

                    objNode.Add(labelNode);
                    objNode.Add(posNode);
                    objNode.Add(sizeNode);

                    objectsNode.Add(objNode);
                }

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
        public ERR_RESULT ILV_ReplaceImgItem(ImageItem item, int index)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                LV.Items.RemoveAt(index);
                LV.Items.Insert(index, item);
                return(result);
            }
            catch (_ImageListViewException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #23
0
        /*********************************
         *
         *     MSG_READ Event Thread
         *
         **********************************/
        void DataReceived()
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                while (true)                                                   //반복해서 Read 실행
                {
                    m_asyncObject.WorkingSocket.Receive(m_asyncObject.Buffer); //Data Read

                    string recvDataFull = string.Empty;;

                    recvDataFull = Encoding.ASCII.GetString(m_asyncObject.Buffer); //Byte Data -> String Data

                    for (int i = 0; recvDataFull[i] != '\0'; i++)
                    {
                        m_recvData += recvDataFull[i];           //Null 값 제거
                    }
                    WriteLogMsg(m_recvData);                     //받은 메시지 출력

                    m_asyncObject.ClearBuffer();                 //버퍼 비우기

                    m_queue.Queue.Enqueue(MSG_STATUS.MSG_WRITE); //Write Event Queue에 저장
                    m_queue.NewEvent.Set();                      //Event 발생

                    Thread.Sleep(100);                           //0.01초 간격으로 반복
                }
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #24
0
        /*********************************
         *
         *    Message Receive Function
         *
         **********************************/
        void Receive()
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_asyncObject.WorkingSocket = m_client; //비동기 처리를 위해 소켓 객체를 대입

                m_client.BeginReceive(m_asyncObject.Buffer, 0, m_asyncObject.Size,
                                      0, new AsyncCallback(ReceiveCallBack), m_asyncObject); //메세지 받을 준비
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #25
0
        /***********************************
        *
        *        Form Load Event
        *
        * *********************************/
        private void Form1_Load(object sender, EventArgs e)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_SocketClass.CreateSocket();                                      //서버 소켓 생성
                m_server = m_SocketClass.Server;                                   //생성된 소켓
                m_server.BeginAccept(new AsyncCallback(AcceptCallBack), m_server); //접속할 클라이언트를 비동기적으로 받을 준비
                pictureBox1.BackColor = Color.Red;
                m_task = Task.Factory.StartNew(() => CheckFunc(), m_token.Token);  //Event Check Thread 시작
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #26
0
        /*********************************
         *
         *    Socket Connect Button Event
         *
         **********************************/
        private void btn_connect_Click(object sender, EventArgs e)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_ip   = tx_Ip.Text;
                m_port = Int32.Parse(tx_Port.Text);

                m_clientClass.ConnectServer(m_ip, m_port);                                     //사용자가 입력한 ip와 port번호로 접속
                m_client = m_clientClass.Client;                                               //생성 소켓 객체
                m_remote = m_clientClass.RemoteEp;                                             //생성 소켓 주소정보
                m_client.BeginConnect(m_remote, new AsyncCallback(ConnectCallBack), m_client); //서버와 연결 준비
                Thread newThread = new Thread(() => CheckConnect());
                newThread.IsBackground = true;
                newThread.Start();

                if (m_client.Connected)
                {
                    lb_status.Text = "Connected to Server!"; //연결 상태 메세지 변경
                }
                else
                {
                    lb_status.Text = "Server Waiting....";
                }
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
        private void LV_Drop(object sender, DragEventArgs e)
        {
            ERR_RESULT result = new ERR_RESULT();

            m_DropFiles = (string[])e.Data.GetData(DataFormats.FileDrop);
            try
            {
                if (m_DropFiles == null)
                {
                    return;
                }

                //1. 이미지 파일 검사
                result = inner_FilesImageValid(m_DropFiles);
                if (result.errCode != 0)
                {
                    throw new _ImageListViewException(-50);
                }

                //2. 이미지 파일 경로 Main으로 던짐
                RoutedEventArgs argsEvent = new RoutedEventArgs();
                argsEvent.RoutedEvent = ImageListView.ImageDropEvent;
                argsEvent.Source      = this;
                RaiseEvent(argsEvent);
            }
            catch (_ImageListViewException err)
            {
                result = ErrProcess.SetErrResult(err);
                inner_OnExcuteErrOut(new ResultEventArgs(result));
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                inner_OnExcuteErrOut(new ResultEventArgs(result));
            }
        }
Exemple #28
0
        /**********************************
        *
        *        Form Load Event
        *
        **********************************/
        private void Form1_Load(object sender, EventArgs e)
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_SocketClass.CreateSocket();                                      //서버 소켓 생성
                m_server = m_SocketClass.Server;                                   //생성된 소켓
                m_server.BeginAccept(new AsyncCallback(AcceptCallBack), m_server); //접속할 클라이언트를 비동기적으로 받을 준비
                Thread newThread = new Thread(() => CheckConnect());
                newThread.IsBackground = true;
                newThread.Start();
            }
            catch (_MainException err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                m_err.SetErrCall(result);
            }
        }
Exemple #29
0
        public ERR_RESULT XML_Free()
        {
            ERR_RESULT result = new ERR_RESULT();

            try
            {
                m_Xroot.RemoveAll();
                m_xDoc.RemoveNodes();

                m_Xroot = null;
                m_xDoc  = null;
                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }
Exemple #30
0
        /// <summary>
        /// Prj,Tsk,Tol 노드 생성 재귀함수
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="objs">Doc클래스의 List</param>
        /// <param name="parentsNode">부모 XMLNode</param>
        /// <returns>ERR_RESULT</returns>
        private ERR_RESULT inner_SelfCreateNode <T>(ObservableCollection <T> objs, XElement parentsNode = null)
        {
            ERR_RESULT   result       = new ERR_RESULT();
            const String nameSpaceStr = "DeepObjectDector.sub.doc";
            XElement     node         = null;

            try
            {
                foreach (T it in objs)
                {
                    switch (it.GetType().ToString())
                    {
                    case (nameSpaceStr + ".ProjectClass"):
                        node = new XElement("Project");
                        node.Add(new XAttribute("Name", (it as ProjectClass).p_Name));

                        if ((it as ProjectClass).p_Tasks.Count != 0)
                        {
                            result = inner_SelfCreateNode <TaskClass>((it as ProjectClass).p_Tasks, node);
                        }

                        if (result.errCode != 0)
                        {
                            return(result);
                        }

                        //root 노드 결합
                        m_Xroot.Add(node);
                        break;

                    case (nameSpaceStr + ".TaskClass"):
                        node = new XElement("Task");
                        node.Add(new XAttribute("Name", (it as TaskClass).p_Name));

                        result = inner_CreateImgFilesNode(node, (it as TaskClass));
                        if (result.errCode != 0)
                        {
                            return(result);
                        }

                        if ((it as TaskClass).p_Tools.Count != 0)
                        {
                            result = inner_SelfCreateNode <ToolClass>((it as TaskClass).p_Tools, node);
                            if (result.errCode != 0)
                            {
                                return(result);
                            }
                        }
                        //Task 노드 결합
                        parentsNode.Add(node);
                        break;

                    case (nameSpaceStr + ".ToolClass"):
                        //PropertyParams
                        node = new XElement("Tool");
                        node.Add(new XAttribute("Name", (it as ToolClass).p_Name));

                        result = inner_CreatePropertyParams((it as ToolClass), node);
                        if (result.errCode != 0)
                        {
                            return(result);
                        }

                        //train node
                        result = inner_CreateObjects((it as ToolClass).trainObjects, node, "train");
                        if (result.errCode != 0)
                        {
                            return(result);
                        }

                        //valid node
                        result = inner_CreateObjects((it as ToolClass).validObjects, node, "valid");
                        if (result.errCode != 0)
                        {
                            return(result);
                        }

                        //test node
                        result = inner_CreateTest((it as ToolClass).p_Pareants, node);
                        if (result.errCode != 0)
                        {
                            return(result);
                        }

                        parentsNode.Add(node);
                        break;

                    default:
                        throw new _MainException(-2);
                    }
                }

                return(result);
            }
            catch (_XmlException err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
            catch (Exception err)
            {
                result = ErrProcess.SetErrResult(err);
                return(result);
            }
        }