123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using SmartCoalApplication.Base;
- using SmartCoalApplication.Core.Param;
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace SmartCoalApplication.Core.Param
- {
- /// <summary>
- /// 抉择类型,针对脚本
- /// 使用其下的choiseList数据
- /// </summary>
- public class ChoiseArray : Args
- {
- /// <summary>
- /// 设置参数的方案:0(默认方案,使用[index+initial]的赋值方式); 1(晶粒度辅助线处使用,选项中key和value都是辅助线名称,通过辅助线名称给value赋值)
- /// </summary>
- public int valueType = 0;
- public void numberParam_ValueChanged(object sender, EventArgs e)
- {
- if (sender.GetType() == typeof(Button))
- {
- if (((Button)sender).Text == "反选")
- {
- this.Value = 0;
- for (int i = 0; i < this.choiseList.Count; i++)
- {
- Args args = this.choiseList[i];
- if (i == 0)
- {
- args.Value = 1;
- }
- else
- {
- args.Value = 0;
- }
- }
- }
- else//取消反选
- {
- this.Value = 1;
- //((Button)sender).Select
- for (int i = 0; i < this.choiseList.Count; i++)
- {
- Args args = this.choiseList[i];
- if (i == 1)
- {
- args.Value = 1;
- }
- else
- {
- args.Value = 0;
- }
- }
- }
- //}
- //else if (sender.GetType() == typeof(NumericUpDown))
- //{
- // this.Value = (int)((NumericUpDown)sender).Value;
- }
- else if(sender.GetType() == typeof(RadioButton))
- {
- if (((RadioButton)sender).Checked)
- this.value = ((RadioButton)sender).Tag;// (Enum)(((RadioButton)sender).Tag);
- }
- }
- public ChoiseArray(string key, string name, BooleanObject[] arr)
- {
- this.Type = Dtryt.Choise;
- this.initialValue = 0;
- this.value = 0;
- this.key = key;
- this.name = name;
- if(arr!=null)
- {
- this.choiseList = new List<Args>(arr);
- }
- }
- public ChoiseArray(string key, string name, BooleanObject[] arr,object value)
- {
- this.Type = Dtryt.Choise;
- this.initialValue = 0;
- this.value = value;
- this.key = key;
- this.name = name;
- if (arr != null)
- {
- this.choiseList = new List<Args>(arr);
- }
- }
- //public ChoiseArray(List<Args> list)
- //{
- // this.Type = Dtryt.Choise;
- // this.choiseList = list;
- // this.Value = 0;
- //}
- }
- }
|