Beispiel #1
0
        public void ModifyInterFace()
        {
            picSelect.Visible = true;
            isSelect          = true;
            byte[]        arayTmp = new byte[0];
            FrmAddNewCard frmTmp  = new FrmAddNewCard(arayTmp, oNewDS, DeviceType, StrName, 1, ID);

            frmTmp.ShowDialog();
        }
Beispiel #2
0
        private void UserForNewDoor_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (oNewDS == null)
            {
                return;
            }
            if (oNewDS.MyCardInfo == null)
            {
                return;
            }
            picSelect.Visible = true;
            isSelect          = true;
            byte[]        arayTmp = new byte[0];
            FrmAddNewCard frmTmp  = new FrmAddNewCard(arayTmp, oNewDS, DeviceType, StrName, 1, ID);

            frmTmp.ShowDialog();
            int Width = Pnl.Width;
            int Heigh = Pnl.Height;

            Pnl.Controls.Clear();
            int WCount = Width / 150;
            int num    = 0;

            for (int i = 0; i < oNewDS.MyCardInfo.Count; i++)
            {
                NewDS.CardInfo temp = oNewDS.MyCardInfo[i];
                if (temp.CardType == Convert.ToByte(intTag))
                {
                    UserForNewDoor tmp = new UserForNewDoor(oNewDS, i, DeviceType, ShowType, StrName, Pnl, intTag, Frm);
                    tmp.Name = "Card" + num.ToString();
                    tmp.Left = (num % WCount) * 140 + 10;
                    tmp.Top  = (num / WCount) * 120 + 10;
                    Pnl.Controls.Add(tmp);
                    num = num + 1;
                }
            }
            if (Frm is FrmNewDS)
            {
                (Frm as FrmNewDS).SetCount();
            }
            else if (Frm is frmDS)
            {
                (Frm as frmDS).SetCount();
            }
        }
Beispiel #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                bool isHaveEmptyCard = false;
                for (int i = 0; i < oNewDS.MyCardInfo.Count; i++)
                {
                    if (oNewDS.MyCardInfo[i].CardType == 0)
                    {
                        isHaveEmptyCard = true;
                        break;
                    }
                }
                if (isHaveEmptyCard)
                {
                    byte[] arayTmp = new byte[0];
                    byte[] arayUID = new byte[0];
                    CsConst.MyBlnNeedF8 = true;
                    if (CsConst.mySends.AddBufToSndList(arayTmp, 0x3529, SubNetID, DevID, false, false, true, CsConst.minAllWirelessDeviceType.Contains(MyintDeviceType)) == true)
                    {
                        arayUID = new byte[CsConst.myRevBuf[26] + 1];
                        Array.Copy(CsConst.myRevBuf, 26, arayUID, 0, arayUID.Length);
                    }
                    else
                    {
                        MessageBox.Show(CsConst.mstrINIDefault.IniReadValue("Public", "99779", ""), ""
                                        , MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        return;
                    }
                    bool isExit = false;
                    int  ID     = 0;
                    for (int i = 0; i < oNewDS.MyCardInfo.Count; i++)
                    {
                        if (oNewDS.MyCardInfo[i].UIDL == arayUID[0])
                        {
                            arayTmp = new byte[arayUID[0]];
                            Array.Copy(arayUID, 1, arayTmp, 0, arayTmp.Length);
                            bool isEqual = true;
                            for (int j = 0; j < arayTmp.Length; j++)
                            {
                                if (arayTmp[j] != oNewDS.MyCardInfo[i].UID[j])
                                {
                                    isEqual = false;
                                }
                            }
                            if (isEqual)
                            {
                                isExit = true;
                                ID     = i;
                            }
                        }
                    }
                    if (isExit)
                    {
                        FrmAddNewCard frmTmp = new FrmAddNewCard(arayUID, oNewDS, MyintDeviceType, myDevName, 1, ID);
                        frmTmp.ShowDialog();
                        switch (SelectCardType)
                        {
                        case 1: btnValid_Click(btnValid, null); break;

                        case 2: btnValid_Click(btnLost, null); break;

                        case 3: btnValid_Click(btnFobib, null); break;
                        }
                        SetCount();
                    }
                    else
                    {
                        FrmAddNewCard frmTmp = new FrmAddNewCard(arayUID, oNewDS, MyintDeviceType, myDevName, 0, 0);
                        frmTmp.ShowDialog();
                        switch (SelectCardType)
                        {
                        case 1: btnValid_Click(btnValid, null); break;

                        case 2: btnValid_Click(btnLost, null); break;

                        case 3: btnValid_Click(btnFobib, null); break;
                        }
                        SetCount();
                    }
                }
                else
                {
                }
            }
            catch
            {
                MessageBox.Show(CsConst.mstrINIDefault.IniReadValue("Public", "99774", ""), ""
                                , MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            Cursor.Current = Cursors.Default;
        }