Core no work equal in Android and iPhone

3 replies. Last post: May 11, 2015 10:12 AM by Arief Handany
Tags :

I've developed my first app in Android using Crosslight.

One of the activities of my app is a "DrawerViewModelBase". It has a "ListViewModelBase" in the center, and a "EditorViewModelBase" in the right side. The "EditorViewModelBase" is a Form.

		public ValesDrawerViewModel()		{			this.CenterViewModel = new ValeListViewModel();
			this.RightViewModel = new FiltroEditorViewModel();
		}

Right side is a filter that, when it is closed, updates the items of the center. To control this event, in Close method of "DrawerViewModelBase", I get new items in the CenterViewModel.

		public override void Close()
		{
			if (this.OpenedDrawer == DrawerSide.Right)
			{
				GetValesAsync();
			}
			base.Close();
		}
		protected virtual async void GetValesAsync()
		{
			...
			((ValeListViewModel)this.CenterViewModel).Items = selectResult;
			...
		}


In Android is OK, but in iPhone, when I Close the right side, it doesn't enter in Close method and it doesn't update items.

How can I solve this problem?

How can I send data between CenterViewModel and RightViewModel?


 

All Replies

Hi Cristobal,

We suggest you to use this method rather than overriding close:

        protected override void OnPropertyChanged(string propertyName)        {
            if (propertyName == "IsOpen")
            {
                if (this.IsOpen)
                {
                    //do something when the drawer is opened
                }
                else
                {
                    //do something when the drawer is closed
                }
            }
            base.OnPropertyChanged(propertyName);
        }

The reason is close method actually used for closing the drawer, if you just want to check if the drawer is closed or not, it is better to use IsOpen like code snippet in above.

For iOS i will inform our developer about this issue under code CROS-819, i will update you with the new information regarding this issue.

Best Regards,
Arief

Thank you Arief for your answer. Unfortunately this answer is not valid.


IsOpen is a property with get only, so that it doesn't use OnPropertyChange method.

If you put a breakpoint after of the conditional "if(property Name == "IsOpen")", the flow doesn't enter here.


I've tried too this solution in the Drawer Sample code, but it doesn't work either.


I look forward to your reply as soon as possible.

Hi Cristobal,

Actually, the method i give you is just a better way to manipulate drawers in Android (if you using Close it will also close the drawer so it is better using IsOpen)

About iOS version, In Android version however Google already give implementation for manipulating Drawer state but for iOS the function is still not yet implemented and also in the current version of Crosslight which also have been reported to our developer as a feature request under code CROS-816.

Nevertheless i will still try to help you to find alternative for iOS version of Drawer.

Also sorry for confusing wording.

Best Regards,
Arief

All times are GMT -5. The time now is 3:30 PM.
Previous Next