Пример #1
0
        private void UpdateDeatailsSettings(int intRowIndex)
        {
            oSensor.Chans[intRowIndex].bytRValue[0] = (byte)(Convert.ToInt32(dgvTemp[2, intRowIndex].Value.ToString()) / 256);
            oSensor.Chans[intRowIndex].bytRValue[1] = (byte)(Convert.ToInt32(dgvTemp[2, intRowIndex].Value.ToString()) % 256);
            oSensor.Chans[intRowIndex].bytRValue[2] = (byte)(Convert.ToInt32(dgvTemp[3, intRowIndex].Value.ToString()) / 256);
            oSensor.Chans[intRowIndex].bytRValue[3] = (byte)(Convert.ToInt32(dgvTemp[3, intRowIndex].Value.ToString()) % 256);
            oSensor.Chans[intRowIndex].bytRValue[4] = (byte)(Convert.ToInt32(dgvTemp[4, intRowIndex].Value.ToString()) / 256);
            oSensor.Chans[intRowIndex].bytRValue[5] = (byte)(Convert.ToInt32(dgvTemp[4, intRowIndex].Value.ToString()) % 256);

            oSensor.Chans[intRowIndex].blnBroadTemp = (dgvTemp[5, intRowIndex].Value.ToString().ToLower() == "true");

            if (cl7.Items.IndexOf(dgvTemp[6, intRowIndex].Value.ToString()) == cl7.Items.Count - 1)
            {
                oSensor.Chans[intRowIndex].bytSubID = 255;;  //子网ID
                oSensor.Chans[intRowIndex].bytDevID = 255;;  //设备ID
            }
            else
            {
                string strDevName = dgvTemp[6, intRowIndex].Value.ToString().Split('\\')[0].ToString();

                oSensor.Chans[intRowIndex].bytSubID = Convert.ToByte(strDevName.Split('-')[0]);;  //子网ID
                oSensor.Chans[intRowIndex].bytDevID = Convert.ToByte(strDevName.Split('-')[1]);;  //设备ID
            }

            string strTmp = dgvTemp[7, intRowIndex].Value.ToString();

            dgvTemp[7, intRowIndex].Value = HDLPF.IsNumStringMode(strTmp, 0, 100);

            oSensor.Chans[intRowIndex].byAdjustVal = byte.Parse(dgvTemp[7, intRowIndex].Value.ToString());
        }
Пример #2
0
 private void dgvMode_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     setVisible(false);
     if (e.RowIndex >= 0)
     {
         string strRelay1 = dgvMode[1, e.RowIndex].Value.ToString();
         string strDelay1 = dgvMode[2, e.RowIndex].Value.ToString();
         string strRelay2 = dgvMode[3, e.RowIndex].Value.ToString();
         string strDelay2 = dgvMode[4, e.RowIndex].Value.ToString();
         string strRelay3 = dgvMode[5, e.RowIndex].Value.ToString();
         string strDelay3 = dgvMode[6, e.RowIndex].Value.ToString();
         cb1.SelectedIndex = cb1.Items.IndexOf(cb1.Items.IndexOf(strRelay1));
         cb1.Text          = strRelay1;
         addcontrols(1, e.RowIndex, cb1);
         time1.Text = HDLPF.GetTimeFromString(strDelay1, '.');
         addcontrols(2, e.RowIndex, time1);
         cb2.SelectedIndex = cb2.Items.IndexOf(cb2.Items.IndexOf(strRelay2));
         cb2.Text          = strRelay2;
         addcontrols(3, e.RowIndex, cb2);
         time2.Text = HDLPF.GetTimeFromString(strDelay2, '.');
         addcontrols(4, e.RowIndex, time2);
         cb3.SelectedIndex = cb3.Items.IndexOf(cb3.Items.IndexOf(strRelay3));
         cb3.Text          = strRelay3;
         addcontrols(5, e.RowIndex, cb3);
         time3.Text = HDLPF.GetTimeFromString(strDelay3, '.');
         addcontrols(6, e.RowIndex, time3);
     }
 }
