summaryrefslogtreecommitdiff
path: root/BCT
diff options
context:
space:
mode:
authorGravatar t-espave <unknown>2011-07-28 16:26:27 -0700
committerGravatar t-espave <unknown>2011-07-28 16:26:27 -0700
commit79bf6104e838bc1ca419cb0045cf82c81f9b83eb (patch)
tree3f4449774b987c733b3d8476906615e1dc0e392b /BCT
parent295a8a0de98a36d7e4bd0e79de0b66a7f5a7a423 (diff)
more input/output control handling for phones
Diffstat (limited to 'BCT')
-rw-r--r--BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs20
1 files changed, 16 insertions, 4 deletions
diff --git a/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs b/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs
index 86fb20a1..529ec8cc 100644
--- a/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs
+++ b/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs
@@ -199,6 +199,7 @@ namespace BytecodeTranslator.Phone {
PHONE_UI_CHANGER_METHODS= new Dictionary<string,string[]>();
IAssemblyReference systemAssembly = PhoneTypeHelper.getSystemAssemblyReference(host);
IAssemblyReference systemWinAssembly = PhoneTypeHelper.getSystemWindowsAssemblyReference(host);
+ IAssemblyReference phoneAssembly = PhoneTypeHelper.getPhoneAssemblyReference(host);
ITypeReference textBoxType = platform.CreateReference(systemAssembly, "System", "Windows", "Controls", "TextBox");
PHONE_UI_CHANGER_METHODS[textBoxType.ToString()] =
@@ -291,6 +292,12 @@ namespace BytecodeTranslator.Phone {
PHONE_UI_CHANGER_METHODS[richTextBoxType.ToString()] =
new string[] { "set_BaselineOffset", "set_CaretBrush", "set_HorizontalScrollBartVisibility", "set_LineHeight", "set_LineStackingStrategy",
"set_TextAlignment", "set_TextWrapping", "set_VerticalScrollBarVisibility", "set_Xaml", };
+
+ ITypeReference webBrowserTaskType = platform.CreateReference(phoneAssembly, "Microsoft", "Phone", "Tasks", "WebBrowserTask");
+ PHONE_UI_CHANGER_METHODS[webBrowserTaskType.ToString()] = new string[] { "Show", };
+
+ ITypeReference appBarIconButtonType = platform.CreateReference(phoneAssembly, "Microsoft", "Phone", "Shell", "ApplicationBarIconButton");
+ PHONE_UI_CHANGER_METHODS[appBarIconButtonType.ToString()] = new string[] { "set_IsEnabled", "set_IconUri", "set_Text"};
}
// TODO externalize strings
@@ -410,6 +417,7 @@ namespace BytecodeTranslator.Phone {
}
public bool isMethodKnownUIChanger(IMethodCall methodCall) {
+ // FEEDBACK TODO join these two with the others
if (methodCall.MethodToCall.ContainingType.isNavigationServiceClass(host)) {
return NAV_CALLS.Contains(methodCall.MethodToCall.Name.Value);
} else if (methodCall.IsStaticCall && methodCall.MethodToCall.ContainingType.isMessageBoxClass(host) &&
@@ -424,11 +432,15 @@ namespace BytecodeTranslator.Phone {
return false;
ITypeReference calleeType = callee.Type;
- if (isPhoneUIChangerClass(calleeType)) {
- return isKnownUIChanger(calleeType, methodCall);
- } else {
- return false;
+ while (calleeType.ResolvedType.BaseClasses.Any()) {
+ if (isPhoneUIChangerClass(calleeType) && isKnownUIChanger(calleeType, methodCall)) {
+ return true;
+ }
+
+ calleeType = calleeType.ResolvedType.BaseClasses.First();
}
+
+ return false;
}
private bool isKnownUIChanger(ITypeReference typeRef, IMethodCall call) {