TFnumPluginControl.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Tofly.CoreUI.Win.Control;
  10. using Tofly.CoreUI.Control;
  11. using Tofly.Core.Components;
  12. namespace Tofly.SearchUI.Win
  13. {
  14. /// <summary>
  15. /// 图幅号定位
  16. /// </summary>
  17. [Tofly.Core.Stereotype.Component(IsSingleton = "false", Name = "Tofly.SearchUI.Win.TFnumPluginControl")]
  18. public partial class TFnumPluginControl : UserControlClass, IParameterControl
  19. {
  20. public TFnumPluginControl()
  21. {
  22. InitializeComponent();
  23. this.combTFType.Properties.BeginUpdate();
  24. combTFType.Properties.Items.Clear();
  25. combTFType.Properties.Items.Add("选择图幅号");
  26. combTFType.Properties.Items.Add(10000);
  27. combTFType.Properties.Items.Add(25000);
  28. combTFType.Properties.Items.Add(50000);
  29. combTFType.Properties.Items.Add(100000);
  30. combTFType.Properties.Items.Add(250000);
  31. combTFType.Properties.Items.Add(500000);
  32. combTFType.Properties.Items.Add(1000000);
  33. combTFType.SelectedIndex = 0;
  34. }
  35. private ComponentBaseParameter componentParameter;
  36. /// <summary>
  37. /// 获取或设置当前的组件参数类
  38. /// </summary>
  39. public ComponentBaseParameter ComponentParameter
  40. {
  41. get
  42. {
  43. GetParameter();
  44. return componentParameter;
  45. }
  46. set
  47. {
  48. componentParameter = value;
  49. InitEdit();
  50. }
  51. }
  52. /// <summary>
  53. /// 初始化编辑
  54. /// </summary>
  55. private void InitEdit()
  56. {
  57. if (componentParameter == null)
  58. return;
  59. Tofly.SearchUI.Command.CommandTFnumLocal.TFnumPluginParameter para = componentParameter as Tofly.SearchUI.Command.CommandTFnumLocal.TFnumPluginParameter;
  60. if (para == null)
  61. return;
  62. checkBox1.Checked=para.FixedScale ;
  63. combTFType.SelectedIndex=para.ScaleIndex ;
  64. if (para.Scales != null)
  65. {
  66. for (int i = 0; i < para.Scales.Count; i++)
  67. {
  68. textEdit1.Text += para.Scales[i] + ",";
  69. }
  70. if (textEdit1.Text.EndsWith(","))
  71. textEdit1.Text = textEdit1.Text.Substring(0, textEdit1.Text.Length - 1);
  72. }
  73. }
  74. /// <summary>
  75. /// 获取参数
  76. /// </summary>
  77. private void GetParameter()
  78. {
  79. if(checkBox1.Checked && combTFType.SelectedIndex==0 )
  80. {
  81. Tofly.CoreUI.Message.MessageManager.Show("请选择图幅号!");
  82. return;
  83. }
  84. if (componentParameter == null)
  85. componentParameter = new Tofly.SearchUI.Command.CommandTFnumLocal.TFnumPluginParameter();
  86. Tofly.SearchUI.Command.CommandTFnumLocal.TFnumPluginParameter para = componentParameter as Tofly.SearchUI.Command.CommandTFnumLocal.TFnumPluginParameter;
  87. if (para == null)
  88. para = new Tofly.SearchUI.Command.CommandTFnumLocal.TFnumPluginParameter();
  89. para.FixedScale = checkBox1.Checked;
  90. para.ScaleIndex = combTFType.SelectedIndex;
  91. if (!String.IsNullOrEmpty(textEdit1.Text))
  92. {
  93. string[] tempvalues = textEdit1.Text.Split(',');
  94. for (int i = 0; i < tempvalues.Length; i++)
  95. para.Scales = new List<string>(tempvalues);
  96. }
  97. }
  98. }
  99. }