/// <summary> /// Disconnect sim card from reader /// </summary> private void SimDisconnect() { GlobalObj.CloseConnection(); UpdateSimControls(false); lstSimContacts.Clear(); MainClass.GtkWait(); }
/// <summary> /// Disconnect sim card from reader /// </summary> private void SimDisconnect() { GlobalObj.CloseConnection(); UpdateSimControls(false); mainwindow_Ui.LstSimContacts.Clear(); MainClass.QtWait(); }
/// <summary> /// Perform sim card connection and contacts read. /// </summary> private void SimConnect() { MainClass.QtWait(); if (GlobalObj.IsPowered) { // Disconnect card if needed GlobalObj.CloseConnection(); } // Connect to smartcard retStr = GlobalObj.AnswerToReset(ref ATR); // check for error if (retStr != "") { // error on answer to reset log.Error("MainWindowClass::SimConnect: " + retStr); MainClass.ShowMessage(this, "ERROR", retStr, MainClass.MessageType.Error); return; } // read sim contacts and fill list retStr = GlobalObjUI.SelectSimContactsList(); // check for error if (retStr != "") { if (retStr == GlobalObjUI.LMan.GetString("needpindisable")) { // Pin1 enabled MainClass.ShowMessage(this, "ERROR", retStr, MainClass.MessageType.Error); EnableSimPinControl(); return; } else { // error on reading contacts list GlobalObj.CloseConnection(); MainClass.ShowMessage(this, "ERROR", retStr, MainClass.MessageType.Error); return; } } ScanSimBefore(); mainwindow_Ui.LstSimContacts.Clear(); // Reset status values GlobalObjUI.SimADNStatus = 1; GlobalObjUI.SimADNPosition = 0; GlobalObjUI.SimADNError = ""; // Start thread for reading process isEnd = false; isReading = true; simThread = new System.Threading.Thread(new System.Threading.ThreadStart(GlobalObjUI.ReadSimContactsList)); simThread.Start(); }
public void ActionCancel(object sender, EventArgs args) { GlobalObj.CloseConnection(); MainWindow.Destroy(); MainWindow.Dispose(); Application.Quit(); }
/// <summary> /// Update selected reader /// </summary> private void UpdateSelectedReader(string reader) { GlobalObj.CloseConnection(); GlobalObj.SelectedReader = reader; mainwindow_Ui.statusbar.ShowMessage(GlobalObj.LMan.GetString("selreader") + ": " + reader); mainwindow_Ui.TxtATR.Text = ""; mainwindow_Ui.TxtResp.Text = ""; mainwindow_Ui.TxtCmd.Text = ""; }
/// <summary> /// Update selected reader /// </summary> private void UpdateSelectedReader(string reader) { GlobalObj.CloseConnection(); GlobalObj.SelectedReader = reader; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + reader); TxtATR.Text = ""; TxtResp.Text = ""; TxtCmd.Text = ""; }
/// <summary> /// Perform change of selected reader /// </summary> private void UpdateSelectedReader(string newSelReader) { GlobalObj.CloseConnection(); GlobalObj.SelectedReader = newSelReader; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + newSelReader); }
/// <summary> /// Console Application /// </summary> public static void StartApp() { // create readers list List <string> allreaders = new List <string>(); // loop for each managed readers type foreach (IReader rdr in GlobalObj.ReaderManager.Values) { allreaders.AddRange(rdr.Readers); } // display available readers Console.WriteLine("\r\n" + GlobalObj.LMan.GetString("readerslist") + ":"); for (int n = 0; n < allreaders.Count; n++) { Console.WriteLine(n.ToString().PadLeft(3) + ". " + allreaders[n]); } Console.WriteLine("\r\n" + GlobalObj.LMan.GetString("readersel")); Console.Write("> "); command = Console.ReadLine(); if (command == "EXIT") { // exit from application return; } try { // set reader to use GlobalObj.SelectedReader = allreaders[int.Parse(command)]; } catch (Exception Ex) { // error detected log.Error("ConsoleManager::StartApp: " + Ex.Message); return; } // Connect to smartcard ret = GlobalObj.AnswerToReset(ref ATR); if (ret != "") { // error on answer to reset log.Error("ConsoleManager::StartApp: " + ret); Console.WriteLine(ret); return; } Console.WriteLine("\r\nAnswer To Reset: " + ATR + "\r\n"); while (1 == 1) { Console.WriteLine(GlobalObj.LMan.GetString("cmdtosend")); Console.Write("> "); command = Console.ReadLine(); if (command == "EXIT") { // exit from loop and from application GlobalObj.CloseConnection(); break; } ret = GlobalObj.SendReceive(command, ref response); if (ret != "") { // error on send command log.Error("ConsoleManager::StartApp: " + ret); Console.WriteLine("< " + ret); } else { // response returned Console.WriteLine("< " + response + "\r\n"); } } }
/// <summary> /// Perform change of selected reader /// </summary> private void UpdateSelectedReader(string newSelReader) { GlobalObj.CloseConnection(); GlobalObj.SelectedReader = newSelReader; mainwindow_Ui.StatusBar.ShowMessage(GlobalObj.LMan.GetString("selreader") + ": " + newSelReader); }