[TIMOB-16558] Windows Hybrid: Create module development guide
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-08-19T20:34:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2014 Sprint 05, Release 3.3.0 |
Components | Windows Hybrid |
Labels | n/a |
Reporter | Ingo Muschenetz |
Assignee | Benjamin Hatfield |
Created | 2014-01-22T01:08:00.000+0000 |
Updated | 2014-08-19T20:34:24.000+0000 |
Description
We need to enable users to access native functionality from inside Windows Hybrid.
Some initial work has been done on the functionality. For instance, you can do the following:
var button = Ti.MobileWeb.WP8.createInstance('System.Windows.Controls.Button', [], []);
button.setProp('Content', 'Click me, I\'m Native');
var children = Ti.MobileWeb.WP8.getRootGrid().getProp('Children');
children.invoke('RemoveAt', ['System.Int32'], [0]);
children.invoke('Add', ['System.Windows.Controls.Button'], [button]);
This code creates a native button and sets its title to "Click me, I’m Native”. It then removes the web view hosting the mobile web app from the screen and replaces it with this button.
We need to create a simple sample module project (similar to http://docs.appcelerator.com/titanium/latest/#!/guide/iOS_Module_Development_Guide) and show a developer how to utilize this functionality.
PR: https://github.com/appcelerator/titanium_mobile/pull/5361
Started this guide: https://wiki.appcelerator.org/display/guides2/Windows+Phone+8+Module+Development+Guide
[~dtoth]: Oops. Sorry. It should be the Dark icons. Those are the only ones supported according to the Windows Documentation. Need to document that.
Alright, I figured out what's going wrong. I see 3 issues:
grid.Clear()
should be moved to the end of the file, just before the call togrid.Add(canvas)
. If it is called to early, errors will be suppressed.I'm getting an error "Object doesn't support property or method 'getEnum' at ... line 30:
Ti.MobileWeb.WP8.getEnum('System.Windows.Media.Colors', 'Blue')
The line number is off by one. That's actually line 29 from my foo.js.
Hi [~dtoth], Are you testing the samples against my PR? Bryan did not implement some of the APIs, such as getEnum. He only implemented the createInstance, getProp, setProp and invoke APIs. I just did a fresh rebuild of the SDK with my PR and I am not getting errors you are seeing.
Looks good to me.
Master Fixes: https://github.com/appcelerator/titanium_mobile/pull/5445
Closing as this has been created.