Пример #3
0
        private Boolean ReadServerURLInformation()
        {
            Boolean blnIsSuccess = false;

            try
            {
                Byte[] ArayTmp = null;
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x3020, bytSubID, bytDevID, false, true, true, false) == true)
                {
                    ArayTmp = new Byte[68];
                    Array.Copy(CsConst.myRevBuf, 25, ArayTmp, 0, 68);

                    URL.Text         = HDLPF.Byte2String(ArayTmp);
                    CsConst.myRevBuf = new byte[1200];
                    blnIsSuccess     = true;
                }
                else
                {
                    blnIsSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return(blnIsSuccess);
        }
Пример #4
0
        private void btnRead1A_Click(object sender, EventArgs e)
        {
            if (numSub.Value == 255 || numDevA.Value == 255)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            byte bytSub = Convert.ToByte(numSub.Value);
            byte bytDev = Convert.ToByte(numDevA.Value);

            byte[] ArayTmp = null;
            MbytFlag = 1;
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xF81A, bytSub, bytDev, false, false, false, false) == true)
            {
                byte[] arayRemark = new byte[20];
                for (int intI = 0; intI < 20; intI++)
                {
                    arayRemark[intI] = CsConst.myRevBuf[25 + intI];
                }
                lbModelVA.Text   = HDLPF.Byte2String(arayRemark);
                CsConst.myRevBuf = new byte[1200];
            }
            Cursor.Current = Cursors.Default;
        }
Пример #5
0
        private void Pic_DoubleClick(object sender, EventArgs e)
        {
            string MyPath = HDLPF.OpenFileDialog("PNG Image|*.png", "Add Icons");

            if (MyPath == null || MyPath == "")
            {
                return;
            }
            Image img = Image.FromFile(MyPath);

            (sender as PictureBox).Image = img;

            if (strPath == null || strPath == "")
            {
                return;
            }
            if (Pic.Image == null)
            {
                return;
            }
            Cursor.Current = Cursors.WaitCursor;
            Byte[] data = new byte[0];
            if (Pic.Image.Width == 272 && Pic.Image.Height == 480)
            {
                data = HDLPF.BackgroundColorfulImageToByte((Bitmap)Pic.Image, Pic.Image.Height, Pic.Image.Width);
            }
            else
            {
                data = HDLPF.ColorfulImageToByte((Bitmap)Pic.Image, Pic.Image.Height, Pic.Image.Width);
            }
            System.IO.File.WriteAllBytes(strPath, data);
            Cursor.Current = Cursors.Default;
        }
Пример #6
0
 private void DgCurtain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     txtSeries1.Visible = false;
     txtTimeMs.Visible  = false;
     if (mywdDeviceType == 706 || mywdDeviceType == 707 || mywdDeviceType == 713 || mywdDeviceType == 719)
     {
         if (e.ColumnIndex != 1 && e.ColumnIndex != 0 && e.ColumnIndex != 5)
         {
             lbRead.Controls.Add(txtTimeMs);
             txtTimeMs.Text = HDLPF.GetTimeFrmStringMs(lbRead[e.ColumnIndex, e.RowIndex].Value.ToString());
             txtTimeMs.Show();
             txtTimeMs.Visible = true;
             Rectangle rect = lbRead.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
             txtTimeMs.Size         = rect.Size;
             txtTimeMs.Top          = rect.Top;
             txtTimeMs.Left         = rect.Left;
             txtTimeMs.TextChanged += txtTimeMs_TextChanged;
         }
     }
     else
     {
         if (e.ColumnIndex != 1 && e.ColumnIndex != 0 && e.ColumnIndex != 5)
         {
             lbRead.Controls.Add(txtSeries1);
             txtSeries1.Text = HDLPF.GetTimeFromString(lbRead[e.ColumnIndex, e.RowIndex].Value.ToString(), ':');
             txtSeries1.Show();
             txtSeries1.Visible = true;
             Rectangle rect = lbRead.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
             txtSeries1.Size         = rect.Size;
             txtSeries1.Top          = rect.Top;
             txtSeries1.Left         = rect.Left;
             txtSeries1.TextChanged += new EventHandler(txtScene_TextChanged);
         }
     }
 }
Пример #7
0
        private void tsbDown_Click(object sender, EventArgs e)
        {
            try
            {
                byte bytTag     = Convert.ToByte(((ToolStripButton)sender).Tag.ToString());
                bool blnShowMsg = (CsConst.MyEditMode != 1);
                if (HDLPF.UploadOrReadGoOn(this.Text, bytTag, blnShowMsg))
                {
                    Cursor.Current = Cursors.WaitCursor;

                    CsConst.MyUPload2DownLists = new List <byte[]>();

                    string strName  = myDevName.Split('\\')[0].ToString();
                    byte   bytSubID = byte.Parse(strName.Split('-')[0]);
                    byte   bytDevID = byte.Parse(strName.Split('-')[1]);

                    byte[] ArayRelay = new byte[] { bytSubID, bytDevID, (byte)(mywdDevicerType / 256), (byte)(mywdDevicerType % 256), (byte)MyActivePage,
                                                    (byte)(mintIDIndex / 256), (byte)(mintIDIndex % 256),
                                                    Convert.ToByte(txtFrm.Text), Convert.ToByte(txtTo.Text) };
                    CsConst.MyUPload2DownLists.Add(ArayRelay);
                    CsConst.MyUpload2Down = Convert.ToByte(((ToolStripButton)sender).Tag.ToString());
                    FrmDownloadShow Frm = new FrmDownloadShow();
                    Frm.FormClosing += new FormClosingEventHandler(UpdateDisplayInformationAccordingly);
                    Frm.ShowDialog();
                }
            }
            catch
            {
            }
        }
Пример #8
0
        private void txtConn_Leave(object sender, EventArgs e)
        {
            string str = txtFrm.Text;

            txtFrm.Text           = HDLPF.IsNumStringMode(str, 1, 30);
            txtFrm.SelectionStart = txtFrm.Text.Length;
        }
Пример #9
0
        private void tslRead_Click(object sender, EventArgs e)
        {
            byte bytTag     = Convert.ToByte(((ToolStripButton)sender).Tag.ToString());
            bool blnShowMsg = (CsConst.MyEditMode != 1);

            if (HDLPF.UploadOrReadGoOn(this.Text, bytTag, blnShowMsg))
            {
                Cursor.Current = Cursors.WaitCursor;
                // SetVisableForDownOrUpload(false);
                // ReadDownLoadThread();  //增加线程,使得当前窗体的任何操作不被限制

                CsConst.MyUPload2DownLists = new List <byte[]>();

                string strName  = myDevName.Split('\\')[0].ToString();
                byte   bytSubID = byte.Parse(strName.Split('-')[0]);
                byte   bytDevID = byte.Parse(strName.Split('-')[1]);

                byte[] ArayRelay = new byte[] { bytSubID, bytDevID, (byte)(mywdDeviceType / 256), (byte)(mywdDeviceType % 256),
                                                (byte)MyActivePage, (byte)(myintDIndex / 256), (byte)(myintDIndex % 256) };
                CsConst.MyUPload2DownLists.Add(ArayRelay);
                CsConst.MyUpload2Down = Convert.ToByte(((ToolStripButton)sender).Tag.ToString());
                FrmDownloadShow Frm = new FrmDownloadShow();
                if (CsConst.MyUpload2Down == 0)
                {
                    Frm.FormClosing += new FormClosingEventHandler(UpdateDisplayInformationAccordingly);
                }
                Frm.ShowDialog();
            }
        }
Пример #10
0
 public Boolean ReadButtonRemark(byte SubNetID, byte DeviceID, int DeviceType, bool isShowMessage)
 {
     try
     {
         byte[] ArayTmp = null;
         int    CMD     = 0xE004;
         if (EnviroNewDeviceTypeList.EnviroNewPanelDeviceTypeList.Contains(DeviceType))
         {
             ArayTmp    = new byte[4];
             ArayTmp[0] = Convert.ToByte(ID + 1);
             ArayTmp[1] = 5;
             ArayTmp[2] = 0;
             ArayTmp[3] = 9;
         }
         //读取备注
         if (CsConst.mySends.AddBufToSndList(ArayTmp, CMD, SubNetID, DeviceID, false, isShowMessage, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
         {
             byte[] arayRemark = new byte[20];
             Array.Copy(CsConst.myRevBuf, 26, arayRemark, 0, 20);
             Remark = HDLPF.Byte2String(arayRemark);
             HDLUDP.TimeBetwnNext(1);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Пример #11
0
        public String ReadButtonRemark(Byte SubNetID, Byte DeviceID, int DeviceType, int RemoteAddress)
        {
            String currentRemark = "";
            Byte   ExtraLength   = 0;

            if (IPmoduleDeviceTypeList.RFIpModuleV2.Contains(DeviceType))
            {
                ExtraLength = 1;
            }
            Byte[] ArayTmp = new Byte[1 + 1];
            ArayTmp[0] = ID;
            if (ExtraLength != 0)
            {
                ArayTmp[1] = (Byte)RemoteAddress;
            }
            //读取备注
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xE004, SubNetID, DeviceID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
            {
                byte[] arayRemark = new byte[20];
                Array.Copy(CsConst.myRevBuf, 26, arayRemark, 0, 20);
                currentRemark    = HDLPF.Byte2String(arayRemark);
                CsConst.myRevBuf = new byte[1200];
            }
            return(currentRemark);
        }
Пример #12
0
        private void tslRead_Click(byte bytTag)
        {
            bool blnShowMsg = (CsConst.MyEditMode != 1);

            if (HDLPF.UploadOrReadGoOn(this.Text, bytTag, blnShowMsg))
            {
                Cursor.Current = Cursors.WaitCursor;
                UpdateActivePageIndexFromUint();
                CsConst.MyUPload2DownLists = new List <byte[]>();

                string strName  = myDevName.Split('\\')[0].ToString();
                byte   bytSubID = byte.Parse(strName.Split('-')[0]);
                byte   bytDevID = byte.Parse(strName.Split('-')[1]);

                byte[] ArayRelay = new byte[] { bytSubID, bytDevID, (byte)(mywdDeviceType / 256), (byte)(mywdDeviceType % 256),
                                                (byte)MyActivePage, (byte)(myintDIndex / 256), (byte)(myintDIndex % 256) };
                CsConst.MyUPload2DownLists.Add(ArayRelay);
                CsConst.MyUpload2Down = bytTag;
                FrmDownloadShow Frm = new FrmDownloadShow();
                if (bytTag == 0)
                {
                    Frm.FormClosing += new FormClosingEventHandler(UpdateDisplayInformationAccordingly);
                }
                Frm.ShowDialog();
            }
        }
Пример #13
0
        private void gridValueTable_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }
            if (gridValueTable.Rows == null || gridValueTable.RowCount == 0)
            {
                return;
            }
            if (arrCurrentCurve == null || arrCurrentCurve.Length == 0)
            {
                arrCurrentCurve = new short[101];
            }

            try
            {
                String sTmpValue = gridValueTable[e.ColumnIndex, e.RowIndex].Value.ToString();
                sTmpValue = HDLPF.IsNumStringMode(sTmpValue, 0, 255);
                arrCurrentCurve[e.RowIndex] = Convert.ToInt16(sTmpValue);
                DisplayCurveAccordinglyBuffer();
            }
            catch
            { }
        }
Пример #14
0
        private void btnReadM_Click(object sender, EventArgs e)
        {
            if (CsConst.myRevBuf == null)
            {
                return;
            }
            CsConst.MyBlnWait15FE = true;
            CsConst.WaitMore      = false;

            if (cboDevM.Text != null && cboDevM.Text != "")
            {
                MybytSubID = CsConst.myOnlines[cboDevM.SelectedIndex].bytSub;
                MybytDevID = CsConst.myOnlines[cboDevM.SelectedIndex].bytDev;
                //  cboDevM.SelectedIndex = 0;
                // 1 select a path
                string strFileName = HDLPF.SaveFileDialogAccordingly("Save To", "raw files (*.raw)|*.raw");
                if (strFileName == null)
                {
                    return;
                }

                MystrPath   = strFileName;
                tbLocM.Text = MystrPath;
            }
        }
Пример #15
0
 private void showBasicInfo()
 {
     try
     {
         isRead = true;
         if (MyMHIC == null)
         {
             return;
         }
         sb1.Value = MyMHIC.Backlight;
         sb2.Value = MyMHIC.Ledlight;
         byte[] arayRemark = new byte[8];
         Array.Copy(MyMHIC.arayHotel, 0, arayRemark, 0, 8);
         txtName.Text     = HDLPF.Byte2String(arayRemark);
         txtBuilding.Text = GlobalClass.AddLeftZero(MyMHIC.arayHotel[8].ToString("X"), 2);
         txtStorey.Text   = GlobalClass.AddLeftZero(MyMHIC.arayHotel[9].ToString("X"), 2);
         txtRoom.Text     = GlobalClass.AddLeftZero(MyMHIC.arayHotel[10].ToString("X"), 2) +
                            GlobalClass.AddLeftZero(MyMHIC.arayHotel[11].ToString("X"), 2);
         chbEnable.Checked = (MyMHIC.arayHotel[12] == 1);
     }
     catch
     {
     }
     isRead = false;
 }
Пример #16
0
        private void DisplayIPProjectInformation(Byte[] RevData)
        {
            byte[] arayRemark = new byte[20];
            HDLSysPF.CopyRemarkBufferFrmMyRevBuffer(RevData, arayRemark, 26);
            this.strGrpName = HDLPF.Byte2String(arayRemark);

            arayRemark = new byte[20];
            HDLSysPF.CopyRemarkBufferFrmMyRevBuffer(RevData, arayRemark, 46);
            this.strProName = HDLPF.Byte2String(arayRemark);

            arayRemark = new byte[8];
            for (int intI = 0; intI < 8; intI++)
            {
                arayRemark[intI] = RevData[66 + intI];
            }
            this.strUser = HDLPF.Byte2String(arayRemark);

            arayRemark = new byte[8];
            for (int intI = 0; intI < 8; intI++)
            {
                arayRemark[intI] = RevData[74 + intI];
            }
            this.strPWD          = HDLPF.Byte2String(arayRemark);
            cbType.SelectedIndex = this.ConnetionType;
            tbGroup.Text         = this.strGrpName;
            tbProject.Text       = this.strProName;
            tbUser.Text          = this.strUser;
            tbPWD.Text           = this.strPWD;
            CsConst.myRevBuf     = new byte[1200];
        }
Пример #17
0
 public bool DownLoadInfoFrmDevice(string DevNam, int wdDeviceType, int intActivePage, int num1, int num2)
 {
     string strMainRemark = DevNam.Split('\\')[1].Trim();
     DevNam = DevNam.Split('\\')[0].Trim();
     byte bytSubID = byte.Parse(DevNam.Split('-')[0].ToString());
     byte bytDevID = byte.Parse(DevNam.Split('-')[1].ToString());
     byte[] ArayTmp = null;
     if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x000E, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == false)
     {
         return false;
     }
     else
     {
         byte[] arayRemark = new byte[20];
         for (int intI = 0; intI < 20; intI++) { arayRemark[intI] = CsConst.myRevBuf[25 + intI]; }
         DeviceName = bytSubID.ToString() + "-" + bytDevID.ToString() + "\\" + HDLPF.Byte2String(arayRemark);
         CsConst.myRevBuf = new byte[1200];
     }
     if (CsConst.isRestore)
     {
         num1 = 1;
         num2 = 64;
     }
     if (intActivePage == 0 || intActivePage == 1)
     {
         myACSetting = new List<ThirdPartAC>();
         for (int i = num1; i <= num2; i++)
         {
             ArayTmp = new byte[1];
             ArayTmp[0] = Convert.ToByte(i);
             if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x0240, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
             {
                 ThirdPartAC temp = new ThirdPartAC();
                 temp.ID = Convert.ToByte(i);
                 temp.ACNO = CsConst.myRevBuf[26];
                 temp.Enable = CsConst.myRevBuf[27];
                 temp.CoolMasterAddress = CsConst.myRevBuf[28];
                 temp.GroupID = CsConst.myRevBuf[29];
                 temp.arayACinfo = new byte[10];
                 Array.Copy(CsConst.myRevBuf, 30, temp.arayACinfo, 0, 10);
                 CsConst.myRevBuf = new byte[1200];
                 HDLUDP.TimeBetwnNext(ArayTmp.Length);
                 if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x0244, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
                 {
                     byte[] arayRemark = new byte[20];
                     Array.Copy(CsConst.myRevBuf, 26, arayRemark, 0, 20);
                     temp.Remark = HDLPF.Byte2String(arayRemark);
                     CsConst.myRevBuf = new byte[1200];
                     HDLUDP.TimeBetwnNext(ArayTmp.Length);
                 }
                 else return false;
                 myACSetting.Add(temp);
             }
             else return false;
             if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy) CsConst.calculationWorker.ReportProgress(i, null);
         }
     }
     if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy) CsConst.calculationWorker.ReportProgress(100, null);
     return true;
 }
