public void ResetPassword(object sender, EventArgs e) { string value = email.GetValue() as string; user = UserController.FromEmail(value); if (user == null) { MessageBox.Show("Пользователь не найден"); return; } value = code.GetValue() as string; if (!user.CheckUserCode(value)) { MessageBox.Show("Неверный код"); return; } ChangePasswordForm changePasswordForm = new ChangePasswordForm(user); StandaloneView standaloneView = new StandaloneView(parentForm, changePasswordForm); parentForm.Close(); standaloneView.Show(); }
public void SendEmail(object sender, EventArgs e) { string userEmail = email.GetValue() as string; UserController user = UserController.FromEmail(userEmail); if (user == null) { MessageBox.Show("Пользователь не найден"); return; } UserCode userCode = user.SetUserCode(); MailController.Send(userEmail, userCode.Code); }
public static void OutputRecognitionResult(se.smartid.RecognitionResult recog_result) { Console.WriteLine("Document type: {0}", recog_result.GetDocumentType()); Console.WriteLine("Match results:"); MatchResultVector match_results = recog_result.GetMatchResults(); for (int i = 0; i < match_results.Count; i++) { Console.WriteLine(" Template Type = {0}", match_results[i].GetTemplateType()); Console.WriteLine(" Zone = {{({0:0.0}, {1:0.0}), ({2:0.0}, {3:0.0}), ({4:0.0}, {5:0.0}), ({6:0.0}, {7:0.0})}}", match_results[i].GetQuadrangle().GetPoint(0).x, match_results[i].GetQuadrangle().GetPoint(0).y, match_results[i].GetQuadrangle().GetPoint(1).x, match_results[i].GetQuadrangle().GetPoint(1).y, match_results[i].GetQuadrangle().GetPoint(2).x, match_results[i].GetQuadrangle().GetPoint(2).y, match_results[i].GetQuadrangle().GetPoint(3).x, match_results[i].GetQuadrangle().GetPoint(3).y); } Console.WriteLine("String fields:"); StringVector string_field_names = recog_result.GetStringFieldNames(); for (int i = 0; i < string_field_names.Count; i++) { StringField field = recog_result.GetStringField(string_field_names[i]); String is_accepted = field.IsAccepted() ? "[+]" : "[-]"; Utf16CharVector chars = field.GetValue().GetUtf16String(); StringBuilder value = new StringBuilder(); foreach (Char ch in chars) { value.Append(ch); } Console.WriteLine(" {0,-15} {1} {2}", field.GetName(), is_accepted, value); } Console.WriteLine("Image fields:"); StringVector image_field_names = recog_result.GetImageFieldNames(); for (int i = 0; i < image_field_names.Count; i++) { ImageField field = recog_result.GetImageField(image_field_names[i]); String is_accepted = field.IsAccepted() ? "[+]" : "[-]"; Console.WriteLine(" {0, -15} {1} W: {2} H: {3}", field.GetName(), is_accepted, field.GetValue().width, field.GetValue().height); } Console.WriteLine("Result terminal: {0}", recog_result.IsTerminal() ? "[+]" : "[-]"); }
public string TokenName() { return(_tokenName.GetValue()); }
public string Symbol() { return(_symbol.GetValue()); }
static int Main(string[] args) { if (args.Length < 1) { Console.WriteLine("usage reply_open_resp.exe mw-id=<middleware ID>"); return(-1); } //o Load the command-line input into a GMSEC Config object // A Config object is basically a key-value pair map which is used to // pass configuration options into objects such as Connections, // ConnectionManagers, Subscribe and Publish function calls, Messages, // etc. Config config = new Config(args); //o Since this example program uses an invalid message, we ensure the // validation check is disabled. config.AddValue("gmsec-msg-content-validate-all", "false"); // If it was not specified in the command-line arguments, set LOGLEVEL // to 'INFO' and LOGFILE to 'stdout' to allow the program report output // on the terminal/command line InitializeLogging(config); //o Ensure that the open-response is enabled config.AddValue("GMSEC-REQ-RESP", "OPEN-RESP"); //o Output GMSEC API version Log.Info(ConnectionManager.GetAPIVersion()); try { //o Create the Connection ConnectionManager connMgr = new ConnectionManager(config); //o Open the connection to the middleware Log.Info("Opening the connection to the middleware server"); connMgr.Initialize(); //o Output middleware client/wrapper version Log.Info(connMgr.GetLibraryVersion()); connMgr.Subscribe(OPEN_RESP_REQUEST_SUBJECT); //o Call receive() to synchronously retrieve a message that has // been received by the middleware client libraries // Timeout periods: // -1 - Wait forever // 0 - Return immediately // >0 - Time in milliseconds before timing out Message requestMsg = connMgr.Receive(-1); // Example error handling for calling receive() with a timeout if (requestMsg != null) { //o Display the XML representation of the received message Log.Info("Received a message\n" + requestMsg.ToXML()); //o Double-check the Message type to ensure that it is a request if (requestMsg.GetKind() == Message.MessageKind.REQUEST) { //o Get the name of the component who issued the request String component = ""; //o Construct a Reply message try { StringField compField = requestMsg.GetStringField("COMPONENT"); component = compField.GetValue(); } catch (Exception e) { Log.Warning(e.ToString()); } //o Set Status Code to indicate Successful Completion. // The GMSEC Interface Specification Document defines 6 // unique STATUS-CODE values: // 1 - Acknowledgement // 2 - Working/keep alive // 3 - Successful completion // 4 - Failed completion // 5 - Invalid request // 6 - Final message // If an asynchronous requestor is awaiting a reply, the // ReplyCallback in use will remain active for multiple // messages, so long as the messages it receives contain // a STATUS-CODE of either 1 or 2. String status_code = "3"; //o Set the reply subject. // See API Interface Specificaiton Document for // more information on Reply Message subjects. // Generally speaking, they are composed // accordingly: // [Spec].[Mission].[Satellite ID]. // [Message Type].[Component Name].[Status Code] String reply_subject = OPEN_RESP_REPLY_SUBJECT + "." + status_code; //o Create reply message using (Message replyMsg = new Message(reply_subject, Message.MessageKind.REPLY)) { //o Add fields to the reply message replyMsg.AddField(new StringField("ANSWER", "Yup, I'm here!")); replyMsg.AddField(new StringField("COMPONENT", component)); //o Display XML representation of the reply message Log.Info("Prepared Reply:\n" + replyMsg.ToXML()); //o Send Reply connMgr.Reply(requestMsg, replyMsg); } //o Wait for a moment to ensure that the reply is sent out for (int i = 0; i < 10; i++) { Thread.Sleep(100); } } //o Destroy request message to release its memory connMgr.Release(ref requestMsg); } } catch (Exception e) { Log.Error(e.ToString()); return(-1); } return(0); }