Пример #1
0
		/* This method is called when the user click on the '+' button */
		void BtPlusClick(object sender, EventArgs e)
		{
			/* Show the form enabling to specify a device */
			/* ------------------------------------------ */
			AddDeviceForm form = new AddDeviceForm();
			DialogResult dr = form.ShowDialog();
			
			/* The form has been closed: retrieve the desired device's characteristics */
			/* ----------------------------------------------------------------------- */
			if (dr == DialogResult.OK)
			{
				if (form.device_type == AddDeviceForm.FUNKYGATE)
				{
					/* The user has chosen a FunkyGate TCP reader: create the object, ... */
					SpringCardIWM2_Network_Reader reader = new SpringCardIWM2_Network_Reader(form.ip, form.port, form.com_type, form.key);
					
					/* ... indicate whether the cryptographic detail must be printed, ... */
					reader.SetShowCrypto(ShowCrypto);
					
					/* ... add it in the list, ... */
					devices.Add(reader);
					
					/* ..., the controller, ... */
					SpringCardIWM2_Reader_Controller c = new SpringCardIWM2_Reader_Controller(reader, form.ip.ToString() + ":" + form.port, SpringCardIWM2_Reader_Controller.TYPE_FKG_TCP);
					
					/* ... add the controller on the form, ... */
					flpMiddle.Controls.Add(c);
				
					/* ... and finally scroll to it */
					flpMiddle.ScrollControlIntoView(c);
					
				} else
				{
					/* The user has chosen a Handydrummer: create the object, ... */
					SpringCardIWM2_Network_GPIOs hd = new SpringCardIWM2_Network_GPIOs(form.ip, form.port, form.com_type, form.key);

					/* ... indicate whether the cryptographic detail must be printed, ... */
					hd.SetShowCrypto(ShowCrypto);
					
					/* ... add it in the list, ... */
					devices.Add(hd);
					
					/* ... the controller, ... */
					SpringCardIWM2_GPIOs_Controller c = new SpringCardIWM2_GPIOs_Controller(hd, form.ip.ToString() + ":" + form.port);
					
					/* ... add the controller on the form, ... */
					flpMiddle.Controls.Add(c);
					
					/* ... and finally scroll to it */
					flpMiddle.ScrollControlIntoView(c);
					
				}
			}

		}
Пример #2
0
		/* This method is called when the user clicks on the '+' */
		void BtPlusClick(object sender, EventArgs e)
		{
			/* Show the form enabling to manage specific COM ports */
			/* --------------------------------------------------- */
			SpringCard_IWM2_Serial_Scheduler_Controller controller = new SpringCard_IWM2_Serial_Scheduler_Controller(this, schedulers, ShowFrames);
			controller.ShowDialog();
			
			
			/* The form has been closed: retrieve the scheduler and the potential reader */
			/* ------------------------------------------------------------------------- */
			SpringCardIWM2_Serial_Scheduler scheduler = controller.GetSelectedScheduler();		
			if (scheduler != null)
			{
				/* We have to update the list of schedulers, just in case a scheduler on a	 */ 
				/* COM port has been stopped and relaunched (in this case, there is another  */
 				/* object scheduling the same COM port)																			 */
 
				/* A scheduler with the same port name may already be present in list : */
				/* remove it first (it may have been closed by user in the dialog form)	*/
				RefineSchedulersList(schedulers, scheduler.GetPortName());
				
				/* and then add the new scheduler (it may be exactely the one we've removed) */
				schedulers.Add(scheduler);
				
			} 
			
			SpringCardIWM2_Serial_Reader reader = controller.GetSelectedReader();
			if (reader != null)
			{
				/* If a reader has been selected, add a new controller to interact with it */
				SpringCardIWM2_Reader_Controller c = new SpringCardIWM2_Reader_Controller(reader, reader.GetScheduler().GetPortName() + " - Addr. " + reader.GetAddress(), SpringCardIWM2_Reader_Controller.TYPE_FKG_RS485);
				flpMiddle.Controls.Add(c);
				flpMiddle.ScrollControlIntoView(c);
			}
		
		}