private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox2.Text == "Local") { comboBox1.DataSource = null; comboBox1.DataSource = this.taskActionCtr.GetAllVaribles(); } if (comboBox2.Text == "Global") { comboBox1.DataSource = null; Global = taskActionCtr.GetProperty("Global") as TaskFrameGlobal; comboBox1.DataSource = Global.taskGlobalCtr.GetAllVaribles(); } }
public void Init() { string file = DataAction.SaveStatic.ReadBin("UIpath") as string; if (file == null) { MessageBox.Show(this.Name + "未找到文件路径!"); return; } if (!File.Exists(file)) { MessageBox.Show(this.Name + "文件" + file + "不存在!"); return; } UIAssembly = Assembly.LoadFile(file); MethodInfo fg = UIAssembly.EntryPoint; try { //tac = new TaskActionCtr(); tac.Function = new FunctionHandle(() => { fg.Invoke(null, null); }); // label1.BackColor = Color.Red; } catch { label1.BackColor = Color.Silver; } Type t = UIAssembly.GetType("UIform.IOGlobal"); FieldInfo fInfo = t.GetField("Global"); foreach (Control ctr in this.Parent.Controls) { if (ctr.GetType() == typeof(TaskFrameGlobal)) { TaskFrameGlobal ctrg = ctr as TaskFrameGlobal; fInfo.SetValue(null, ctrg); } } }