public VMif(MyIf root, VMfunction parent) : base(root, parent) { this.CommandOpen = new DelegateCommand(() => new IfWindow() { DataContext = this }.ShowDialog()); this.Condition = new VMcondition(this.Root.Condition, this); }
private static string Convert(MyIf input, Function f, ref int i) { var conditionList = new Dictionary <string, string>(); foreach (var c in input.Condition.Conditions) { conditionList.Add(c.Alias, string.Format("{0} {1} {2}", ConvertOutput(c.LHS.Output), new VMconditionBaseCompare(c.Comparison).Value, ConvertOutput(c.RHS.Output))); } if (conditionList.Count == 1) { return(string.Format("{0}if({1}){{", Indent(i++), conditionList.First().Value)); } var groupList = new Dictionary <string, string>(); foreach (var g in input.Condition.Groups) { var content = conditionList[g.Conditions[0]] + " "; for (int j = 0; j < g.Connectors.Count; j++) { content += new VMconditionGroupCompare(g.Connectors[j]).Value + " "; content += conditionList[g.Conditions[j + 1]] + " "; } conditionList.Add(g.Alias, content); } var output = groupList[input.Condition.Value.Conditions[0]]; for (int j = 0; j < input.Condition.Value.Connectors.Count; j++) { output += new VMconditionGroupCompare(input.Condition.Value.Connectors[j]).Value + " "; output += groupList[input.Condition.Value.Conditions[j + 1]] + " "; } return(string.Format("{0}if({1}){{", Indent(i++), output)); }
public MyIfError() : base() { this.myIf = new MyIf(); this.myError = new MyError(); }