/// <summary> /// Initializes a new instance of the <see cref="FormeVRDemo"/> class /// </summary> public FormeVRDemo() { this.InitializeComponent(); try { X509Certificate2 csca = new X509Certificate2(EVRCardReaderAppSettings.CSCAFilename); this.evrCardReaderDemo = new eVRCardReader(csca, null, this.Monitor_CardInserted); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Initializes a new instance of the <see cref="FormeVRDemo"/> class /// </summary> public FormeVRDemo() { this.InitializeComponent(); try { var dir = EVRCardReaderAppSettings.CSCAFileDir; if (string.IsNullOrEmpty(dir)) { MessageBox.Show("No Directory set for certificates", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } var cscaFiles = Directory.GetFiles(dir); var number = cscaFiles.Length; if (number == 0) { MessageBox.Show("No certificates found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } else if (number == 1) { X509Certificate2 csca = new X509Certificate2(cscaFiles[0]); this.evrCardReaderDemo = new eVRCardReader(csca, null, this.Monitor_CardInserted); } else if (number > 1) { var index = 0; X509Certificate2[] cscaList = new X509Certificate2[number]; foreach (var cscaFile in cscaFiles) { cscaList[index] = new X509Certificate2(cscaFile); index++; } this.evrCardReaderDemo = new eVRCardReader(cscaList, null, this.Monitor_CardInserted); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }