using SmartCoalApplication.Base; using SmartCoalApplication.Core.Param; using System; using System.Collections.Generic; using System.Windows.Forms; namespace SmartCoalApplication.Core.Param { /// /// 抉择类型,针对脚本 /// 使用其下的choiseList数据 /// public class ChoiseArray : Args { /// /// 设置参数的方案:0(默认方案,使用[index+initial]的赋值方式); 1(晶粒度辅助线处使用,选项中key和value都是辅助线名称,通过辅助线名称给value赋值) /// 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(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(arr); } } //public ChoiseArray(List list) //{ // this.Type = Dtryt.Choise; // this.choiseList = list; // this.Value = 0; //} } }