Exemplo n.º 1
0
        private void btnDeleteCR_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Card Reader?","Confirm permanent deletion",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.OK)
            {
                OysterClassLibrary.CardReader CR = (OysterClassLibrary.CardReader)lvCR.SelectedItems[0].Tag;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.DeleteCardReader(CR.ID);
                F.Dispose();
                Trace.WriteLine("Deleted Card Reader: " + CR.Address + "(" + CR.ID + ") From Scene:" + CR.CurrentRoom.Description + "(" + CR.CurrentRoom.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                lvCR.Items.Clear();
                FrmParent.LoginUser = FrmParent.OSystem.Refresh();
                bool DidOnce = false;
                //Reset_All();
                foreach(OysterClassLibrary.CardReader C in FrmParent.OSystem.CARDREADERS)
                {
                    if(UO[6] != C.ID)
                    {
                        ListViewItem LVI = lvCR.Items.Add(C.Address);
                        LVI.SubItems.Add(C.Port.ToString());
                        LVI.Tag = C;

                        if(DidOnce == false)
                        {
                            DidOnce = true;
                            LVI.Selected = true;
                            lvCR_SelectedIndexChanged(lvCR,new EventArgs());
                        }
                    }
                }
            }
        }