示例#1
0
        public MainWindow()
        {
            InitializeComponent();

            recvTabUsrCtrl = (RecvUserControl)rcvTabCtrl.Content;
            sndTabUsrCtrl  = (SendUserControl)sndTabCtrl.Content;

            Form = this;

            m_cfg = new ConfigManager(this);
            GetCfgManager().setFileName(System.AppDomain.CurrentDomain.BaseDirectory + @"HMCUSIM.ini");
            GetCfgManager().Load();



            recvTab = recvTabUsrCtrl;
            sndTab  = sndTabUsrCtrl;

            recvTabUsrCtrl.ethIP.Text   = SvrIP;
            recvTabUsrCtrl.ethPort.Text = svrport;

            //int bytesRead = Marshal.SizeOf(typeof(PACKET_MATCH_INFO));
            Byte[] arr = new byte[4];
            //arr[0] = 0x00;
            //arr[1] = 0x34;
            //arr[2] = 0x56;
            //arr[3] = 0x78;
            //int trigger = BCDToInt(arr, typeof(ushort));
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();

            /// MainWindow과  데이터 동기화를 하기 위해서는 아래 문장을 실행 시켜 준다.
            DataContext = this;

            recvTabUsrCtrl = (RecvUserControl)rcvTabCtrl.Content;
            sndTabUsrCtrl  = (SendUserControl)sndTabCtrl.Content;
            othTabUsrCtrl  = (OtherUserControl)othTabCtrl.Content;

            Form = this;

            m_cfg = new ConfigManager(this);
            GetCfgManager().setFileName(System.AppDomain.CurrentDomain.BaseDirectory + @"HMCUSIM.ini");
            GetCfgManager().Load();



            recvTab = recvTabUsrCtrl;
            sndTab  = sndTabUsrCtrl;
            othTab  = othTabUsrCtrl;
            sndTabUsrCtrl.othTabUsrCtrl = othTab;

            recvTabUsrCtrl.ethIP.Text   = SvrIP;
            recvTabUsrCtrl.ethPort.Text = svrport;

            /// 시리얼 통신이면 초기화 과정을 수행한다.
            if (comm == CommMethod.Serial)
            {
                this.Loaded += new RoutedEventHandler(InitSerialPort);
                commHandler  = new SerialHandler();
                frameHeader  = new SerialHeader();
            }
            else
            {
                //commHandler = new EtherHandler();
                commHandler = new EtherHandler(new AsyncCallback(SendCallback));
                frameHeader = new EthHeader();
            }

            isRuning = false;

            recvBuff = new RecvBufferStruct();

            dataBuf = new RecvBufferStruct();

            frameBuf = new RecvBufferStruct();
        }