Esempio n. 1
0
 public TileStruct(int nTileNo, string strName)
 {
     TileNo     = nTileNo;
     SerialData = new SerialStruct
     {
         SerialName = string.Format("{0}{1}", strName, TileNo)
     };
     SerialData.Open();
 }
Esempio n. 2
0
        /// <summary>
        /// 설정 - 적용 버튼
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdapt_Click(object sender, EventArgs e)
        {
            #region 시리얼명
            if (string.IsNullOrEmpty(tboxSerialName.Text))
            {
                MessageBox.Show(Languages.Msg_NoTitle);
                return;
            }
            mTileStruct.SerialName            = tboxSerialName.Text;
            mTileStruct.SerialData.SerialName = tboxSerialName.Text;
            mTileStruct.Text = tboxSerialName.Text;
            #endregion

            #region 포트
            mTileStruct.SerialData.PortNum = cboxPort.SelectedIndex;
            #endregion

            #region 보드레이트
            mTileStruct.SerialData.BaudRate = (int)SerialStruct.IndexToBaudRate(cboxBaudRate.SelectedIndex);
            #endregion

            #region 데이터 비트
            mTileStruct.SerialData.DataBit = (int)SerialStruct.IndexToDataBit(cboxDataBit.SelectedIndex);
            #endregion

            #region 패리티 코드
            mTileStruct.SerialData.ParityCode = (Parity)cboxParity.SelectedIndex;
            #endregion

            #region 정지 비트
            mTileStruct.SerialData.StopBitCode = (StopBits)cboxStopBit.SelectedIndex;
            #endregion

            #region 흐름 제어
            mTileStruct.SerialData.FlowControl = (SerialStruct.FlowC)cboxFlow.SelectedIndex;
            #endregion

            #region 매크로 활성화
            mTileStruct.SerialData.MacroEnable = toggleEnable.Checked;
            #endregion

            #region 반복 딜레이
            mTileStruct.SerialData.RunDelay = int.Parse(tboxDelay.Text);
            #endregion

            #region 타일 색상
            mTileStruct.TileColor = (Const.StyleType)cboxTileColor.SelectedIndex;
            #endregion

            #region 로그 관련

            mTileStruct.SerialData.LogSave     = toggleLogSave.Checked;
            mTileStruct.SerialData.LogSaveType = (Const.LogSaveType)cboxLogSaveType.SelectedIndex;
            mTileStruct.SerialData.LogToken    = (Const.LogToken)cboxLogToken.SelectedIndex;
            mTileStruct.SerialData.LogSavePath = tboxLogSavePath.Text;

            #endregion

            SaveSerialDataEvent();
            mTileStruct.SerialData.Open();
            mTileStruct.RefreshButton();
        }
Esempio n. 3
0
        // TODO 타일 폼 만들기
        /// <summary>
        /// 다이얼로그 설정 메소드
        /// </summary>
        /// <param name="tileStruct">타일 데이터</param>
        public void SetDialog(TileStruct tileStruct)
        {
            mTileStruct = tileStruct;

            #region 타이틀 텍스트
            Text = mTileStruct.SerialName;
            #endregion

            #region 테마 및 스타일 변경
            ThemeChangeEvent(mTileStruct.MainThemeType);
            StyleChangeEvent(mTileStruct.MainStyleType);
            #endregion

            #region 매크로

            #region 매크로 - 데이터 매칭
            if (tileStruct.SerialData.MacroList.Count > 0)
            {
                foreach (MacroStruct macroStruct in tileStruct.SerialData.MacroList)
                {
                    #region 매크로 Row
                    DataGridViewRow    row   = new DataGridViewRow();
                    DataGridViewCell[] cells = new DataGridViewCell[(int)GridStuff.GridIdxMax];

                    #region 매크로 Row - 매크로명
                    cells[(int)GridStuff.GridIdx_Name] = new DataGridViewTextBoxCell();
                    ((DataGridViewTextBoxCell)cells[(int)GridStuff.GridIdx_Name]).Value = macroStruct.MacroName;
                    #endregion

                    #region 매크로 Row - 매크로
                    cells[(int)GridStuff.GridIdx_Macro] = new DataGridViewTextBoxCell();
                    ((DataGridViewTextBoxCell)cells[(int)GridStuff.GridIdx_Macro]).Value = macroStruct.Macro;
                    #endregion

                    #region 매크로 Row - 활성화
                    cells[(int)GridStuff.GridIdx_Enable] = new DataGridViewCheckBoxCell();
                    ((DataGridViewCheckBoxCell)cells[(int)GridStuff.GridIdx_Enable]).Value = macroStruct.Enable;
                    #endregion

                    row.Cells.AddRange(cells);
                    gridMacro.Rows.Add(row);
                    #endregion
                }
            }
            #endregion

            #endregion

            #region 기록
            tileStruct.SerialData.WriteLogEvent += WriteLogToTBox;
            #endregion

            #region 설정

            // 시리얼명
            tboxSerialName.Text = mTileStruct.SerialData.SerialName;
            // 포트
            cboxPort.SelectedIndex = mTileStruct.SerialData.PortNum;
            // 보드 레이트
            cboxBaudRate.SelectedIndex = (int)SerialStruct.BaudRateToIndex(mTileStruct.SerialData.BaudRate);
            // 데이터 비트
            cboxDataBit.SelectedIndex = (int)SerialStruct.DataBitToIndex(mTileStruct.SerialData.DataBit);
            // 패리티 코드
            cboxParity.SelectedIndex = (int)mTileStruct.SerialData.ParityCode;
            // 정지 비트
            cboxStopBit.SelectedIndex = (int)mTileStruct.SerialData.StopBitCode;
            // 흐름 제어
            cboxFlow.SelectedIndex = (int)mTileStruct.SerialData.FlowControl;

            // 매크로 활성화
            toggleEnable.Checked = mTileStruct.SerialData.MacroEnable;
            // 반복 딜레이
            tboxDelay.Text = mTileStruct.SerialData.RunDelay.ToString();
            // 타일 색상
            cboxTileColor.SelectedIndex = (int)mTileStruct.TileColor;

            // 로그 저장
            toggleLogSave.Checked = mTileStruct.SerialData.LogSave;
            // 로그 저장 타입
            cboxLogSaveType.SelectedIndex = (int)mTileStruct.SerialData.LogSaveType;
            // 로그 구분자
            cboxLogToken.SelectedIndex = (int)mTileStruct.SerialData.LogToken;
            // 로그 저장 경로
            tboxLogSavePath.Text = mTileStruct.SerialData.LogSavePath;

            #endregion
        }