public bool ReceiveComponentVariable(IComponentVariableSource component) { this.Focus(); AbstractComponentData receivedData = component.GetData(); if (receivedData == null) { return(false); } if (receivedData is IExpressionData) { if (textTarget.IsFocused) { targetData = receivedData as IExpressionData; textTarget.Text = receivedData.autoLabel; } else if (textVariable.IsFocused) { variableData = receivedData as IExpressionData; textVariable.Text = receivedData.autoLabel; } return(true); } else { // only receive IExpressionData, other type of data cannot have value return(false); } }
public void InsertVariable(AbstractComponentData receivedData) { string variable = receivedData.id; bool shouldReceive = true; if (receivedData is AbstractParameterData) { shouldReceive = CheckParameterData(receivedData as AbstractParameterData); } if (shouldReceive) { InlineUIContainer container = CreateInlineContainer(variable, this.CaretPosition); this.CaretPosition = container.ContentEnd; if (receivedData is AbstractParameterData) { referredMacroParams.Add(variable); } DependenceCommandArgs args = new DependenceCommandArgs() { source = this, targetVariableId = variable }; Command.AddDependence.Execute(args, this); container.Unloaded += macroParameterContainer_Unloaded; } else { Console.Out.WriteLine("Cannot receive macro parameter " + variable + ", expression already contains parameter from macro " + referredMacroId()); } }
public bool ReceiveComponentData(AbstractComponentData receivedData, AbstractComponentData selfData) { if (this.IsReadOnly) { return(false); } if (receivedData == null) { return(false); } if (!this.IsFocused) { // if textbox has lost focus, e.g. because clicking on spreadsheet cell this.GetFocusBack(); } if (receivedData is AbstractMacroData) { // macro can have cyclic dependency with other components too if (valueStore.CanCreateEdge(selfData, receivedData)) { this.InsertFunction((receivedData as AbstractMacroData).Function); } else { Console.Out.WriteLine("Macro cyclic dependency from " + selfData.id + " to " + receivedData.id); } } else { if (valueStore.CanCreateEdge(selfData, receivedData)) { this.InsertVariable(receivedData); } else { Console.Out.WriteLine("Cyclic dependency from " + selfData.id + " to " + receivedData.id); } } return(true); }
public bool ReceiveComponentData(AbstractComponentData receivedData) { return(this.ReceiveComponentData(receivedData, data)); }
public bool ReceiveComponentVariable(IComponentVariableSource component, AbstractComponentData selfData) { AbstractComponentData receivedData = component.GetData(); return(this.ReceiveComponentData(receivedData, selfData)); }