protected override void SolveInstance(IGH_DataAccess da) { double a = 0.0; double b = 0.0; if (!da.GetData(0, ref a)) { return; } if (!da.GetData(1, ref b)) { return; } double result = a + b; if (ModifyValue != null) { ModifiableEventArgs e = new ModifiableEventArgs(result); ModifyValue(this, e); result = e.Value; } da.SetData(0, result); }
void ModifyValue(object sender, ModifiableEventArgs e) { // First make sure the target object is still in the same document. IGH_DocumentObject obj = sender as IGH_DocumentObject; if (obj == null) { return; } if (obj.OnPingDocument().RuntimeID != OnPingDocument().RuntimeID) { return; } // If everything is hunky dory, multiply the value. if (!Locked) { e.Value *= Factor; } }