Пример #18
0
        private void tbUpload_Click(object sender, EventArgs e)
        {
            if (CsConst.MyEditMode == 1)
            {
                string strFileName = HDLPF.OpenFileDialog("dat files (*.dat)|*.dat", "dat Files");
                if (strFileName == null)
                {
                    return;
                }

                Form form   = null;
                bool isOpen = true;
                foreach (Form frm in Application.OpenForms)
                {
                    if (frm.Name == "FrmRestrore")
                    {
                        form             = frm;
                        form.TopMost     = true;
                        form.WindowState = FormWindowState.Normal;
                        form.Activate();
                        form.TopMost = false;
                        isOpen       = false;
                        break;
                    }
                }
                if (isOpen)
                {
                    FrmRestrore frmTmp = new FrmRestrore(strFileName);
                    frmTmp.Show();
                }
            }
        }
Пример #19
0
        private void ReadVersionOfSomeRow(int row, DataGridView dgv)
        {
            Cursor.Current = Cursors.WaitCursor;
            string strVersion = null;

            GetSubnetIdAndDeviceIdFromSelectedOnlineDevice();

            int DeviceType = CsConst.myOnlines[currentSelectDeviceDindex].DeviceType;

            if (CsConst.mySends.AddBufToSndList(null, 0xEFFD, currentSelectDeviceSubnetId, currentSelectDeviceDeviceId, false, true, true, CsConst.mintWIFIDeviceType.Contains(DeviceType)) == true)
            {
                byte[] bytTmp = new byte[22];
                for (int i = 0; i < 22; i++)
                {
                    bytTmp[i] = CsConst.myRevBuf[i + 25];
                }
                strVersion = HDLPF.Byte2String(bytTmp);
                if (strVersion == "MIRACLE")
                {
                    strVersion = "V01.01";
                }
                if (tabSim.SelectedTab.Name == "tabDev")
                {
                    CsConst.myOnlines[currentSelectDeviceDindex].strVersion = strVersion;
                    dgOnline[8, row].Value = strVersion;
                }
            }
            Cursor.Current = Cursors.Default;
        }
