示例#1
0
        /// <summary>
        /// 解锁
        /// </summary>
        /// <param name="cardnumber"></param>
        /// <param name="flag"></param>
        private void UnlockDistanceCard(int flag)
        {
            try
            {
                StopTimeOutThread();
                int index = -1;
                foreach (KeyValuePair <CbCardInfo, int> item in _mUnLockList)
                {
                    index++;
                    if (_mUnLockCardInfo != null && item.Key == _mUnLockCardInfo)
                    {
                        if (flag == 0)
                        {
                            item.Key.Unlocked = 0;
                            Dbhelper.Db.Update <CbCardInfo>(item.Key);
                            dgv_UnlockList["c_State", index].Value = Properties.Resources.check;
                            OnLockChange(item);
                        }
                        _mUnLockCardInfo = null;
                        continue;
                    }
                    if (_mUnLockCardInfo != null)
                    {
                        continue;
                    }
                    if (item.Key.Unlocked == 0)
                    {
                        continue;
                    }
                    _mUnLockCardInfo = item.Key;
                    DistanceTypeParameter typeparam = new DistanceTypeParameter()
                    {
                        Lock = 0, Distance = item.Key.Distance
                    };
                    int    typebyte = DistanceCardHelper.SetCardTypeByte(typeparam, 1);
                    byte[] by       = PortAgreement.GetDistanceContent(item.Key.CardNumber, typebyte);
                    PortHelper.SerialPortWrite(by);

                    StartTimeOutThread();
                    return;
                }
                foreach (KeyValuePair <CbCardInfo, int> item in _mUnLockList)
                {
                    if (item.Key.Unlocked != 0)
                    {
                        UseControlEnabled();
                        return;
                    }
                }
                dgv_UnlockList.Rows.Clear();
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                UseControlEnabled();
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
 private void CloseModule()
 {
     byte[] by = PortAgreement.GetCloseModule();
     if (PortHelper.IsConnection)
     {
         PortHelper.SerialPortWrite(by);
         Thread.Sleep(10);
     }
 }
示例#3
0
 private void ModuleTest()
 {
     _isModuleSet = false;
     byte[] by = PortAgreement.GetSetModule("ABCDEF");
     if (PortHelper.IsConnection)
     {
         PortHelper.SerialPortWrite(by);
         Thread.Sleep(150);
     }
 }
示例#4
0
 private void SetModuleComesBack(int value)
 {
     _isModuleSet = false;
     byte[] by = PortAgreement.GetSetModule(string.Format("AT+BACK={0}", value));
     if (PortHelper.IsConnection)
     {
         PortHelper.SerialPortWrite(by);
         Thread.Sleep(150);
     }
 }
示例#5
0
 private void SetModuleTid(int id)
 {
     _isModuleSet = false;
     byte[] by = PortAgreement.GetSetModule(string.Format("AT+TID=01{0}", id.ToString().PadLeft(8, '0')));
     if (PortHelper.IsConnection)
     {
         PortHelper.SerialPortWrite(by);
         Thread.Sleep(150);
     }
 }
示例#6
0
 private void SetModuleFrequency(int frequency)
 {
     _isModuleSet = false;
     frequency    = 127 - (frequency * 2 - 1);
     byte[] by = PortAgreement.GetSetModule(string.Format("AT+FREQ={0:X2}", frequency));
     if (PortHelper.IsConnection)
     {
         PortHelper.SerialPortWrite(by);
         Thread.Sleep(150);
     }
 }
示例#7
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            //获取延期时间
            DateTime newtime = t_NewTime.Value;
            //获取车场分区的值
            int partition = cb_CardPartition.SelectedIndex == 0 ? 0 : GetPartition();

            if (_mCardInfo != null)//定距卡
            {
                btn_Enter.Enabled         = false;
                _mCardInfo.StopTime       = newtime;
                _mCardInfo.FieldPartition = partition;

                try
                {
                    if (_mCardCounting == null)
                    {
                        //获取定距卡计数信息
                        _mCardCounting = Dbhelper.Db.FirstDefault <CbCardCountingState>(" and UseNumber = '" + _mCardInfo.CardNumber + "' ");
                        //计数加1
                        _mCardCounting.UseCounting = DistanceCardHelper.LimitCount(_mCardCounting.UseCounting);
                    }
                    //将数据写入定距卡
                    byte[] by = DistanceCardHelper.SetDistanceData(_mCardInfo.CardNumber, _mCardCounting.UseCounting, _mCardInfo.StopTime, _mCardInfo.FieldPartition);
                    PortHelper.SerialPortWrite(by);
                    StartTimeOut();
                }
                catch (Exception ex)
                {
                    btn_Enter.Enabled = true;
                    CustomExceptionHandler.GetExceptionMessage(ex);
                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (_mAssociateCard != null)//单张副卡
            {
                _mAssociateCard.UpdateTime      = newtime;
                _mAssociateCard.SubCardDivision = partition;
                this.Tag          = _mAssociateCard;
                this.DialogResult = DialogResult.OK;
            }
            else //批量延期
            {
                foreach (CbAssociateCard item in _mAssociateCards)
                {
                    item.UpdateTime      = newtime;
                    item.SubCardDivision = partition;
                }
                this.Tag          = _mAssociateCards;
                this.DialogResult = DialogResult.OK;
            }
        }
示例#8
0
        private void Btn_SerialPortConnection_Click(object sender, EventArgs e)
        {
            Tab4_Form.GetInstance.IsReadIcCard = false;
            if (PortHelper.sp.IsOpen)
            {
                try
                {
                    PortHelper.sp.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                SerialPortChange(PortHelper.IsConnection);
            }
            else
            {
                PortHelper.sp.PortName = cb_SerialPortName.SelectedItem.ToString();
                try
                {
                    PortHelper.sp.Open();

                    PortHelper.SerialPortWrite(PortAgreement.GetDistanceEncryption(Dal_DevicePwd.DistanceSystemPassword.Pwd));

                    Thread.Sleep(600);

                    if (!PortHelper.IsConnection)
                    {
                        PortHelper.sp.Close();
                        MessageBox.Show("当前端口连接失败,请选择正确的端口进行连接。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        SerialPortChange(PortHelper.IsConnection);
                    }
                }
                catch (Exception ex)
                {
                    CustomExceptionHandler.GetExceptionMessage(ex);
                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#9
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            string oldpwd = tb_OldPwd.Text.Trim();

            if (oldpwd.Length != tb_OldPwd.MaxLength)
            {
                DisplayContent("旧口令长度为 6 位数字,请重新输入旧口令。");
                tb_OldPwd.Focus();
                return;
            }
            try
            {
                IsEnd = false;
                byte[] by = PortAgreement.GetDistanceEncryption(oldpwd);
                PortHelper.SerialPortWrite(by);
                p_Top.Enabled = false;
            }
            catch (Exception ex)
            {
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#10
0
 /// <summary>
 /// 设置设备新密码
 /// </summary>
 private void SetDeviceNewPassword()
 {
     PortHelper.SerialPortWrite(PortAgreement.GetTemporaryEncryption(Dal_IcDevicePwd.TempIcDevicePassword.Pwd));
 }
示例#11
0
        /// <summary>
        /// 端口数据接收
        /// </summary>
        /// <param name="param"></param>
        private void SerialPortDataReceived(ParsingParameter param)
        {
            if (!PortHelper.IsConnection)
            {
                return;
            }
            if (PortHelper.CurrentForm != this)
            {
                return;
            }
            this.Invoke(new EventHandler(delegate
            {
                try
                {
                    if (param.FunctionAddress == 66)
                    {
                        long result = DataParsing.TemporaryContent(param.DataContent);
                        switch (param.Command)
                        {
                        case 204:
                            if (result == 0)
                            {
                                DisplayContent("临时 IC 卡加载成功。", Color.Black);
                            }
                            else
                            {
                                DisplayContent("临时 IC 卡加载失败,请确认旧密码是否正确或IC 卡是否放置在读写区域内。");
                            }
                            SetDeviceNewPassword();
                            IsEnd = true;
                            break;

                        case 221:
                            if (!IsEnd)
                            {
                                if (result == 0)
                                {
                                    DisplayContent("临时 IC 设备初始化成功。", Color.Black);
                                    PortHelper.SerialPortWrite(PortAgreement.GetTemporaryICEncryption(Dal_IcDevicePwd.TempIcDevicePassword.Pwd));
                                }
                                else
                                {
                                    DisplayContent("临时 IC 设备初始化失败。");
                                    p_Top.Enabled = true;
                                }
                            }
                            else
                            {
                                if (result != 0)
                                {
                                    SetDeviceNewPassword();
                                }
                                else
                                {
                                    p_Top.Enabled = true;
                                }
                            }
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    CustomExceptionHandler.GetExceptionMessage(ex);
                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }));
        }
示例#12
0
 /// <summary>
 /// 设置设备新密码
 /// </summary>
 private void SetDevicedNewPwd()
 {
     PortHelper.SerialPortWrite(PortAgreement.GetDistanceEncryption(Dal_DevicePwd.DistanceSystemPassword.Pwd));
 }
示例#13
0
        /// <summary>
        /// 端口数据接收
        /// </summary>
        /// <param name="param"></param>
        private void SerialPortDataReceived(ParsingParameter param)
        {
            if (!PortHelper.IsConnection)
            {
                return;
            }
            if (PortHelper.CurrentForm != this)
            {
                return;
            }
            this.Invoke(new EventHandler(delegate
            {
                if (tb_OldPwd.TextLength == 0)
                {
                    return;
                }
                try
                {
                    if (param.FunctionAddress == 65)
                    {
                        DistanceParameter distanceparam = DataParsing.DistanceParsingContent(param.DataContent);
                        switch (distanceparam.Command)
                        {
                        case 13:    //卡密码
                            switch (distanceparam.AuxiliaryCommand)
                            {
                            case 0:
                                if (distanceparam.TypeParameter.CardType == CardTypes.PasswordMistake)
                                {
                                    DisplayContent("5 米定距卡:" + distanceparam.CardNumber + " 加载失败。", (int)distanceparam.TypeParameter.CardType, Color.Red);
                                }
                                else
                                {
                                    DisplayContent("5 米定距卡:" + distanceparam.CardNumber + " 加载成功。", (int)distanceparam.TypeParameter.CardType, Color.Black);
                                }
                                break;

                            case 8:
                                DisplayContent("5 米定距卡加载结束。", Color.Black);
                                p_Top.Enabled = true;
                                IsEnd         = true;
                                SetDevicedNewPwd();
                                break;

                            default:
                                DisplayContent("5 米定距卡加载失败,请将 5 米定距卡放置在读写区域内,请重新操作。");
                                p_Top.Enabled = true;
                                break;
                            }
                            break;

                        case 160:    //设备密码
                            if (!IsEnd)
                            {
                                if (distanceparam.AuxiliaryCommand == 0)    //成功
                                {
                                    DisplayContent("多功能操作平台初始化设置成功,进行 5 米定距卡口令加载。", Color.Black);

                                    PortHelper.SerialPortWrite(PortAgreement.GetDistanceCardEncryption(Dal_DevicePwd.DistanceSystemPassword.Pwd));
                                }
                                else    //失败
                                {
                                    DisplayContent("多功能操作平台初始化设置失败,请重新操作。");
                                    p_Top.Enabled = true;
                                }
                            }
                            else
                            {
                                if (distanceparam.AuxiliaryCommand != 0)
                                {
                                    SetDevicedNewPwd();
                                }
                            }
                            break;

                        default:
                            DisplayContent("未知数据内容。");
                            p_Top.Enabled = true;
                            break;
                        }
                    }
                    else
                    {
                        DisplayContent("未知数据内容。");
                        p_Top.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    DisplayContent(ex.Message);
                    p_Top.Enabled = true;
                    CustomExceptionHandler.GetExceptionMessage(ex);
                }
            }));
        }
        /// <summary>
        /// 延期更新
        /// </summary>
        /// <param name="cardnumber"></param>
        /// <param name="flag"></param>
        private void SetUpdateCardData(int flag)
        {
            try
            {
                StopTimeOutThread();
                int index = -1;
                //遍历更新的集合
                foreach (KeyValuePair <CbCardInfo, int> item in _mUpdateList)
                {
                    index++;
                    if (_mCardInfo != null && item.Key == _mCardInfo)
                    {
                        if (flag != 0) //失败
                        {
                            dgv_DelayList["c_State", index].Value = Properties.Resources.block;
                        }
                        else
                        {
                            DateTime maxtime = DateTime.MinValue;
                            foreach (CbAssociateCard vicecarditem in _mViceCard)
                            {
                                if (vicecarditem.UseState == 1)
                                {
                                    vicecarditem.UseState          = 0;
                                    vicecarditem.AssociateCardTime = vicecarditem.UpdateTime;
                                }
                                if (vicecarditem.UpdateTime.Date > maxtime.Date)
                                {
                                    maxtime = vicecarditem.UpdateTime;
                                }
                            }
                            if (item.Key.StopTime.Date != maxtime.Date)
                            {
                                item.Key.StopTime = maxtime;
                                //更新主卡数据
                                Dbhelper.Db.Update <CbCardInfo>(item.Key);
                            }
                            //更新副卡数据
                            Dbhelper.Db.Update <CbAssociateCard>(_mViceCard.ToArray());
                            //更新计数数据
                            if (_mViceCardCounting != null)
                            {
                                _mViceCardCounting.Add(_mCardCounting);
                                Dbhelper.Db.Update <CbCardCountingState>(_mViceCardCounting.ToArray());
                            }
                            else
                            {
                                Dbhelper.Db.Update <CbCardCountingState>(_mCardCounting);
                            }
                            dgv_DelayList["c_State", index].Value = Properties.Resources.check;
                            OnUpdateChanage(item);
                        }
                        _mCardInfo = null;
                        continue;
                    }
                    if (_mCardInfo != null)
                    {
                        continue;
                    }
                    if (dgv_DelayList["c_State", index].Value == Properties.Resources.check)
                    {
                        continue;
                    }
                    _mCardInfo = item.Key;
                    //获取主卡计数字节数据
                    _mCardCounting = Dbhelper.Db.FirstDefault <CbCardCountingState>(" and UseNumber='" + item.Key.CardNumber + "' ");
                    //计数字节+1
                    _mCardCounting.UseCounting = DistanceCardHelper.LimitCount(_mCardCounting.UseCounting);
                    //获取副卡数据集
                    _mViceCard = Dbhelper.Db.ToList <CbAssociateCard>(" and CardID =" + item.Key.ID + " ");
                    byte[] by = null;
                    if (item.Key.CardType == (int)CardTypes.CombinationCard) //组合卡
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (CbAssociateCard vicecarditem in _mViceCard)
                        {
                            sb.AppendFormat(" UseNumber='{0}' or", vicecarditem.AssociateCardNumber);
                        }
                        if (sb.Length > 0)
                        {
                            sb.Remove(sb.Length - 2, 2);
                        }
                        //获取副卡集合的计数字节数据集
                        _mViceCardCounting = Dbhelper.Db.ToList <CbCardCountingState>(string.Format(" and ({0}) ", sb.ToString()));

                        List <CombinationCardViceCardDataParam> ViceCardParam = new List <CombinationCardViceCardDataParam>();
                        foreach (CbAssociateCard vicecarditem in _mViceCard)
                        {
                            CbCardCountingState vicecardcounting = GetViceCardCounting(vicecarditem.AssociateCardNumber);
                            ViceCardParam.Add(new CombinationCardViceCardDataParam()
                            {
                                ViceCardCount     = vicecardcounting.UseCounting,
                                ViceCardNumber    = vicecarditem.AssociateCardNumber,
                                ViceCardPartition = vicecarditem.SubCardDivision,
                                ViceCardTime      = vicecarditem.UpdateTime
                            });
                        }
                        by = DistanceCardHelper.SetDistanceData(item.Key.CardNumber, _mCardCounting.UseCounting, ViceCardParam);
                    }
                    else//车牌识别卡
                    {
                        List <LprCardViceCardParam> ViceCardParam = new List <LprCardViceCardParam>();
                        foreach (CbAssociateCard vicecarditem in _mViceCard)
                        {
                            ViceCardParam.Add(new LprCardViceCardParam()
                            {
                                PlateNumber       = vicecarditem.AssociateCardNumber,
                                ViceCardPartition = vicecarditem.SubCardDivision,
                                ViceCardTime      = vicecarditem.UpdateTime
                            });
                        }
                        by = DistanceCardHelper.SetDistanceData(item.Key.CardNumber, _mCardCounting.UseCounting, ViceCardParam);
                    }
                    //发送数据
                    PortHelper.SerialPortWrite(by);
                    //开始超时线程
                    StartTimeOutThread();
                    return;
                }
                btn_Enter.Enabled = PortHelper.IsConnection;
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                SetControlEnabled();
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#15
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            btn_Enter.Enabled = false;
            byte[] by = null;
            try
            {
                if (_mCardCounting == null)
                {
                    //获取主卡计数数据
                    _mCardCounting = Dbhelper.Db.FirstDefault <CbCardCountingState>(string.Format(" and UseNumber='{0}' ", _mCardInfo.CardNumber));
                    //当前计数+1
                    _mCardCounting.UseCounting = DistanceCardHelper.LimitCount(_mCardCounting.UseCounting);
                }
                //获取副卡集合
                _mViceCard = new List <CbAssociateCard>();
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < dgv_DataList.RowCount; i++)
                {
                    CbAssociateCard mvicecard = FormComm.GetDataSourceToClass <CbAssociateCard>(dgv_DataList, i);
                    _mViceCard.Add(mvicecard);
                    sb.AppendFormat(" UseNumber='{0}' or", mvicecard.AssociateCardNumber);
                }
                if (sb.Length > 0)
                {
                    sb = sb.Remove(sb.Length - 2, 2);
                }

                if (_mViceCardCounting == null && _mCardInfo.CardType == (int)CardTypes.CombinationCard)
                {
                    //获取副卡的计数数据
                    _mViceCardCounting = Dbhelper.Db.ToList <CbCardCountingState>(string.Format(" and ({0}) ", sb.ToString()));
                    List <CombinationCardViceCardDataParam> ViceCardParams = new List <CombinationCardViceCardDataParam>();
                    foreach (CbCardCountingState item in _mViceCardCounting)
                    {
                        //副卡计数+1
                        item.UseCounting = DistanceCardHelper.LimitCount(item.UseCounting);
                        //获取副卡
                        CbAssociateCard vicecard = GetViceCard(item.UseNumber);
                        ViceCardParams.Add(new CombinationCardViceCardDataParam()
                        {
                            ViceCardCount     = item.UseCounting,
                            ViceCardNumber    = item.UseNumber,
                            ViceCardPartition = vicecard.SubCardDivision,
                            ViceCardTime      = vicecard.UpdateTime
                        });
                    }
                    by = DistanceCardHelper.SetDistanceData(_mCardInfo.CardNumber, _mCardCounting.UseCounting, ViceCardParams);
                }
                else //车牌识别卡
                {
                    List <LprCardViceCardParam> ViceCardParams = new List <LprCardViceCardParam>();
                    foreach (CbAssociateCard item in _mViceCard)
                    {
                        ViceCardParams.Add(new LprCardViceCardParam()
                        {
                            PlateNumber       = item.AssociateCardNumber,
                            ViceCardPartition = item.SubCardDivision,
                            ViceCardTime      = item.UpdateTime
                        });
                    }
                    by = DistanceCardHelper.SetDistanceData(_mCardInfo.CardNumber, _mCardCounting.UseCounting, ViceCardParams);
                }
                PortHelper.SerialPortWrite(by);
                StartTimeOutThread();
            }
            catch (Exception ex)
            {
                btn_Enter.Enabled = true;
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#16
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            string oldpwd     = tb_OldPwd.Text.Trim();
            string newpwd     = tb_NewPwd.Text.Trim();
            string confirmpwd = tb_ConfirmPwd.Text.Trim();

            if (Dal_IcDevicePwd.TempIcDevicePassword.ID != 0)
            {
                if (oldpwd.Length != tb_OldPwd.MaxLength)
                {
                    DisplayContent("旧口令长度为 8 位数字,请重新输入旧口令。");
                    tb_OldPwd.Focus();
                    return;
                }
                if (oldpwd != Dal_IcDevicePwd.TempIcDevicePassword.Pwd)
                {
                    DisplayContent("验证旧口令错误,新重新输入口令。");
                    tb_OldPwd.Focus();
                    return;
                }
            }
            if (newpwd.Length != tb_NewPwd.MaxLength)
            {
                DisplayContent("新口令长度为 8 位数字,请重新输入新口令。");
                tb_NewPwd.Focus();
                return;
            }
            if (confirmpwd.Length != tb_ConfirmPwd.MaxLength)
            {
                DisplayContent("确认口令长度为 8 位数字,请重新输入确认口令。");
                tb_ConfirmPwd.Focus();
                return;
            }
            if (newpwd != confirmpwd)
            {
                DisplayContent("新口令与确认口令不一致。");
                tb_ConfirmPwd.Focus();
                return;
            }
            try
            {
                byte[] by = PortAgreement.GetTemporaryEncryption(newpwd);
                PortHelper.SerialPortWrite(by);
                if (Dal_IcDevicePwd.TempIcDevicePassword.ID == 0)
                {
                    //插入新密码
                    CbIcDeviePwd mTempIcPassword = new CbIcDeviePwd()
                    {
                        Pwd = newpwd
                    };
                    mTempIcPassword.ID = Dbhelper.Db.Insert <CbIcDeviePwd>(mTempIcPassword);
                    Dal_IcDevicePwd.TempIcDevicePassword   = mTempIcPassword;
                    Tab1_Form.GetInstance.btn_Tab5.Enabled = true;
                }
                else
                {
                    //更新新密码
                    Dal_IcDevicePwd.TempIcDevicePassword.Pwd = newpwd;
                    Dbhelper.Db.Update <CbIcDeviePwd>(Dal_IcDevicePwd.TempIcDevicePassword);
                }
                if (!PortHelper.IsConnection)
                {
                    DisplayContent("临时 IC 设备口令设置成功,请保管好口令。", Color.Black);
                    ClearTxt();
                }
            }
            catch (Exception ex)
            {
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }