CreateNameDialog.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using Resources;
  2. using SmartCoalApplication.Core;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace SmartCoalApplication.Instrument
  13. {
  14. /// <summary>
  15. /// 另存为窗口
  16. /// </summary>
  17. public partial class CreateNameDialog : PdnBaseForm
  18. {
  19. private PdnBaseForm pdnBaseForm;
  20. public TextBox textBox1;
  21. private Button button1;
  22. private Button button2;
  23. private Label label1;
  24. public CreateNameDialog(PdnBaseForm pdnBaseForm)
  25. {
  26. this.pdnBaseForm = pdnBaseForm;
  27. InitializeComponent();
  28. InitializeLanguageText();
  29. }
  30. /// <summary>
  31. /// 设置值,用于修改
  32. /// </summary>
  33. public void SetTextBoxValue(string name)
  34. {
  35. this.textBox1.Text = name;
  36. }
  37. public void SetThisText(string name)
  38. {
  39. this.Text = name;
  40. }
  41. private void InitializeLanguageText()
  42. {
  43. this.label1.Text = PdnResources.GetString("Menu.name.text");
  44. //this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
  45. //if (this.pdnBaseForm is ProjectEngineering)
  46. //{
  47. // this.button1.Text = PdnResources.GetString("Menu.Itemsearch.Text");
  48. //}
  49. //else
  50. //{
  51. //}
  52. this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
  53. this.button2.Text = PdnResources.GetString("Menu.File.Close.Text");
  54. this.Text = PdnResources.GetString("Menu.Pleaseenteranameofthephase.text");
  55. }
  56. private void InitializeComponent()
  57. {
  58. this.label1 = new System.Windows.Forms.Label();
  59. this.textBox1 = new System.Windows.Forms.TextBox();
  60. this.button1 = new System.Windows.Forms.Button();
  61. this.button2 = new System.Windows.Forms.Button();
  62. this.SuspendLayout();
  63. //
  64. // label1
  65. //
  66. this.label1.AutoSize = true;
  67. this.label1.Location = new System.Drawing.Point(13, 17);
  68. this.label1.Name = "label1";
  69. this.label1.Size = new System.Drawing.Size(41, 12);
  70. this.label1.TabIndex = 0;
  71. this.label1.Text = "名称:";
  72. //
  73. // textBox1
  74. //
  75. this.textBox1.Location = new System.Drawing.Point(60, 13);
  76. this.textBox1.MaxLength = 10;
  77. this.textBox1.Name = "textBox1";
  78. this.textBox1.Size = new System.Drawing.Size(212, 21);
  79. this.textBox1.TabIndex = 1;
  80. //
  81. // button1
  82. //
  83. this.button1.Location = new System.Drawing.Point(115, 53);
  84. this.button1.Name = "button1";
  85. this.button1.Size = new System.Drawing.Size(75, 23);
  86. this.button1.TabIndex = 2;
  87. this.button1.Text = "保存";
  88. this.button1.UseVisualStyleBackColor = true;
  89. this.button1.Click += new System.EventHandler(this.button1_Click);
  90. //
  91. // button2
  92. //
  93. this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  94. this.button2.Location = new System.Drawing.Point(197, 53);
  95. this.button2.Name = "button2";
  96. this.button2.Size = new System.Drawing.Size(75, 23);
  97. this.button2.TabIndex = 3;
  98. this.button2.Text = "关闭";
  99. this.button2.UseVisualStyleBackColor = true;
  100. this.button2.Click += new System.EventHandler(this.button2_Click);
  101. //
  102. // CreateNameDialog
  103. //
  104. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  105. this.AutoSize = true;
  106. this.ClientSize = new System.Drawing.Size(284, 88);
  107. this.Controls.Add(this.button2);
  108. this.Controls.Add(this.button1);
  109. this.Controls.Add(this.textBox1);
  110. this.Controls.Add(this.label1);
  111. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  112. this.MaximizeBox = false;
  113. this.MinimizeBox = false;
  114. this.Name = "CreateNameDialog";
  115. this.Text = "新建";
  116. this.Controls.SetChildIndex(this.label1, 0);
  117. this.Controls.SetChildIndex(this.textBox1, 0);
  118. this.Controls.SetChildIndex(this.button1, 0);
  119. this.Controls.SetChildIndex(this.button2, 0);
  120. this.ResumeLayout(false);
  121. this.PerformLayout();
  122. }
  123. private void button1_Click(object sender, EventArgs e)
  124. {
  125. if (string.IsNullOrEmpty(this.textBox1.Text))
  126. {
  127. MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));
  128. return;
  129. }
  130. this.pdnBaseForm.GetCreateName(this.textBox1.Text);
  131. }
  132. private void button2_Click(object sender, EventArgs e)
  133. {
  134. this.Close();
  135. }
  136. }
  137. }