{ "id": "164382", "key": "TIMOB-24102", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-12-20T17:24:19.000+0000", "created": "2016-11-04T06:46:50.000+0000", "epic": { "id": 162541, "key": "TIMOB-23765", "name": "Hyperloop for Windows", "summary": "Windows: Direct API Access not working ", "color": { "key": "color_1" }, "done": false }, "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "issuelinks": [], "assignee": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T23:25:29.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "If a class has overloads for a method (multiple forms of the method with different signatures, but the same name), we need to attempt to match the correct method to invoke on the C# side by matching the passed in arguments to the closest match. Typically, this involves matching the name, number of arguments and the ability to convert the passed in arguments (in-order) to the method’s parameter types. We might want to slightly more liberal in accepting numeric primitives than typical method resolution due to the conversion of JS Numbers. \r\n\r\nAlso, sometimes interfaces define generic return types such as Object and you will need to cast them to a different type to then reference methods and properties of the class. You can pass along the object you want to wrap to the constructor of the type you want to wrap it in. ", "attachment": [], "flagged": false, "summary": "Windows: Native method resolution and casting", "creator": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 784, "state": "closed", "name": "2016 Sprint 26 SDK", "startDate": "2016-12-17T01:24:57.928Z", "endDate": "2016-12-31T01:24:00.000Z", "completeDate": "2017-01-03T02:15:01.548Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "403394", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "https://github.com/appcelerator/hyperloop.next/pull/112", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-12-15T00:28:41.000+0000", "updated": "2016-12-15T00:28:41.000+0000" }, { "id": "408611", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Environment: \r\nNPM Version: 2.15.9 \r\nNode Version: 4.6.0 \r\nWindows OS: 10.0.14393.693 \r\nAppc CLI: 6.1.0 \r\nAppc CLI NPM: 4.2.8 \r\nTitanium SDK version: 6.1.0.v20170227120704 \r\nAppcelerator Studio, build: 4.8.1.201612050850 \r\nWindows Device: 8.1 and 10.0.14393 \r\nWindows Emulator 8.1 and 10.0.14393\r\n\r\nI tested the demo apps, and validated the fix. There were two pull requests for this ticket; I tested with the demo apps from both PR's.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({ backgroundColor: 'green' });\r\nwin.addEventListener('open', function () {\r\n\r\n var Button = require('Windows.UI.Xaml.Controls.Button');\r\n var button = new Button();\r\n\r\n // Set JavaScript string for System.Object property\r\n button.Content = \"PUSH PUSH\";\r\n\r\n // No need to require TappedRoutedEventArgs for now in order to handle events\r\n button.addEventListener('Tapped', function (e) {\r\n // button.Content should be a System.Object\r\n Ti.API.info(button.Content.ToString());\r\n\r\n // Cast System.Object to System.String and then call String methods\r\n var content_str = require('System.String').cast(button.Content);\r\n Ti.API.info('button.Content length = ' + content_str.Length);\r\n alert('This should be true: ' + content_str.EndsWith(' PUSH'));\r\n });\r\n\r\n win.add(button);\r\n\r\n var System_Math = require('System.Math');\r\n\r\n // Call System.Math.Abs(double); (implicit)\r\n Ti.API.info(System_Math.Abs(-1.23));\r\n\r\n // Call System.Math.Abs(double); (explicit)\r\n Ti.API.info(System_Math.Abs(require('System.Double').cast(-1.23)));\r\n\r\n // Call System.Math.Abs(Int32);\r\n Ti.API.info(System_Math.Abs(require('System.Int32').cast(-1.23)));\r\n});\r\nwin.open();\r\n{code}\r\n\r\n{code}\r\nrequire('Windows.UI.Xaml.Input.TappedRoutedEventArgs');\r\nrequire('Windows.UI.Xaml.Input.TappedRoutedEventArgs');\r\n\r\nvar win = Ti.UI.createWindow({ backgroundColor: 'green' }),\r\n Button = require('Windows.UI.Xaml.Controls.Button'),\r\n button = new Button();\r\n\r\nbutton.Content = \"PUSH\";\r\nbutton.addEventListener('Tapped', function (e) {\r\n alert('Tapped');\r\n});\r\nbutton.addEventListener('Tapped', function (e) {\r\n Ti.API.info('This should not cause compile error');\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T23:24:14.000+0000", "updated": "2017-03-02T23:24:14.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }