private static void trackControlVariableName(IFieldDefinition fieldDefinition, Bpl.Variable fieldVar) { INamespaceTypeReference namedContainerRef = fieldDefinition.ContainingType as INamespaceTypeReference; if (namedContainerRef != null) { string containerName = namedContainerRef.ContainingUnitNamespace.Unit.Name.Value + "." + namedContainerRef.Name.Value; IEnumerable <ControlInfoStructure> controls = PhoneCodeHelper.instance().PhonePlugin.getControlsForPage(containerName); if (controls != null) { ControlInfoStructure ctrlInfo = controls.FirstOrDefault(ctrl => ctrl.Name == fieldDefinition.Name.Value); if (ctrlInfo != null) { ctrlInfo.BplName = fieldVar.Name; } } } }
private BoundExpression makeBoundControlFromControlInfo(ControlInfoStructure controlInfo) { return(new BoundExpression() { Definition = new FieldDefinition() { ContainingTypeDefinition = methodBeingTraversed.Container, Name = host.NameTable.GetNameFor(controlInfo.Name), Type = getTypeForClassname(controlInfo.ClassName), IsStatic = false, }, Instance = new ThisReference() { Type = methodBeingTraversed.Container }, Type = getTypeForClassname(controlInfo.ClassName), }); }
private IEnumerable <IStatement> getCodeForSettingVisibility(ControlInfoStructure controlInfo) { // TODO I do not want to import System.Windows into this project...and using the underlying uint won't work for dependency properties /* * IList<IStatement> code = new List<IStatement>(); * BoundExpression boundControl = makeBoundControlFromControlInfo(controlInfo); * MethodCall setVisibilityCall= new MethodCall() { * IsStaticCall = false, * IsVirtualCall = true, * IsTailCall = false, * Type = ((Microsoft.Cci.Immutable.PlatformType) host.PlatformType).SystemVoid, * MethodToCall = visibilitySetter, * ThisArgument = boundControl, * }; * * ITypeReference visibilityType= ((Microsoft.Cci.Immutable.PlatformType) host.PlatformType).CreateReference(phoneSystemWindowsAssembly, "System", "Windows", "Visibility"); * * switch (controlInfo.Visible) { * case Visibility.Visible: * setVisibilityCall.Arguments.Add(new CompileTimeConstant() { * Type = visibilityType, * Value = 0, * } ); // Visible * break; * case Visibility.Collapsed: * setVisibilityCall.Arguments.Add(new CompileTimeConstant() { * Type = visibilityType, * Value = 1, * } ); // Collapsed * break; * default: * throw new ArgumentException("Invalid visibility value for control " + controlInfo.Name + ": " + controlInfo.Visible); * } * * ExpressionStatement callStmt = new ExpressionStatement() { * Expression = setVisibilityCall, * }; * code.Add(callStmt); * return code; * */ return(new List <IStatement>()); }
private IEnumerable <IStatement> getCodeForSettingCheckedState(ControlInfoStructure controlInfo) { // IList<IStatement> code = new List<IStatement>(); // BoundExpression boundControl = makeBoundControlFromControlInfo(controlInfo); // MethodCall setCheckStateCall= new MethodCall() { // IsStaticCall = false, // IsVirtualCall = true, // IsTailCall = false, // Type = ((Microsoft.Cci.Immutable.PlatformType) host.PlatformType).SystemVoid, // MethodToCall = isCheckedSetter, // ThisArgument = boundControl, // }; // setCheckStateCall.Arguments.Add(controlInfo.IsChecked ? trueConstant : falseConstant); // ExpressionStatement callStmt = new ExpressionStatement() { // Expression = setCheckStateCall, // }; // code.Add(callStmt); // return code; return(new List <IStatement>()); }
private IEnumerable <IStatement> getCodeForSettingEnabledness(ControlInfoStructure controlInfo) { IList <IStatement> code = new List <IStatement>(); BoundExpression boundControl = makeBoundControlFromControlInfo(controlInfo); MethodCall setEnablednessCall = new MethodCall() { IsStaticCall = false, IsVirtualCall = true, IsTailCall = false, Type = ((Microsoft.Cci.Immutable.PlatformType)host.PlatformType).SystemVoid, MethodToCall = isEnabledSetter, ThisArgument = boundControl, }; setEnablednessCall.Arguments.Add(controlInfo.IsEnabled ? trueConstant : falseConstant); ExpressionStatement callStmt = new ExpressionStatement() { Expression = setEnablednessCall, }; code.Add(callStmt); return(code); }