﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Tue, 15 Apr 2014 08:18:31 GMT</pubDate><dc:creator>jevonchristian</dc:creator><description>&lt;p&gt;Hi Domingo,&lt;/p&gt;&lt;p&gt;We have prepared a sample for you. You may check it out here :&lt;span style="font-size: 10pt;"&gt;http://git.intersoftpt.com/projects/CROS-SUPP/repos/refresh-list-view/browse&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;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 :&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;IViewService viewService = ServiceProvider.GetService&amp;lt;IViewService&amp;gt;();
            if (viewService != null)
            {
                viewService.RunOnBackgroundThread(() =&amp;gt;
                {
                    viewService.RunOnUIThread(() =&amp;gt;
                    {
                        this.NavigationService.Navigate&amp;lt;SimpleViewModel&amp;gt;(
                            new NavigationParameter()
                        {
                            NavigationMode = NavigationMode.Modal, 
                            EnsureNavigationContext = true,
                            ModalPresentationStyle = ModalPresentationStyle.Default
                        });
                    });
                }, 1);
            }&lt;/pre&gt;
&lt;p&gt; &lt;span style="background-color: rgb(255, 255, 255); color: rgb(51, 51, 51); font-family: 'lucida grande', 'lucida sans unicode', helvetica, arial, verdana, sans-serif; line-height: 1.5em; font-size: 10pt;"&gt;Hope this helps. Feel free to discuss it further if you have any other thought.&lt;/span&gt;&lt;/p&gt;
&lt;p style="font-family: 'lucida grande', 'lucida sans unicode', helvetica, arial, verdana, sans-serif; -webkit-font-smoothing: antialiased; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; outline-offset: 0px; line-height: 1.5em; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); text-rendering: optimizelegibility !important;"&gt;Regards,&lt;/p&gt;
&lt;p style="font-family: 'lucida grande', 'lucida sans unicode', helvetica, arial, verdana, sans-serif; -webkit-font-smoothing: antialiased; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; outline-offset: 0px; line-height: 1.5em; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); text-rendering: optimizelegibility !important;"&gt;Jevon Christian&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Sat, 12 Apr 2014 17:03:36 GMT</pubDate><dc:creator>dfugaban@silentpartnersoft.com</dc:creator><description>Well, literally we are not getting a blank view. What we are getting is a non-responsive UI. Which means every data that is supposed to be in that view are gone. The commands that are bound to that view are no longer working. Well, you can keep clicking them but nothing happens.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;We are not dispoing anything from the view. And yes, the refresh is being called from the ViewModel and not from the UI. All seemed to be working without calling any methods from the ViewModel property of the UI.&lt;/div&gt;</description></item><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Fri, 11 Apr 2014 04:24:55 GMT</pubDate><dc:creator>nicholaslie</dc:creator><description>&lt;p&gt;Hi Domingo,&lt;/p&gt;&lt;p&gt;How do you refresh the table view? Is it a manual refresh from the UITableViewController? Or is it a refresh from the ViewModel? &lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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).&lt;/p&gt;
&lt;p&gt;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?&lt;/p&gt;</description></item><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Fri, 11 Apr 2014 04:09:38 GMT</pubDate><dc:creator>nicholaslie</dc:creator><description>&lt;p&gt;Hi Domingo,&lt;/p&gt;&lt;p&gt;How do you refresh the table view? Is it a manual refresh from the UITableViewController? Or is it a refresh from the ViewModel? &lt;/p&gt;
&lt;p&gt;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. &lt;/p&gt;</description></item><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Thu, 10 Apr 2014 01:12:52 GMT</pubDate><dc:creator>dfugaban@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Hi Nich,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;p /&gt;
&lt;ol&gt;&lt;li&gt;&lt;span style="font-size: 10pt;"&gt;Once the main view has loaded, the modal form gets called from within the view using ViewModel.ShowActivation(). &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 10pt;"&gt;The modal gets closed then the main view's table will be refreshed. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 10pt;"&gt;Once you click an item from the table view, it will navigate to the next screen. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 10pt;"&gt;Now, one you go back to the main view, the ViewModel is null.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;
&lt;p /&gt;</description></item><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Wed, 09 Apr 2014 23:43:43 GMT</pubDate><dc:creator>nicholaslie</dc:creator><description>&lt;p&gt;Hi Domingo,&lt;/p&gt;&lt;p&gt;Thanks for the question. Before I proceed, I would like to ask:&lt;/p&gt;
&lt;p&gt;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. &lt;span style="font-size: 10pt;"&gt;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&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;this.ViewModel.YourMethod();&lt;/pre&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;&lt;pre&gt;IApplicationService applicationService = this.GetService&amp;lt;IApplicationService&amp;gt;();
if (applicationService != null)
{
    IApplicationContext applicationContext = applicationService.GetContext();
    if (applicationContext != null)
    {
        OSKind operatingSystem = applicationContext.Platform.OperatingSystem;
        if (operatingSystem == OSKind.iOS)
        {
        }
        else if (operatingSystem == OSKind.Android)
        {
        }
    }
}&lt;/pre&gt;
&lt;p&gt; Kindly clarify so that I can assist you further with this issue. Thanks!&lt;/p&gt;</description></item><item><title>How to Use Crosslight to bind Events to a Command</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-bind-Events-to-a-Command/</link><pubDate>Wed, 09 Apr 2014 22:11:15 GMT</pubDate><dc:creator>dfugaban@silentpartnersoft.com</dc:creator><description>Hi Guys,
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;How do you extend Crosslight to bind an event to a command? Say for example on a view (ViewController or Activity or even on a Window), we need to know when the OnViewCreated or ViewDidLoad, etc has been triggered. Sure the ViewModel.Navigated is there, but this isn't always reliable and not always invoked.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;You mentioned within this thread &amp;lt;&lt;a href="https://www.intersoftpt.com/Community/Crosslight/How-to-Use-Navigation-Service-on-CrossLight-with-Login/" target="_blank"&gt;click here&lt;/a&gt;&amp;gt;, dunno what happend to that post anyway. Well, you mentioned that we can create custom presenters to load a modal view, that's definitely true. But that's useless if you can't invoke it. So, on Crosslight's perspective we need your expertise to help us bind events to a command.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;An example would be very useful. As always, thanks!&lt;/div&gt;</description></item></channel></rss>