/// <summary> /// Intellisense lookup. /// </summary> void OnContextItemsNeeded(object sender, NeedContextItemsArgs e) { if (e.ObjectName == "") { e.ObjectName = "."; } try { Experiment experiment = Factor.Parent.Parent as Experiment; if (experiment != null && experiment.BaseSimulation != null) { object o = experiment.BaseSimulation.Get(e.ObjectName); if (o != null) { foreach (IVariable Property in Apsim.FieldsAndProperties(o, BindingFlags.Instance | BindingFlags.Public)) { e.Items.Add(Property.Name); } e.Items.Sort(); } } } catch (Exception) { } }
/// <summary>User has pressed a '.' in the commands window - supply context items.</summary> /// <param name="sender">Event sender</param> /// <param name="e">Event arguments</param> private void OnContextItemsNeeded(object sender, NeedContextItemsArgs e) { if (e.ObjectName == string.Empty) { e.ObjectName = "."; } object o = Apsim.Get(this.cultivar, e.ObjectName); if (o != null) { foreach (IVariable property in Apsim.FieldsAndProperties(o, BindingFlags.Instance | BindingFlags.Public)) { e.Items.Add(property.Name); } e.Items.Sort(); } }