ClientInfoForm.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Windows.Forms;
  3. using FastReport.Forms;
  4. using FastReport.Utils;
  5. namespace FastReport.Cloud.StorageClient.S3
  6. {
  7. /// <summary>
  8. /// Represents the Client Info diabolg form.
  9. /// </summary>
  10. public partial class ClientInfoForm : BaseDialogForm
  11. {
  12. #region Fields
  13. private string accessKeyId;
  14. private string secretAccessKey;
  15. private string region;
  16. private string host;
  17. #endregion // Fields
  18. #region Properties
  19. public string AccessKeyId
  20. {
  21. get { return accessKeyId; }
  22. set
  23. {
  24. accessKeyId = value;
  25. tbAccessKeyId.Text = value;
  26. }
  27. }
  28. public string SecretAccessKey
  29. {
  30. get { return secretAccessKey; }
  31. set
  32. {
  33. secretAccessKey = value;
  34. tbSecretAccessKey.Text = value;
  35. }
  36. }
  37. public string Region
  38. {
  39. get { return region; }
  40. set
  41. {
  42. region = value;
  43. tbRegion.Text = region;
  44. }
  45. }
  46. public string Host
  47. {
  48. get { return host; }
  49. set
  50. {
  51. host = value;
  52. tbHost.Text = value;
  53. }
  54. }
  55. #endregion // Properties
  56. #region Constructors
  57. /// <summary>
  58. /// Initializes a new instance of the <see cref="ClientInfoForm"/> class.
  59. /// </summary>
  60. public ClientInfoForm()
  61. {
  62. this.accessKeyId = "";
  63. this.secretAccessKey = "";
  64. this.region = "";
  65. this.host = "";
  66. InitializeComponent();
  67. Localize();
  68. UIUtils.CheckRTL(this);
  69. UpdateDpiDependencies();
  70. }
  71. #endregion // Constructors
  72. #region Public Methods
  73. /// <inheritdoc/>
  74. public override void Localize()
  75. {
  76. base.Localize();
  77. MyRes res = new MyRes("Cloud,S3");
  78. this.Text = res.Get("ClientInfoDialog");
  79. lbAccessKeyId.Text = res.Get("AccessKeyId");
  80. lbSecretAccessKey.Text = res.Get("SecretAccessKey");
  81. lbRegion.Text = res.Get("Region");
  82. lbHost.Text = res.Get("Host");
  83. }
  84. #endregion // Public Methods
  85. #region Events Handlers
  86. private void btnOk_Click(object sender, EventArgs e)
  87. {
  88. accessKeyId = tbAccessKeyId.Text;
  89. this.secretAccessKey = tbSecretAccessKey.Text;
  90. this.region = tbRegion.Text;
  91. this.host = tbHost.Text;
  92. XmlItem xi = Config.Root.FindItem("S3").FindItem("StorageSettings");
  93. xi.SetProp("AccessKeyId", accessKeyId);
  94. xi.SetProp("SecretAccessKey", secretAccessKey);
  95. xi.SetProp("Region", region);
  96. xi.SetProp("Host", host);
  97. this.Close();
  98. }
  99. #endregion // Events Handlers
  100. }
  101. }