Пример #20
0
        private void DgMode_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (e.ColumnIndex == -1)
            {
                return;
            }
            if (e.RowIndex == -1)
            {
                return;
            }
            if (DgMode.RowCount == 0)
            {
                return;
            }
            if (e.ColumnIndex == 3)
            {
                DgMode.Controls.Add(txtScene);
                txtScene.Text = HDLPF.GetTimeFromString(DgMode[3, e.RowIndex].Value.ToString(), '.');

                Rectangle rect = DgMode.GetCellDisplayRectangle(3, e.RowIndex, true);
                txtScene.Size = rect.Size;
                txtScene.Top  = rect.Top;
                txtScene.Left = rect.Left;
                txtScene.Show();
                txtScene.Visible      = true;
                txtScene.TextChanged += new EventHandler(txtScene_TextChanged);
            }
            else
            {
                txtScene.Visible = false;
            }
        }
Пример #21
0
        private void txtLux_Leave(object sender, EventArgs e)
        {
            string str = txtLux.Text;

            txtLux.Text           = HDLPF.IsNumStringMode(str, 0, 100);
            txtLux.SelectionStart = txtLux.Text.Length;
        }
Пример #22
0
        private void tbTimer_Leave(object sender, EventArgs e)
        {
            string str = tbTimer.Text;
            int    num = Convert.ToInt32(tbTimer.Text);

            tbTimer.Text           = HDLPF.IsNumStringMode(str, 1, 4);
            tbTimer.SelectionStart = tbTimer.Text.Length;
        }
