iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi Domingo,
We have prepared a sample for you. You may check it out here :http://git.intersoftpt.com/projects/CROS-SUPP/repos/refresh-list-view/browse
This issue came up because another ViewModel run before the process of previous ViewModel finished. As a solution, it can be solved by managing the threads. Please pay attention on this code :
IViewService viewService = ServiceProvider.GetService<IViewService>(); if (viewService != null) { viewService.RunOnBackgroundThread(() => { viewService.RunOnUIThread(() => { this.NavigationService.Navigate<SimpleViewModel>( new NavigationParameter() { NavigationMode = NavigationMode.Modal, EnsureNavigationContext = true, ModalPresentationStyle = ModalPresentationStyle.Default }); }); }, 1); }
Hope this helps. Feel free to discuss it further if you have any other thought.
Regards,
Jevon Christian
Thanks for the question. Before I proceed, I would like to ask:
So basically you need to know when the view-level (your iOS project) OnViewCreated or ViewDidLoad is invoked by having a certain event in your view that triggers to a certain method in the view model (core project) ? If it's so, this could be problematic when you apply it across other platforms, since the lifecycles are different for each platform. Or, perhaps, you want to intercept view-level events? If it's so, you can do it right from the view controller itself. If I may suggest you to prepare methods in the view model, then can call something like
this.ViewModel.YourMethod();
from the suitable events your view controller. Is this desirable? But keep in mind that this approach may not work for other platforms and you might lose the "shared" code capability.
If the Navigated event is called in the view model and you might want to check perform certain operations for specific platforms by utilizing the IApplicationService to check the current platform. Like so:
IApplicationService applicationService = this.GetService<IApplicationService>(); if (applicationService != null) { IApplicationContext applicationContext = applicationService.GetContext(); if (applicationContext != null) { OSKind operatingSystem = applicationContext.Platform.OperatingSystem; if (operatingSystem == OSKind.iOS) { } else if (operatingSystem == OSKind.Android) { } } }
Kindly clarify so that I can assist you further with this issue. Thanks!
Hi Nich,
We already tried that approach, preparing methods from within viewmodel. But there's a weird behavior wherein the ViewModel property becomes null after invoking a viewmodel's method. This causes the TableView to become empty and bindings are no longer working. Here's the scenario:
How do you refresh the table view? Is it a manual refresh from the UITableViewController? Or is it a refresh from the ViewModel?
If you need to intercept when view is disposed, you might want to override the Dispose method and call your custom logic before calling base.Dispose(isDisposing) there.
Also, can you help me check the HashCode of the list view model before you navigate to the detail? Then, when you go back to the list view model from the detail, can you verify that the HashCode is the same? (to ensure that the instance of the view model is the same, also might want to check the Items property of the list view model).
However, if the view model is null (point no. 4), that means when you go back from the detail view, you're getting a blank view?
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname