ClientInfoForm.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System;
  2. using System.Windows.Forms;
  3. using FastReport.Forms;
  4. using FastReport.Utils;
  5. namespace FastReport.Cloud.StorageClient.Box
  6. {
  7. /// <summary>
  8. /// Represents the Client Info dialog form.
  9. /// </summary>
  10. public partial class ClientInfoForm : BaseDialogForm
  11. {
  12. #region Fields
  13. #pragma warning disable FR0001 // Field names must be longer than 2 characters.
  14. private string id;
  15. #pragma warning restore FR0001 // Field names must be longer than 2 characters.
  16. private string secret;
  17. #endregion // Fields
  18. #region Properties
  19. /// <summary>
  20. /// Gets the client ID.
  21. /// </summary>
  22. public string Id
  23. {
  24. get { return id; }
  25. }
  26. /// <summary>
  27. /// Gets the client secret.
  28. /// </summary>
  29. public string Secret
  30. {
  31. get { return secret; }
  32. }
  33. #endregion // Properties
  34. #region Constructors
  35. /// <summary>
  36. /// Initializes a new instance of the <see cref="ClientInfoForm"/> class.
  37. /// </summary>
  38. public ClientInfoForm()
  39. {
  40. this.id = "";
  41. this.secret = "";
  42. InitializeComponent();
  43. Localize();
  44. UIUtils.CheckRTL(this);
  45. }
  46. #endregion // Constructors
  47. #region Public Methods
  48. /// <inheritdoc/>
  49. public override void Localize()
  50. {
  51. base.Localize();
  52. MyRes res = new MyRes("Cloud,Box");
  53. this.Text = res.Get("ClientInfoDialog");
  54. labelClientId.Text = res.Get("ClientId");
  55. labelClientSecret.Text = res.Get("ClientSecret");
  56. }
  57. #endregion // Public Methods
  58. #region Events Handlers
  59. private void btnOk_Click(object sender, EventArgs e)
  60. {
  61. id = tbClientId.Text;
  62. secret = tbClientSecret.Text;
  63. this.Close();
  64. }
  65. private void ClientInfoForm_FormClosing(object sender, FormClosingEventArgs e)
  66. {
  67. if (String.IsNullOrEmpty(id) || String.IsNullOrEmpty(secret))
  68. {
  69. if (DialogResult != DialogResult.OK)
  70. {
  71. return;
  72. }
  73. else
  74. {
  75. FRMessageBox.Error(new MyRes("Messages").Get("EmptyDataEntryField"));
  76. e.Cancel = true;
  77. }
  78. }
  79. }
  80. #endregion // Events Handlers
  81. }
  82. }