Пример #1
0
        public static List <CardInfo> GetReaderNames()
        {
            List <CardInfo> lst            = new List <CardInfo>();
            SmartCardIO     cardIO         = new SmartCardIO();
            List <String>   connectedCards = cardIO.GetConnected();

            foreach (String s in connectedCards)
            {
                CardInfo           info      = new CardInfo();
                ABC4TrustSmartCard smartCard = new ABC4TrustSmartCard(s);
                info.ReaderName = s;
                string    version;
                ErrorCode err = smartCard.GetVersion(out version);
                if (err.IsOK)
                {
                    info.CardVersion = version;
                }
                CardMode cardMode;
                err = smartCard.GetMode(out cardMode);
                if (err.IsOK)
                {
                    info.CardMode = (int)cardMode;
                }
                lst.Add(info);
            }
            return(lst);
        }
Пример #2
0
 public static List<CardInfo> GetReaderNames()
 {
   List<CardInfo> lst = new List<CardInfo>();
   SmartCardIO cardIO = new SmartCardIO();
   List<String> connectedCards = cardIO.GetConnected();
 
   foreach (String s in connectedCards)
   {
     CardInfo info = new CardInfo();
     ABC4TrustSmartCard smartCard = new ABC4TrustSmartCard(s);
     info.ReaderName = s;
     string version;
     ErrorCode err = smartCard.GetVersion(out version);
     if (err.IsOK)
     {
       info.CardVersion = version;
     }
     CardMode cardMode;
     err = smartCard.GetMode(out cardMode);
     if (err.IsOK)
     {
       info.CardMode = (int)cardMode;
     }
     lst.Add(info);
   }
   return lst;
 }
    public ABC4TrustSmartCard(String cardName)
    {
      this.cardName = cardName;
      sIO = new SmartCardIO();
      card = sIO.TryConnect(cardName);
      pStatus = ProofStatus.NOTSET;
      this.doProfile = ParseConfigManager.doTimeProfile();
      if (doProfile)
      {
        pInfo = ParseConfigManager.profileInfo;
      }

    }
 public MainWindow()
 {
   InitializeComponent();
   setupLoggers();
   menuRes = new MenuResourceDictionary();
   System.Windows.Controls.Menu m = menuRes.getMenu();
  
   cardIO = new SmartCardIO();
   monitor = cardIO.getMonitor();
   monitor.CardInserted += new CardInsertedEvent(CardEvent);
   monitor.CardRemoved += new CardRemovedEvent(CardEvent);
   monitor.Initialized += new CardInitializedEvent(CardEvent);
   monitor.StatusChanged += new StatusChangeEvent(StatusChanged);
   monitor.MonitorException += new MonitorExceptionEvent(MonitorException);
   monitor.Start(cardIO.getReaders());
 }
    private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      DataGrid dGrid = sender as DataGrid;
      if (dGrid.SelectedCells.Count == 0)
      {
        return;
      }
      CardInfo cInfo;
      try
      {
        cInfo = (CardInfo)dGrid.SelectedCells[0].Item;
      }
      catch (Exception)
      {
        return;
      }
      this.smartCard = new ABC4TrustSmartCard.ABC4TrustSmartCard(cInfo.ReaderName);
      this.sIO = this.smartCard.sIO;
      if ((CardMode)cInfo.CardMode == CardMode.VIRGIN)
      {
        this.modeButton.Click += modeButton_Root_Click;
        String content = "SetRootMode";
        this.modeButton.Content = content;
        this.modeButton.Visibility = Visibility.Visible;        
      }
      if ((CardMode)cInfo.CardMode == CardMode.ROOT)
      {
        this.initCard.Visibility = Visibility.Visible;
      }

    }
    private void UpdateDataGrid()
    {
      SmartCardIO cardIO = new SmartCardIO();
      List<String> connectedCards = cardIO.GetConnected();
      cardInfoLst = new List<CardInfo>();
      
      foreach (String s in connectedCards)
      {
        CardInfo info = new CardInfo();
        ABC4TrustSmartCard.ABC4TrustSmartCard smartCard = new ABC4TrustSmartCard.ABC4TrustSmartCard(s);
        info.ReaderName = s;
        string version;
        ErrorCode err = smartCard.GetVersion(out version);
        if (err.IsOK)
        {
          info.CardVersion = version;
        }
        CardMode cardMode;
        err = smartCard.GetMode(out cardMode);
        if (err.IsOK)
        {
          info.CardMode = (int)cardMode;
        }
        cardInfoLst.Add(info);
      }

      this.dataGrid1.ItemsSource = cardInfoLst;
      this.modeButton.Visibility = Visibility.Hidden;
      this.initCard.Visibility = Visibility.Hidden;
    }