diff options
author | t-espave <unknown> | 2011-08-04 09:10:56 -0700 |
---|---|---|
committer | t-espave <unknown> | 2011-08-04 09:10:56 -0700 |
commit | 8bf4c4336978eb2cef75a84eab4d33ba05234ebf (patch) | |
tree | 34aa8156d294a9590cb90d23c343642732bfaf6a /BCT/PhoneControlsExtractor | |
parent | 026cd487e878ab5fa703010a79b18491683205d8 (diff) |
(phone bct) monitoring pivot controls
Diffstat (limited to 'BCT/PhoneControlsExtractor')
-rw-r--r-- | BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py | 15 | ||||
-rw-r--r-- | BCT/PhoneControlsExtractor/PhoneControlsExtractor.py | 12 |
2 files changed, 19 insertions, 8 deletions
diff --git a/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py b/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py index 37b35746..101fb51c 100644 --- a/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py +++ b/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py @@ -5,7 +5,7 @@ from xml.dom import minidom from itertools import product
import xml.dom
-CONTROL_NAMES= ["Button", "CheckBox", "RadioButton"]
+CONTROL_NAMES= ["Button", "CheckBox", "RadioButton", "ApplicationBarIconButton", "Pivot"]
CONTAINER_CONTROL_NAMES= ["Canvas", "Grid", "StackPanel"]
# TODO externalize strings, share with C# code
@@ -29,7 +29,7 @@ def showUsage(): print "\t--controls <app_control_info_file>: Phone app control info. See PhoneControlsExtractor. Short form: -c"
print "\t--output <code_output_file>: file to write with boilerplate code. Short form: -o\n"
-def loadControlInfo(infoMap, controlClass, controlName, enabled, visible, clickHandler, checkedHandler, uncheckedHandler, bplName):
+def loadControlInfo(infoMap, controlClass, controlName, enabled, visible, clickHandler, checkedHandler, uncheckedHandler, selectionChangedHandler, bplName):
newControl={}
newControl["class"]= controlClass
newControl["enabled"]= enabled
@@ -37,6 +37,7 @@ def loadControlInfo(infoMap, controlClass, controlName, enabled, visible, clickH newControl["clickHandler"]= clickHandler
newControl["checkedHandler"]= checkedHandler
newControl["uncheckedHandler"]= uncheckedHandler
+ newControl["selectionChangedHandler"]= selectionChangedHandler
newControl["bplName"]=bplName
infoMap[controlName]= newControl
@@ -139,6 +140,10 @@ def outputPageControlDriver(file, originalPageName, boogiePageName): file.write("\t\t\t\tif ($handlerToActivate == 2) {\n")
file.write("\t\t\t\t\tcall " + staticControlsMap[originalPageName]["class"] + "." + controlInfo["uncheckedHandler"] + "$System.Object$System.Windows.RoutedEventArgs(" + controlInfo["bplName"] + "[" + boogiePageName + "],null,null);\n")
file.write("\t\t\t\t}\n")
+ if not controlInfo["selectionChangedHandler"] == "":
+ file.write("\t\t\t\tif ($handlerToActivate == 3) {\n")
+ file.write("\t\t\t\t\tcall " + staticControlsMap[originalPageName]["class"] + "." + controlInfo["selectionChangedHandler"] + "$System.Object$System.Windows.RoutedEventArgs(" + controlInfo["bplName"] + "[" + boogiePageName + "],null,null);\n")
+ file.write("\t\t\t\t}\n")
file.write("\t\t\t}\n")
file.write("\t\t}\n")
@@ -203,14 +208,14 @@ def buildControlInfo(controlInfoFileName): file = open(controlInfoFileName, "r")
# Info file format is first line containing only the main page, another line with boogie's current navigation variable and then one line per
- # <pageClassName>,<page.xaml file>,<xaml boogie string representation>,<controlClassName>,<controlName (as in field name)>,<IsEnabledValue>,<VisibilityValue>,<ClickValue>,<CheckedValue>,<UncheckedValue>,<BoogieName>
+ # <pageClassName>,<page.xaml file>,<xaml boogie string representation>,<controlClassName>,<controlName (as in field name)>,<IsEnabledValue>,<VisibilityValue>,<ClickValue>,<CheckedValue>,<UncheckedValue>,<SelectionChangedValue>,<BoogieName>
mainPageXAML= file.readline().strip()
currentNavigationVariable= file.readline().strip()
mainAppClassname= file.readline().strip()
infoLine= file.readline().strip()
while not infoLine == "":
- pageClass, pageName, pageBoogieStringName, controlClass, controlName, enabled, visible, clickHandler, checkedHandler, uncheckedHandler, bplName= infoLine.split(",")
+ pageClass, pageName, pageBoogieStringName, controlClass, controlName, enabled, visible, clickHandler, checkedHandler, uncheckedHandler, selectionChangedHandler, bplName= infoLine.split(",")
pageInfo={}
pageInfo["class"]=pageClass
try:
@@ -224,7 +229,7 @@ def buildControlInfo(controlInfoFileName): pageControlInfo= pageInfo["controls"]
except KeyError:
pageInfo["controls"]=pageControlInfo
- loadControlInfo(pageControlInfo, controlClass, controlName, enabled, visible, clickHandler, checkedHandler, uncheckedHandler, bplName)
+ loadControlInfo(pageControlInfo, controlClass, controlName, enabled, visible, clickHandler, checkedHandler, uncheckedHandler, selectionChangedHandler, bplName)
pageInfo["controls"]= pageControlInfo
staticControlsMap[pageName]=pageInfo
diff --git a/BCT/PhoneControlsExtractor/PhoneControlsExtractor.py b/BCT/PhoneControlsExtractor/PhoneControlsExtractor.py index 9285d6c8..27517d0d 100644 --- a/BCT/PhoneControlsExtractor/PhoneControlsExtractor.py +++ b/BCT/PhoneControlsExtractor/PhoneControlsExtractor.py @@ -4,7 +4,7 @@ import os from xml.dom import minidom
import xml.dom
-CONTROL_NAMES= ["Button", "CheckBox", "RadioButton", "ApplicationBarIconButton"]
+CONTROL_NAMES= ["Button", "CheckBox", "RadioButton", "ApplicationBarIconButton", "Pivot"]
# TODO maybe a control is enabled but its parent is not, must take this into account
# TODO a possible solution is to tie the enabled value to that of the parent in the app until it is either overriden
@@ -70,6 +70,7 @@ def addDummyControlToMap(pageXAML, parentPage): newControl["Click"] = ""
newControl["Checked"] = ""
newControl["Unchecked"] = ""
+ newControl["SelectionChanged"]= ""
newControl["XAML"]= pageXAML
pageControls.append(newControl)
staticControlsMap[parentPage]= pageControls
@@ -98,6 +99,7 @@ def addControlToMap(pageXAML, parentPage, controlNode): newControl["Click"] = controlNode.getAttribute("Click").replace(",",COMMA_REPLACEMENT).replace("=",COMMA_REPLACEMENT)
newControl["Checked"] = controlNode.getAttribute("Checked").replace(",",COMMA_REPLACEMENT).replace("=",COMMA_REPLACEMENT)
newControl["Unchecked"] = controlNode.getAttribute("Unchecked").replace(",",COMMA_REPLACEMENT).replace("=",COMMA_REPLACEMENT)
+ newControl["SelectionChanged"] = controlNode.getAttribute("SelectionChanged").replace(",",COMMA_REPLACEMENT).replace("=",COMMA_REPLACEMENT)
newControl["XAML"]= pageXAML
pageControls.append(newControl)
staticControlsMap[parentPage]= pageControls
@@ -145,7 +147,7 @@ def outputPhoneControls(outputFileName): outputFile= open(outputFileName, "w")
# Output format is first line containing only the main page, then line containing boogie navigation variable, and then one line per
- # <pageClassName>,<page.xaml file>,<boogie string page name>,<controlClassName>,<controlName (as in field name)>,<IsEnabledValue>,<VisibilityValue>,<ClickValue>,<CheckedValue>,<UncheckedValue>
+ # <pageClassName>,<page.xaml file>,<boogie string page name>,<controlClassName>,<controlName (as in field name)>,<IsEnabledValue>,<VisibilityValue>,<ClickValue>,<CheckedValue>,<UncheckedValue>,<SelChangedValue>
outputFile.write(mainPageXAML + "\n")
outputFile.write("dummyNavigationVariable_unknown\n")
outputFile.write("dummyMainAppName_unknown\n") # I could possibly deduce it from WMAppManifest.xml, but I'm unsure. Doing it later is safe anyway
@@ -167,10 +169,14 @@ def outputPhoneControls(outputFileName): unchecked= control["Unchecked"]
if (unchecked.find(COMMA_REPLACEMENT) != -1):
unchecked= ""
+ selectionChanged= control["Unchecked"]
+ if (selectionChanged.find(COMMA_REPLACEMENT) != -1):
+ selectionChanged= ""
pageXAML= control["XAML"]
# last comma is to account for bpl translation name, that is unknown for now
# boogie string page name is unknown for now
- outputFile.write(page + "," + os.path.basename(pageXAML) + ",dummyBoogieStringPageName," + control["Type"] + "," + control["Name"] + "," + isEnabled + "," + visibility + "," + click + "," + checked + "," + unchecked + ",\n")
+ outputFile.write(page + "," + os.path.basename(pageXAML) + ",dummyBoogieStringPageName," + control["Type"] + "," + control["Name"] + \
+ "," + isEnabled + "," + visibility + "," + click + "," + checked + "," + unchecked + "," + selectionChanged + ",\n")
outputFile.close()
|