User Profile & Activity

Jimmy Tungol Member
Page
of 13
Yeah. Well, there's that issue with the keypad. Apparently even with physical devices that behavior seems to be very annoying. Appreciate it if you can look at it. Thanks!
Thanks Arief! That worked!
Awesome! Hey Arief, I'm not sure if you noticed, that when the list is loaded the first time you set focus in a textbox for quantity (based on your samples) the keyboard popups for a split second and the focus from the textbox is lost. In return you need to click the textbox again to bring the keyboard back up. Please confirm and advise how we can fix it... Thanks!


Okay, I think this may be related to the emulator.

Awesome! Hey Arief, I'm not sure if you noticed, that when the list is loaded the first time you set focus in a textbox for quantity (based on your samples) the keyboard popups for a split second and the focus from the textbox is lost. In return you need to click the textbox again to bring the keyboard back up. Please confirm and advise how we can fix it... Thanks!
Hi Arief,

That is actually the error "Unable to perform data operation". The second one was just the stack trace, which we displayed in order to get more information. I don't know which line of code the error occurs, but guessing on the stack trace, it's when the LoadDataCore() method is being invoked somewhere in the Navigated event of the DataListViewModelBase.
Again, this error does not occur when running on Debug mode.
Here are screenshots of the error:


Continued


...and here's the code:

using System;using System.Collections.Generic;
using System.Linq;
using Intersoft.AppFramework;
using Intersoft.AppFramework.Identity;
using Intersoft.AppFramework.Models;
using Intersoft.AppFramework.ViewModels;
using Intersoft.Crosslight;
using Intersoft.Crosslight.Input;
using Intersoft.Crosslight.RestClient;
using Mercury.Domain.Data;
using Mercury.Mobile.Core.Models.EventAggregators;
using Mercury.Mobile.Core.Models.QueryDefinitions;
using Mercury.Mobile.Core.Services;
using Mercury.Mobile.Common.Extensions;

namespace Mercury.Mobile.Core.ViewModels.Collection
{
    public sealed class LocationListViewModel
        : DataListViewModelBase<Location, ILocationRepository>
    {
        #region Field Variables

        private IQueryDefinition f_FilterQueryDefinition;
        private IQueryDefinition f_ViewQueryDefinition;

        private User f_User;

        #endregion

        #region Constructors

        public LocationListViewModel()
        {
            // Configure data behaviors.
            this.EnableRefresh = true;
            this.EnableAsyncFilter = true;
            this.ExitEditModeOnDelete = true;
            this.EnableIncrementalRefresh = true;

            // Enable incremental loading.
            this.EnableIncrementalLoading = true;
            this.IncrementalLoadingSize = 20;

            // Customize the service descriptor.
            this.ServiceDescriptor = new ServiceDescriptor();
            this.ServiceDescriptor.Parameters.Add("userName", this.User.UserName);
            this.ServiceDescriptor.ServiceName = "LocationsByUser";
            this.ServiceDescriptor.HttpMethod = HttpMethod.GET;

            // Commands.
            this.LoadIncrementalCommand = new DelegateCommand(this.ExecuteLoadIncremental, this.CanExecuteLoadIncremental);
            this.CancelCommand = new DelegateCommand(this.ExecuteCancel);
            this.DoneCommand = new DelegateCommand(this.ExecuteDone);
        }

        #endregion

        #region Commands

        public DelegateCommand LoadIncrementalCommand { get; set; }
        public DelegateCommand CancelCommand { get; set; }
        public DelegateCommand DoneCommand { get; set; }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the filter query.
        /// </summary>
        /// <value>The filter query.</value>
        protected override IQueryDefinition FilterQuery
        {
            get 
            { 
                if (this.f_FilterQueryDefinition == null)
                    this.f_FilterQueryDefinition = new LocationQueryDefinition();

                return this.f_FilterQueryDefinition; 
            }
        }

        /// <summary>
        /// Gets the view query.
        /// </summary>
        /// <value>The view query.</value>
        protected override IQueryDefinition ViewQuery
        {
            get 
            { 
                if (this.f_ViewQueryDefinition == null)
                    this.f_ViewQueryDefinition = new LocationQueryDefinition();

                return this.f_ViewQueryDefinition; 
            }
        }

        /// <summary>
        /// Gets the user.
        /// </summary>
        /// <value>The user.</value>
        public User User 
        {
            get
            {
                if (this.f_User == null)
                    this.f_User = this.GetService<IUserService>().GetCurrentUser();

                return this.f_User;
            }
        }

        #endregion

        #region Methods

        private bool CanExecuteLoadIncremental(object paramater)
        {
            return this.EnableIncrementalLoading;
        }

        private void ExecuteLoadIncremental(object parameter)
        {
            this.LoadDataIncremental();
        }

        private void ExecuteCancel(object parameter)
        {
            this.NavigationService.Close(new NavigationResult(NavigationResultAction.Cancel));
        }

        private void ExecuteDone(object parameter)
        {
            this.NavigationService.Close(new NavigationResult(NavigationResultAction.Done));
        }

        #endregion

        #region Action Methods

        protected override void OnDataOperationFailed(Exception exception, DataAction action)
        {
            base.OnDataOperationFailed(exception, action);

            // This is only added to display the stacktrace on release.
            this.MessagePresenter.Show(exception.StackTrace);
        }

        #endregion
    }
}



Yes, that is a workaround we already applied. But please do inform us regarding CROS-397 and please confirm if this will work the same with iOS since the EditText property from the document is also bound to a string value. And if the iOS approach is going to work with more than one editable textbox as oppose to the sample shown on the document. As always, thank you for your support.
Hi,

Here's what we followed, and currently using an Ad-Hoc deployment for staging release.

https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/

Hi Arief,

That's what we're trying to confirm. How does the form builder handle numeric values? Can we apply the same approach when binding to a custom listview item like the one we're trying to accomplish here? Cause right now it only works on string values in which case that is not our goal in this scenario. We need to bind that text field to a nullable numeric value such as int?, decimal?, and/or double?. Here's the layout:

        <EditText
            android:id="@+id/NewRead"
            android:inputType="number"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:gravity="right"
            android:numeric="integer"
            android:singleLine="true" />

Please lemme know if there's something wrong with this layout. And here's the binding code from the BindingProvider:

p_ItemBinding.AddBinding("NewRead", BindableProperties.TextProperty, 
    new BindingDescription("NewValue", BindingMode.TwoWay, UpdateSourceTrigger.PropertyChanged));
All times are GMT -5. The time now is 4:27 PM.
Previous Next