Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16558] Windows Hybrid: Create module development guide

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-08-19T20:34:24.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 05, Release 3.3.0
ComponentsWindows Hybrid
Labelsn/a
ReporterIngo Muschenetz
AssigneeBenjamin Hatfield
Created2014-01-22T01:08:00.000+0000
Updated2014-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.

Comments

  1. Benjamin Hatfield 2014-02-21

    PR: https://github.com/appcelerator/titanium_mobile/pull/5361
  2. Benjamin Hatfield 2014-02-21

    Started this guide: https://wiki.appcelerator.org/display/guides2/Windows+Phone+8+Module+Development+Guide
  3. Dawson Toth 2014-02-25

  4. Benjamin Hatfield 2014-02-25

    [~dtoth]: Oops. Sorry. It should be the Dark icons. Those are the only ones supported according to the Windows Documentation. Need to document that.
  5. Dawson Toth 2014-02-26

    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 to grid.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.

  6. Benjamin Hatfield 2014-02-27

    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.​
  7. Dawson Toth 2014-03-03

    Looks good to me.
  8. Benjamin Hatfield 2014-03-07

    Master Fixes: https://github.com/appcelerator/titanium_mobile/pull/5445
  9. Eric Merriman 2014-06-13

    Closing as this has been created.

JSON Source