vendredi 16 février 2018

Return of development expirence on using XAMARIN for Tizen TV [XAML,C#,TIZEN]

My return of Experience on the 16th of February 2018
Long story short: I have been playing around for a while now with Xamarin for Tizen TV, and this will be great for us XAML/.NET developer when:

  1. It is fully finished and compatible with Tizen TV,  Tizen 4 Tv are released to the public
  2. that the emulator really works correctly
  3. the debugger from Visual Studio actually works.
  4. You can create custom controls to make beautiful UI

Let me explain what I mean:
  • After having played with the framework and after feed back from Samsung and having spoken with a developer from the Xamarin porting team from Samsung, as of today Xamarin for Tizen is more in beta IMO then in release even thought the road map says that it is finished:
 The framework is usable but from what I am told 2018 will allow Samsung to finish developing/debug and see who is interested in using Xamarin for Tizen TV.
  • The Visual Studio Debugger is not working as it should, for example if you set a break point and launch the application on the emulator for Tizen TV I would be hit by one of the following issues either the app will crash, visual studio will crash or when you do hit the break point you will not be able to see the value in you objects using quick watch. (When using the same code FORMS code for UWP, Android or IOS the debugger worked perfectly)
As you can see here:

  • Another issue that Samsung has informed me is that the Emulator for Tizen 4 Tv, is not the best way to develop for their TVs they very strongly recommend that you buy a Tizen 4 TV, the Tv will be updated with the latest firmware and OS.  The emulator doesn't have the same performance as a TV
  • Currently Rendering custom controls on Tizen with Xamrin is not working which can also be issue as you can imagine.

All in all Samsung has a little way to go to finish the Tizen APIs for Xamarin and to finish polishing their code before we (developers) can start building awesome Tizen TV application =).  From what I am told the Xamarin porting team at Samsung are working at 100% to fix everything and I am sure that within a few months everything will be finished.


lundi 5 février 2018

Reactive UI with your UWP applications Example II (using your ViewModel) [XAML,C#,RxUI]

In the previous example we saw how to us Reactive UI on a auto complet, in this example we will see another example of how to Reactive UI on a ViewModel in your UWP application.

Here we will connect an property to a Service and a SelectedItem using ReactiveCommand.

First we will create a small class:

    public class MyItem
        public int id { get; set; }
        public string name { get; set; }

Next we will create a small service:

    public class MyItemService
        public IObservable<IEnumerable<MyItem>> GetUpcomingItems(int index)
            //get your items here
            //do your http call here
            return null;

Here is my ViewModel:

    public class MainViewModel : ViewModelBase
        //My item loader
        public ReactiveCommand<int, IEnumerable<MyItem>> LoadMyItems

        //my selected item
        MyItem m_selectedItem;
        public MyItem MySelectedItem
            get { return m_selectedItem; }
            set { RaisePropertyChanged("MySelectedItem"); }

        //my service
        private MyItemService myItemService;

        public MainViewModel()
            //init the serivce
            myItemService = new MyItemService();

            //getting items using the CreateFromObservable
            LoadMyItems = ReactiveCommand
                .CreateFromObservable((int index) =>

            //when the vm is activated bind the properties
            this.WhenActivated((CompositeDisposable disposables) =>
                SelectedItem = null;

                //when SelectedItem has a value go to page
                    .WhenAnyValue(x => x.SelectedItem)
                    .Where(x => x != null)
                    .Subscribe(x => LoadSelectedPage(x))

        public void LoadSelectedPage(MyItem item)
            //load this page

The interesting part are the loading of the items using ReactiveCommand.CreateFromObservable this will start the loading once this property is binded to a ListView or GridView.

Next the SelectedItem and the this.WhenAnyValue(x => x.SelectedItem) will allow me to navigate or perform an action when this property has a value.

As you can see, Reactive UI  allows us to bind events in the ViewModel, of course you could have used ICommand or RelayCommand but I find Reactive UI to be a much more elegant solution!

Happy coding!