Пример #1
0
        async partial void OnAdd(NSObject sender)
        {
            if (string.IsNullOrWhiteSpace(itemText.Text))
            {
                return;
            }

            var newItem = new TodoItem()
            {
                Text     = itemText.Text,
                Complete = false
            };

            int index = await todoService.InsertTodoItemAsync(newItem);

            TableView.InsertRows(new [] { NSIndexPath.FromItemSection(index, 0) },
                                 UITableViewRowAnimation.Top);

            itemText.Text = "";
        }
Пример #2
0
        async partial void OnAdd(NSObject sender)
        {
            if (string.IsNullOrWhiteSpace(itemText.Text))
            {
                return;
            }

            string deviceToken = ((AppDelegate)UIApplication.SharedApplication.Delegate).DeviceToken;

            var newItem = new TodoItem()
            {
                Text        = itemText.Text,
                Complete    = false,
                DeviceToken = deviceToken
            };

            int index = await todoService.InsertTodoItemAsync(newItem);

            TableView.InsertRows(new [] { NSIndexPath.FromRowSection(index, 0) },
                                 UITableViewRowAnimation.Top);

            itemText.Text = "";
        }