Exemple #1
0
        void MainFormShown(object sender, EventArgs e)
        {
            waitForm = new WaitForm();

            SplashForm f = new SplashForm();

            f.ShowDialog();

            if (AppConfig.ReadBoolean("reader_reconnect"))
            {
                ReaderList = new SCardReaderList();
                if (ReaderList != null)
                {
                    string reader_name = AppConfig.ReadString("reader_name");
                    if (ReaderList.Contains(reader_name))
                    {
                        Reader = new SCardReader(reader_name);
                        DisplayReaderPresent();
                        Reader.StartMonitor(new SCardReader.StatusChangeCallback(ReaderStatusChanged));
                        return;
                    }
                    ReaderList = null;
                }
            }

            SelectReader();
        }
Exemple #2
0
 void MainFormShown(object sender, EventArgs e)
 {
     if (AppConfig.ReadBoolean("reader_reconnect"))
     {
         if (AppConfig.ReadString("reader_mode") == "serial")
         {
             SCardReaderList_CcidOverSerial.BackgroundInstantiate(
                 new SCardReaderList_CcidOverSerial.BackgroundInstantiateCallback(OnSerialReaderListInstantiated),
                 AppConfig.ReadString("serial_port"),
                 true,
                 AppConfig.ReadBoolean("serial_use_lpcd"));
         }
         else
         {
             ReaderList = new SCardReaderList();
             if (ReaderList != null)
             {
                 string reader_name = AppConfig.ReadString("reader_name");
                 Logger.Trace("Looking for PC/SC reader '" + reader_name + "'");
                 if (ReaderList.Contains(reader_name))
                 {
                     Logger.Trace("Found!");
                     Reader = new SCardReader(reader_name);
                     DisplayReaderPresent();
                     Reader.StartMonitor(new SCardReader.StatusChangeCallback(ReaderStatusChanged));
                     return;
                 }
                 else
                 {
                     Logger.Trace("Not found!");
                     MessageBox.Show(this,
                                     "Failed to reconnect to the previous PC/SC reader. Please click the 'Reader' link to select another reader.",
                                     Title, MessageBoxButtons.OK,
                                     MessageBoxIcon.Exclamation);
                 }
                 ReaderList = null;
             }
             else
             {
                 MessageBox.Show(this,
                                 "The PC/SC subsystem doesn't seem to be running. Please check your system's configuration.",
                                 Title,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Exclamation);
             }
         }
     }
 }