summaryrefslogtreecommitdiff
path: root/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs
diff options
context:
space:
mode:
authorGravatar Unknown <t-espave@A3479886.redmond.corp.microsoft.com>2011-07-15 11:11:46 -0700
committerGravatar Unknown <t-espave@A3479886.redmond.corp.microsoft.com>2011-07-15 11:11:46 -0700
commit7dea3ce2cd43af0f3a7efc6ef57136d5a2fd8099 (patch)
tree869e979464433fa5c208d7f05e73166f42836b74 /BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs
parent4c0b3cd19f6259d4b7f644497212f639c1e07706 (diff)
initial page detection and init
Diffstat (limited to 'BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs')
-rw-r--r--BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs b/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs
index 5f08f1c7..b702e78b 100644
--- a/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs
+++ b/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs
@@ -4,18 +4,21 @@ using System.Linq;
using System.Text;
using Microsoft.Cci;
using Microsoft.Cci.MutableCodeModel;
+using TranslationPlugins;
namespace BytecodeTranslator.Phone {
public class PhoneNavigationCodeTraverser : BaseCodeTraverser {
private MetadataReaderHost host;
private ITypeReference navigationSvcType;
private ITypeReference typeTraversed;
+ private PhoneControlsPlugin phonePlugin;
private static readonly string[] NAV_CALLS = { "GoBack", "GoForward", "Navigate", "StopLoading" };
- public PhoneNavigationCodeTraverser(MetadataReaderHost host, ITypeReference typeTraversed) : base() {
+ public PhoneNavigationCodeTraverser(PhoneControlsPlugin plugin, MetadataReaderHost host, ITypeReference typeTraversed) : base() {
this.host = host;
this.typeTraversed = typeTraversed;
+ this.phonePlugin = plugin;
Microsoft.Cci.Immutable.PlatformType platform = host.PlatformType as Microsoft.Cci.Immutable.PlatformType;
// TODO obtain version, culture and signature data dynamically
@@ -33,7 +36,7 @@ namespace BytecodeTranslator.Phone {
if (method.IsConstructor && PhoneCodeHelper.isPhoneApplicationClass(typeTraversed, host)) {
// TODO initialize current navigation URI to mainpage, using a placeholder for now.
// TODO BUG doing this is generating a fresh variable definition somewhere that the BCT then translates into two different (identical) declarations
- string URI_placeholder="URI_PLACEHOLDER";
+ string mainPageUri = phonePlugin.getMainPageXAML();
SourceMethodBody sourceBody = method.Body as SourceMethodBody;
if (sourceBody != null) {
BlockStatement bodyBlock = sourceBody.Block as BlockStatement;
@@ -41,7 +44,7 @@ namespace BytecodeTranslator.Phone {
Assignment uriInitAssign = new Assignment() {
Source = new CompileTimeConstant() {
Type = host.PlatformType.SystemString,
- Value = URI_placeholder,
+ Value = mainPageUri,
},
Type = host.PlatformType.SystemString,
Target = new TargetExpression() {
@@ -230,10 +233,12 @@ namespace BytecodeTranslator.Phone {
public class PhoneNavigationMetadataTraverser : BaseMetadataTraverser {
private MetadataReaderHost host;
private ITypeDefinition typeBeingTraversed;
+ private PhoneControlsPlugin phonePlugin;
- public PhoneNavigationMetadataTraverser(MetadataReaderHost host)
+ public PhoneNavigationMetadataTraverser(PhoneControlsPlugin plugin, MetadataReaderHost host)
: base() {
this.host = host;
+ this.phonePlugin = plugin;
}
public override void Visit(IModule module) {
@@ -267,7 +272,7 @@ namespace BytecodeTranslator.Phone {
// TODO same here. Are there specific methods (and ways to identfy those) that can perform navigation?
public override void Visit(IMethodDefinition method) {
- PhoneNavigationCodeTraverser codeTraverser = new PhoneNavigationCodeTraverser(host, typeBeingTraversed);
+ PhoneNavigationCodeTraverser codeTraverser = new PhoneNavigationCodeTraverser(phonePlugin, host, typeBeingTraversed);
codeTraverser.Visit(method);
}