Beispiel #1
0
		private void Login1_Load(object sender, System.EventArgs e)
		{
			MyGlobals.Logger.WriteLog("frmLogin loading");
			//Retrieve the last known COMPORT VALUE
            FrmParent = (frmSplash)this.Owner;
#if USE_CARDSCAN
			try
			{
				CardSwipe = new CARDSCAN.SerialPortScanClass();
                
			}
			catch(Exception Err)
			{
				MessageBox.Show(Err.Message,"Application Closing..");
				this.DialogResult = DialogResult.Abort;
				return;
			}
			
			RK = Registry.CurrentUser.OpenSubKey("Software\\" + sProductKey);
			if(RK == null)
			{
				RK = Registry.CurrentUser.OpenSubKey("Software",true);
				RK.CreateSubKey(sProductKey);
			}
			g_COMPORT = (string)RK.GetValue("COMPORT","COM1");

			FrmParent.Msg("Loading Card Reader Information...");

			//RETRIEVE ALL COMPORTS ON THIS COMPUTER
			RK = Registry.LocalMachine.OpenSubKey("HARDWARE\\DEVICEMAP\\SERIALCOMM");			
			string[] COM_PORTS = RK.GetSubKeyNames();
			int length = COM_PORTS.Length;
			COM_PORTS = RK.GetValueNames();
			length = COM_PORTS.Length;
			string nosey = "";
			if(length == 0)
			{
				cbConfigureCardScan.Items.Add("NO COMPORTS");
				g_COMPORT = "";
				NOCOM = true;
				btnLoginCardScan.Enabled = false;
				//btnScanIdCard.Enabled = false;
			}
			else    
			{

				for(int i = 0; i < COM_PORTS.Length;i++)
				{				
					nosey = (string)RK.GetValue(COM_PORTS[i].ToString());							
					cbConfigureCardScan.Items.Add(nosey);
					if(g_COMPORT == nosey)
						cbConfigureCardScan.Text = nosey;
			
					nosey = COM_PORTS[i].ToString();
				}
			}
#endif			
			FrmParent.Msg("Please enter Login information.");

			this.Focus();
			tbLoginName.Select();

		}