Esempio n. 1
0
        private void dgvRfbuttons_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1)
            {
                return;
            }
            if (e.RowIndex == -1)
            {
                return;
            }
            if (myIPModule == null)
            {
                return;
            }
            if (myIPModule.MyRemoteControllers == null)
            {
                return;
            }
            if (cboController.SelectedIndex == -1)
            {
                return;
            }
            Byte RemoteControllerID = (Byte)cboController.SelectedIndex;
            Byte PageID             = (Byte)cboPages.SelectedIndex;

            String Remark = dgvRfbuttons[e.ColumnIndex, e.RowIndex].Value.ToString();

            if (dgvRfbuttons.SelectedRows.Count > 1)
            {
                for (int i = 0; i < dgvRfbuttons.SelectedRows.Count; i++)
                {
                    dgvRfbuttons.SelectedRows[i].Cells[e.ColumnIndex].Value = Remark;
                    if (e.ColumnIndex == 1) // 备注
                    {
                        myIPModule.MyRemoteControllers[RemoteControllerID * IPmoduleDeviceTypeList.HowManyButtonsEachPage + PageID * 8 + e.RowIndex].Remark = Remark;
                    }
                    else if (e.ColumnIndex == 2) // 按键模式
                    {
                        Byte currentMode = ButtonMode.ConvertorKeyModesToPublicModeGroup(dgvRfbuttons[2, e.RowIndex].Value.ToString());
                        myIPModule.MyRemoteControllers[RemoteControllerID * IPmoduleDeviceTypeList.HowManyButtonsEachPage + PageID * 8 + e.RowIndex].Mode = currentMode;
                    }
                }
            }
        }
Esempio n. 2
0
        private void dgvKey_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (isRead)
            {
                return;
            }
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }
            if (dgvKey.CurrentRow.Index < 0)
            {
                return;
            }
            if (dgvKey.RowCount <= 0)
            {
                return;
            }
            Cursor.Current    = Cursors.WaitCursor;
            txtSeries.Visible = false;

            if (dgvKey[2, e.RowIndex].Value == null)
            {
                dgvKey[e.ColumnIndex, e.RowIndex].Value = "";
            }
            String Remark = dgvKey[2, e.RowIndex].Value.ToString();

            if (Remark == CsConst.mstrInvalid)
            {
                return;
            }

            Byte bTmpMode = ButtonMode.ConvertorKeyModesToPublicModeGroup(Remark);

            if (bTmpMode == 14)
            {
                addcontrols(3, e.RowIndex, txtSeries, dgvKey);
                string str = HDLPF.GetStringFromTime(MyMHIC.myKeySetting[e.RowIndex].Delay, ":");
                txtSeries.Text = HDLPF.GetTimeFromString(str, ':');
            }

            Cursor.Current = Cursors.Default;
        }
Esempio n. 3
0
        private void dgvListA_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (dgvListA.SelectedRows == null)
            {
                return;
            }
            if (dgvListA.Rows == null)
            {
                return;
            }
            try
            {
                if (e.ColumnIndex >= 1)
                {
                    Byte   Mode = ButtonMode.ConvertorKeyModesToPublicModeGroup(dgvListA[2, e.RowIndex].Value.ToString());
                    Byte[] ModeThatCouldMutexGroup   = new Byte[] { 4, 5, 7 };          //互斥的按键模式
                    Byte[] ModeThatCouldLinkageGroup = new Byte[] { 1, 2, 3, 4, 5, 6 }; // 可以关联的按键

                    dgvListA[6, e.RowIndex].ReadOnly = !ModeThatCouldMutexGroup.Contains(Mode);
                    dgvListA[7, e.RowIndex].ReadOnly = !ModeThatCouldLinkageGroup.Contains(Mode);

                    if (dgvListA[6, e.RowIndex].ReadOnly == true)
                    {
                        dgvListA[6, e.RowIndex].Value = clMutux.Items[0].ToString();
                    }

                    if (dgvListA[7, e.RowIndex].ReadOnly == true)
                    {
                        dgvListA[7, e.RowIndex].Value = CsConst.mstrInvalid;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        private void dgvKey_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (isRead)
            {
                return;
            }
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }
            if (dgvKey.CurrentRow.Index < 0)
            {
                return;
            }
            if (dgvKey.RowCount <= 0)
            {
                return;
            }
            Cursor.Current = Cursors.WaitCursor;

            if (dgvKey[e.ColumnIndex, e.RowIndex].Value == null)
            {
                dgvKey[e.ColumnIndex, e.RowIndex].Value = "";
            }
            String Remark = dgvKey[e.ColumnIndex, e.RowIndex].Value.ToString();

            if (dgvKey.SelectedRows.Count > 0)
            {
                for (int i = 0; i < dgvKey.SelectedRows.Count; i++)
                {
                    dgvKey.SelectedRows[i].Cells[e.ColumnIndex].Value = Remark;
                    int index = dgvKey.SelectedRows[i].Index;
                    switch (e.ColumnIndex)
                    {
                    case 1:
                        MyMHIC.myKeySetting[index].Remark = Remark;
                        break;

                    case 2:
                        MyMHIC.myKeySetting[index].Mode = ButtonMode.ConvertorKeyModesToPublicModeGroup(Remark);
                        if (MyMHIC.myKeySetting[index].Mode == 14)
                        {
                            addcontrols(3, index, txtSeries, dgvKey);
                            string str = HDLPF.GetStringFromTime(MyMHIC.myKeySetting[index].Delay, ":");
                            txtSeries.Text = HDLPF.GetTimeFromString(str, ':');
                        }
                        break;

                    case 3:
                        byte[] arayTmp = new byte[3];
                        arayTmp[0] = 18;
                        arayTmp[1] = Convert.ToByte(e.RowIndex + 1);
                        arayTmp[2] = 255;
                        string sTestFlag = dgvKey[4, e.RowIndex].Value.ToString();
                        if (sTestFlag.ToLower() == "false")
                        {
                            arayTmp[2] = 0;
                        }
                        if (CsConst.mySends.AddBufToSndList(arayTmp, 0xE3D8, SubNetID, DevID, false, false, false, CsConst.minAllWirelessDeviceType.Contains(MyDeviceType)) == true)
                        {
                            CsConst.myRevBuf = new byte[1200];
                        }
                        break;
                    }
                }
            }
            Cursor.Current = Cursors.Default;
        }