Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-24637] Windows: Accessing generic collections throws exception #165

Merged
merged 4 commits into from May 4, 2017
Merged

[TIMOB-24637] Windows: Accessing generic collections throws exception #165

merged 4 commits into from May 4, 2017

Conversation

infosia
Copy link
Contributor

@infosia infosia commented Apr 27, 2017

TIMOB-24637

Accessing generic collection property/method such as System.Collections.Generic.IList<T>.Add throws exception.

var win = Ti.UI.createWindow({
    backgroundColor: 'green'
});
var button = Ti.UI.createButton({
    title: 'Show Alert'
});
button.addEventListener('click', function () {
    var MessageDialog = require('Windows.UI.Popups.MessageDialog'),
        UICommand = require('Windows.UI.Popups.UICommand'),
        PropertyValue = require('Windows.Foundation.PropertyValue'),
        Int32 = require('System.Int32');

    var dialog = new MessageDialog('My Message');
    dialog.Title = 'My Title';
    dialog.DefaultCommandIndex = 0;
    dialog.Commands.Add(new UICommand('OK', null, PropertyValue.CreateInt32(0)));
    dialog.Commands.Add(new UICommand('Cancel', null, PropertyValue.CreateInt32(1)));
    dialog.ShowAsync().then(function (command) {
        var id = Int32.cast(command.Id);
        alert((id == 0) ? 'Pushed "OK"' : 'Pushed "Cancel"')
    });
});

win.add(button);
win.open();

Expected:

  • This should show alert dialog with two buttons: [OK] [Cancel] when you click "Show Alert"
  • When you click [OK] you should see "Pushed "OK"
  • When you click [Cancel] you should see "Pushed "Cancel"

This also implements TIMOB-24646

var List = require('System.Collections.Generic.List<System.Int32>'),
    Int32 = require('System.Int32');
var vec = new List();

vec.Add(Int32.cast(0));
vec.Add(Int32.cast(1));
vec.Add(Int32.cast(2));

Ti.API.info(vec[1]); // this should print "1"
vec[1] = 100;
Ti.API.info(vec[1]); // this should print "100"

@infosia infosia added this to the v2.2.0 milestone Apr 28, 2017
@garymathews garymathews self-requested a review May 2, 2017 11:55
@hansemannn hansemannn removed this from the v2.2.0 milestone May 4, 2017
@hansemannn
Copy link
Contributor

@infosia If we want this in 2.1.1, we need a backport to 2_1_X.

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@infosia infosia merged commit e0d1203 into tidev:master May 4, 2017
@infosia infosia deleted the TIMOB-24637 branch May 4, 2017 23:03
infosia added a commit that referenced this pull request May 4, 2017
…#165) (#170)

* [TIMOB-24637] Windows: Accessing generic collections throws exception
* [TIMOB-24646] Implement indexer property
* Implement cast to JavaScript value from native object
* Failsafe ConvertNumber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants