Exemplo n.º 1
0
        private bool MatchingList_Edit(int nSelectIndex, MatchingModel editMatchingModel)
        {
            //추가 성공 여부
            bool bReturn = false;

            if (0 <= nSelectIndex)
            {
                //리스트 갱신
                MatchingModel itemM = this.listMatching[nSelectIndex];
                itemM.Pin          = editMatchingModel.Pin;
                itemM.Action_Key   = editMatchingModel.Action_Key;
                itemM.Action_Shift = editMatchingModel.Action_Shift;
                itemM.Action_Ctrl  = editMatchingModel.Action_Ctrl;
                itemM.Action_Alt   = editMatchingModel.Action_Alt;
                itemM.Explanation  = editMatchingModel.Explanation;

                //UI 갱신
                ListViewItem findLVItem = lvMatching.Items[nSelectIndex];
                string[]     arrItemM   = itemM.ToArray();
                //findLVItem.SubItems[0].Text = arrItemM[0];
                findLVItem.SubItems[1].Text = arrItemM[1];
                findLVItem.SubItems[2].Text = arrItemM[2];

                bReturn = true;
            }
            else
            {//선택지가 없다.
                MessageBox.Show("선택된 데이터가 없습니다.");
            }

            return(bReturn);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 매칭용 데이터 추가
        /// </summary>
        /// <param name="matchingModel"></param>
        /// <returns></returns>
        private bool MatchingList_Add(MatchingModel matchingModel)
        {
            //추가 성공 여부
            bool bReturn = false;

            MatchingModel findM
                = this.listMatching
                  .Where(m => m.Pin == matchingModel.Pin)
                  .FirstOrDefault();

            if (null == findM)
            {
                //리스트에 추가
                listMatching.Add(matchingModel);

                //리스트 뷰에 추가
                MatchingList_UI_Add(matchingModel);

                bReturn = true;
            }
            else
            {
                MessageBox.Show("이미 있는 '핀'입니다.");
            }

            return(bReturn);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 리스트 뷰에 추가
        /// </summary>
        /// <param name="matchingModel"></param>
        private void MatchingList_UI_Add(MatchingModel matchingModel)
        {
            //리스트 뷰에 추가
            ListViewItem newLVI
                = new ListViewItem(matchingModel.ToArray());

            lvMatching.Items.Add(newLVI);
        }
Exemplo n.º 4
0
        private void btnItemEdit_Click(object sender, EventArgs e)
        {
            MatchingModel newM = new MatchingModel();

            newM.Pin = this.txtItemPin.Text;

            newM.Action_Key    = txtKey.Text;
            newM.Action_VKCode = PressKeyTempSave;
            newM.Action_Shift  = cbShift.Checked;
            newM.Action_Ctrl   = cbCtrl.Checked;
            newM.Action_Alt    = cbAlt.Checked;

            newM.Explanation = this.txtExplanation.Text;

            if (true == this.MatchingList_Edit(lvMatching.SelectedIndices[0], newM))
            {//성공
                //내용 지우기
                MatchingList_Select(-1);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 선택된 인덱스의 정보를 UI에 표시한다.
        /// </summary>
        /// <param name="nSelectIdex"></param>
        /// <returns></returns>
        private bool MatchingList_Select(int nSelectIdex)
        {
            if (0 <= nSelectIdex)
            {
                MatchingModel findM = this.listMatching[nSelectIdex];

                //내용 체우기
                txtItemPin.Text     = findM.Pin;
                txtKey.Text         = findM.Action_Key;
                PressKeyTempSave    = findM.Action_VKCode;
                cbShift.Checked     = findM.Action_Shift;
                cbCtrl.Checked      = findM.Action_Ctrl;
                cbAlt.Checked       = findM.Action_Alt;
                txtExplanation.Text = findM.Explanation;

                //핀 수정 못하게 막기
                txtItemPin.Enabled = false;
            }
            else
            {
                //내용 지우기
                txtItemPin.Text     = string.Empty;
                txtKey.Text         = string.Empty;
                PressKeyTempSave    = 0;
                cbShift.Checked     = false;
                cbCtrl.Checked      = false;
                cbAlt.Checked       = false;
                txtExplanation.Text = string.Empty;

                //핀 수정 풀기
                txtItemPin.Enabled = true;
            }


            return(true);
        }