Пример #23
0
        private void txtFrm_Leave(object sender, EventArgs e)
        {
            string str = txtFrm.Text;
            int    num = Convert.ToInt32(txtTo.Text);

            txtFrm.Text           = HDLPF.IsNumStringMode(str, 1, num);
            txtFrm.SelectionStart = txtFrm.Text.Length;
        }
Пример #24
0
        private void txtTo_TextChanged(object sender, EventArgs e)
        {
            string str = txtTo.Text;
            int    num = Convert.ToInt32(txtFrm.Text);

            txtTo.Text           = HDLPF.IsNumStringMode(str, num, MaxCount);
            txtTo.SelectionStart = txtTo.Text.Length;
        }
Пример #25
0
        void UpdateBufferWhenchanged(int intTag, string strTmp, DataGridView oDGV)
        {
            if (oDGV.SelectedCells == null)
            {
                return;
            }
            if (oDGV.SelectedRows == null)
            {
                return;
            }
            string strNo = HDLPF.GetNumFromString(strTmp);

            if (strNo == "")
            {
                strNo = "0";
            }

            switch (intTag)
            {
            case 0:
                foreach (DataGridViewRow r in oDGV.SelectedRows)
                {
                    if (r.Selected & r.Index != myintRowIndex)
                    {
                        oDGV[myintColIndex, r.Index].Value = strTmp;
                    }
                }
                break;

            case 1:
                int intTmp = Convert.ToInt16(strNo);
                foreach (DataGridViewRow r in oDGV.Rows)
                {
                    if (r.Selected & r.Index != myintRowIndex)
                    {
                        intTmp++;
                        oDGV[myintColIndex, r.Index].Value = strTmp.Replace(strNo, intTmp.ToString());
                    }
                }
                break;

            case 2:
                intTmp = Convert.ToInt16(strNo);
                foreach (DataGridViewRow r in oDGV.Rows)
                {
                    if (r.Selected & r.Index != myintRowIndex)
                    {
                        intTmp--;
                        if (intTmp <= 0)
                        {
                            intTmp = 255;
                        }
                        oDGV[myintColIndex, r.Index].Value = strTmp.Replace(strNo, intTmp.ToString());
                    }
                }
                break;
            }
        }
Пример #26
0
        private void btnBacks_Click(object sender, EventArgs e)
        {
            string strFileName = HDLPF.SaveFileDialog("IR Database");

            if (strFileName == null)
            {
                return;
            }
        }
Пример #27
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (myHVAC == null)
            {
                return;
            }
            if (myHVAC.bytSteps == null)
            {
                return;
            }
            if (DgMode.RowCount == 0)
            {
                return;
            }

            string strTmp = null;

            if (rbD.Checked)
            {
                myHVAC.bytSteps[0] = 0;
            }
            else if (rbC.Checked)
            {
                myHVAC.bytSteps[0] = 1;
            }

            for (int i = 0; i < DgMode.RowCount; i++)
            {
                for (int j = 0; j < DgMode.ColumnCount; j++)
                {
                    switch (j)
                    {
                    case 0:
                    case 1:
                    case 2:
                        if (DgMode[j, i].Value != null)
                        {
                            strTmp = DgMode[j, i].Value.ToString();
                        }
                        else
                        {
                            strTmp = cm1.Items[2].ToString();
                        }
                        DgMode[j, i].Value = HDLPF.IsRightStringMode(strTmp);
                        myHVAC.bytSteps[40 + i * 20 + j * 2] = Convert.ToByte(cm1.Items.IndexOf(strTmp));
                        break;

                    case 3:
                        myHVAC.bytSteps[40 + i * 20 + 1] = Convert.ToByte(HDLPF.GetTimeFromString(DgMode[3, i].Value.ToString(), '.'));
                        myHVAC.bytSteps[40 + i * 20 + 3] = Convert.ToByte(HDLPF.GetTimeFromString(DgMode[3, i].Value.ToString(), '.'));
                        myHVAC.bytSteps[40 + i * 20 + 5] = Convert.ToByte(HDLPF.GetTimeFromString(DgMode[3, i].Value.ToString(), '.'));
                        break;
                    }
                }
            }
            this.Close();
        }
