vendredi 1 mars 2019

XAMARIN Tizen for Tvs and .NET Standard 2.0 [2019][XAML, C#]

My return of Experience on XAMARIN for TIZEN TVs the 1st of March 2019

Here is documentation where you can find about Xamarin Forms for Tizen:

Having reseted my laptop since last time I had used Xamarin Tizen I needed to go through the all the different steps to re install Tizen, you can find the full steps here:

TIP: took me 10 minutes to figure out why I could not create an emulator image , make sure that in your package manager you install the Tizen 4 TV emulator and the Tizen SDK tools. Under Extensions SDK make sure you also select TV extensions, the download of all of the SDK and emulators can take up quite a long time so in the mean time I had recommended that you head over to Microsoft Docs for Tizen for some light reading =).

My Findings:

Last year when I used the Preview of Xamarin for Tizen here where my initial findings, you had the sensation that the SDK was not fully finish (being a preview that seemed normal), the emulator was very buggy and often crashed, the debugger did not work (unable to set a break point).

Framework versions:

  • Tizen.NET (5.0.0.14562)
  • Tizen.NET.Sdk (1.0.1)
  • Xamarin.Forms(3.6.0.26487)


The application that I built is on one page for now, it receives and formats my data into a a list that contains a list. It will populate a ListView, this first ListView data template will hold another ListView so that we can show data horizontally (imagine the Netflix application).

Universal Windows Platform (UWP) 

When creating this application I first started by the UWP as I thought it would be quicker,  the first issue that I was that the debugger did not want to stop on my break points I had the follow error:

"The breakpoint will not currently be hit. No symbols have been loaded for this document"

which is not practical (at all!).

To fix this issue I removed all of the bin and obj folders in my UWP app and removed this options
Debug=>Options=>General => Remove the check mark for "Enable Just My Code"
and it did the trick for me.

Here is what it looks like on the UWP app:


Not pretty but it gets the job done.

Next on Tizen for TV

For the Tizen, application the debugger is still "weak", it will break on you often unfortunately, another issue I found was that I was not not able to move the debug back when it hit a break point.

After a sometime even Visual Studio was telling me that something was wrong:


To be fair it was not all doom and gloom because the debugger did work sometimes:

And you could go inside the properties and investigate, this is a great improvement over the last time I tested this platform. On other issue that I found was that the debugger did not resurface errors, even when explicitly crating an error it never surfaced it.

When launching the app in the Tizen Emulator it can take a few seconds for everything to lunch.

Here is what the same app looks like in the Tizen emulator:

 It would seem that some of the binding elements are not 100% finished, none of the images will load. Also navigating inside the app is very very slow, from what I am seeing you might better off buying a Samsung TV to debug then using the emulator!

All in all here are a summary of my findings:

  1. Tizen 5 Tv SDK is working much better then the Tizen 4 Tv Sdk
  2. Te emulator really works this time (last year I needed hacks to get it working), however only the version 5 worked for me and not the version 4, also you must arm yourself with patience for the app to load.  Everything is very lagy in the emulator.
  3. the debugger from Visual Studio is now working"ish", it can crash your Visual Studio but at least this time around you cant setup break points in your code.
  4. Binding still seems to be an issue, maybe this is a Xamarin issue ill have to investigate




lundi 14 janvier 2019

[how to] Using Multilingual App Toolkit to translate your UWP application

In this post we are going to see who easy it is to make your application multilingual using Microsoft Multilingual App Toolkit to translate your UWP application.

First you need a class that will allow us to get the translated string by using the ResourceLoader property.


 public class MyLocalizedClass
 {
        private static ResourceLoader _localizedResources;

        public ResourceLoader LocalizedResources
        {
            get
            {
                if (_localizedResources == null)
                {
                    _localizedResources = new ResourceLoader();
                }

                return _localizedResources;
            }
        }


        public string this[string key]
        {
            get
            {
                if (_localizedResources == null)
                {
                    _localizedResources = new ResourceLoader();
                }

                return _localizedResources.GetString(key);
            }
        }
}

You will need to bind all of the text in your application to your resource file, you can do this as follow:


         <TextBlock
                    x:Name="Header"
                    Style="{StaticResource TitleTextBlockStyle}"
                    Text="{Binding Path=[MyApplicationHeader], Source={StaticResource LocalizedStrings}, FallbackValue='MyApplicationHeader'}"                    TextWrapping="NoWrap" />

My MyApplicationHeader key will need to be added in resources.resw with a value as follows:



Next we will need to structure our application to with a folder string at the root of the app, this folder will also need to add a folder en and then add a resource file that we will call: Resources.resw

It should look as follows:




Next you will need to install Multilingual App Toolkit v4.0 (VS 2017), which you can find here. Once installed in Visual Studio under Tools your should see Multilingual App Toolkit:

you will need to Enable selection in the Multilingual App Toolkit.


Next you are going to need to install the Multilingual App Toolkit 4.0 Editor.

Now we are going to add translation languages to the application, again make sure you have enable Multilingual App Toolkit in your UWP application next click on the project, select Multilingual App Toolkit and click on Add translation as follows:



I will add french:



A new folder should be created inside you Strings folder:


We are going to right click on the project and use automatic translate from English to French using machine translations:



If you select Generate machine translations and you have errors most likely the issue is that you don't have the correct credentials to use Cognitive Services, you can fix this by reading this.

Once you have fixed your credential issues or if you don't have any issues you should see that the resources file under fr has been updated with french translated strings:



Now to test this new language you can force your application in French by overriding the application language as follows:


 Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "fr"

Happy coding!