コード例 #1
0
ファイル: CardReaderWizard.cs プロジェクト: CarverLab/Oyster
        private void CardReaderWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;
            else
            {
                MessageBox.Show("Illegal open attempt made on Forwarding Server Wizard");
                return;
            }
            if(this.Tag is OysterClassLibrary.CardReader)
            {
                CR = (OysterClassLibrary.CardReader)this.Tag;
                tbCardReaderAddress.Text = CR.Address;
                tbCardReaderPort.Text = CR.Port.ToString();
                chkIsOnSerialPort.Checked = CR.IsOnSerialPort;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                AR = F.ALLRooms();
                F.Dispose();
                RoomID = new string[AR.Count,2];
                Counter = 0;
                foreach(OysterClassLibrary.Room R in AR)
                {
                    cbCRRoom.Items.Add(R.Description);
                    RoomID[Counter,0] = R.Description;
                    RoomID[Counter,1] = R.ID.ToString();
                    Counter++;
                    if(R.ID == CR.RoomID)
                    {
                        cbCRRoom.Text = R.Description;
                    }
                }
                this.Text = "Editing " + CR.Address + ":" + CR.Port.ToString();
            }
            else
            {
                this.Text = "Creating New Card Reader";
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                AR = F.ALLRooms();
                int[] UO = F.GetUnassignedObjects();
                F.Dispose();
                RoomID = new string[AR.Count,2];
                Counter = 0;
                foreach(OysterClassLibrary.Room R in AR)
                {
                    cbCRRoom.Items.Add(R.Description);
                    if(R.ID == UO[1])
                        cbCRRoom.Text = R.Description;

                    RoomID[Counter,0] = R.Description;
                    RoomID[Counter,1] = R.ID.ToString();
                    Counter++;
                }
            }
        }