Пример #28
0
 private void btnUser_Click(object sender, EventArgs e)
 {
     try
     {
         FileIndex = 0;
         UDPReceive.receiveQueueForAudio = new Queue <byte[]>();
         CsConst.MyBlnFinish             = false;
         CsConst.isStartUploadFile       = false;
         string MyPath = HDLPF.OpenFileDialog("WAV File|*.wav", "Choose File");
         if (MyPath == null || MyPath == "")
         {
             return;
         }
         FileStream fs = new FileStream(MyPath, FileMode.Open, FileAccess.Read);//创建文件流
         SourceFile = new byte[fs.Length];
         fs.Read(SourceFile, 0, SourceFile.Length);
         fs.Flush();
         fs.Close();
         int    FileLength  = SourceFile.Length;
         string strFileNmae = "share/sounds/linphone/rings/011.wav";
         byte[] arayTmp     = new byte[strFileNmae.Length + 6 + 2];
         int    DataLength  = strFileNmae.Length + 6;
         arayTmp[0] = Convert.ToByte(DataLength / 256);
         arayTmp[1] = Convert.ToByte(DataLength % 256);
         arayTmp[2] = 1;
         byte[] arayName = HDLUDP.StringToByte(strFileNmae);
         arayName.CopyTo(arayTmp, 3);
         arayTmp[strFileNmae.Length + 3] = 13;
         arayTmp[strFileNmae.Length + 4] = Convert.ToByte(FileLength / 256 / 256 / 256);
         arayTmp[strFileNmae.Length + 5] = Convert.ToByte(FileLength / 256 / 256 % 256);
         arayTmp[strFileNmae.Length + 6] = Convert.ToByte(FileLength / 256 % 256);
         arayTmp[strFileNmae.Length + 7] = Convert.ToByte(FileLength % 256);
         if (CsConst.mySends.AddBufToSndList(arayTmp, 0x1364, SubNetID, DevID, true, true, true, false) == true)
         {
             if (CsConst.isStartUploadFile)
             {
                 MyBackGroup                       = new BackgroundWorker();
                 MyBackGroup.DoWork               += new DoWorkEventHandler(calculationWorker_DoWork);
                 MyBackGroup.ProgressChanged      += new ProgressChangedEventHandler(calculationWorker_ProgressChanged);
                 MyBackGroup.WorkerReportsProgress = true;
                 MyBackGroup.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(calculationWorker_RunWorkerCompleted);
                 MyBackGroup.RunWorkerAsync();
                 MyBackGroup.WorkerSupportsCancellation = true;
                 frmProcessTmp = new FrmProcess();
                 frmProcessTmp.ShowDialog();
             }
             else
             {
                 MessageBox.Show(CsConst.mstrINIDefault.IniReadValue("public", "99535", ""));
             }
         }
     }
     catch
     {
     }
 }
Пример #29
0
        private void btnFindA_Click(object sender, EventArgs e)
        {
            string strFileName = HDLPF.OpenFileDialog("raw files (*.raw)|*.raw", "raw Files");

            if (strFileName == null)
            {
                return;
            }
            tbLocationA.Text = strFileName;
        }
Пример #30
0
        private void btnOpenM_Click(object sender, EventArgs e)
        {
            string strFileName = HDLPF.OpenFileDialog("bin files (*.bin)|*.bin", "Bin Files");

            if (strFileName == null)
            {
                return;
            }
            tbLocM.Text = strFileName;
        }