Creating and running a project

In this tutorial, you will learn how to:

  • Create a Tizen wearable project in Visual Studio 2019.
  • Build a Tizen wearable project into a Tizen package file(.tpk file).
  • Deploy and run a Tizen wearable application on a target; either the Tizen Wearable emulator or the Samsung Galaxy Watch.

Creating a new project

You can start building your application by creating a solution project. Follow the steps below to create a wearable Tizen .NET project:

  1. Install Tizen .NET development environment

  2. Launch Visual Studio 2019.

  3. Create a new project.

    When you first open Visual Studio, the following window appears, click Create a new project. If Visual Studio is already open, you can create a new project by choosing File > New > Project on the menu bar or by clicking the New Project button on the toolbar.

    Figure 1. Click Create a new project
    Figure 2. In Visual Studio menu, File > New > Project
  4. Select a project template and click Next.

    When the Create-a-new-project window appears, filter project templates by selecting C#, Tizen, and 5.5 from dropdown menus as shown in the image below.

    You can select the appropriate template according to the app type you want. In this tutorial, we choose Tizen Wearable Xaml App template to target Tizen 5.5.

    Note: Select Tizen 4.0 if you're building an app for Galaxy Watch based on Tizen 4.0.
    Figure 3. In project window, select Tizen Wearable Xaml App to target Tizen 5.5.
  5. When the configure-your-new-project window appears, enter "MySteps" in the Project name edit box. Visual Studio will automatically update the Solution name edit box to "MySteps".

  6. Change the disk location where your solution will be stored. Otherwise, it will be saved in %USERPROFILE%\source\repos by default. Then click Create.

    Figure 4. Configure your new project window

The Solution Explorer shows your Tizen .NET solution/project that you just created.

Here, we briefly introduce the folders and files in the Solution Explorer.

Don't worry if you cannot fully understand them right now. We will cover them in more detail later in the follow-up tutorials.

Figure 5. Visual Studio Solution Explorer view
  • res/: the directory that contains the application's resources (images, audio, video, etc)
  • shared/: a folder that stores resources that can be shared with other applications
  • App.xaml: a source file that defines methods for application life-cycle and application-scope resources
  • MainPage.xaml: a source file that defines the initial page of MySteps
  • MySteps.cs: a source file that runs MySteps using the Xamarin.Forms framework on the Tizen platform
  • tizen-manifest.xml: a file that contains all the meta-data of the application.

Building your application

To build your application, click Build > Build Solution on the Visual Studio menu bar or press Ctrl+Shift+B.

Figure 6. On the menu bar, click Build > Build Solution.
Note: To distribute your application to the users, you need to build a release version of your app by setting the Solution Configurations on the toolbar to Release.

If Visual Studio successfully builds the solution, it creates a Tizen package file named org.tizen.example.MySteps-1.0.0.tpk. The Tizen Package (.tpk) is the package file format for installation and distribution of Tizen .NET apps.

You can check the full path of the created .tpk file in the Output window.

  • Release build - <the location of your project>/bin/Release/tizen60/org.tizen.example.MySteps-1.0.0.tpk
  • Debug build - <the location of your project>/bin/Debug/tizen60/org.tizen.example.MySteps-1.0.0.tpk
Figure 7. Visual Studio Output window

Deploying and running your application

To run your application, you must first deploy the built package file to a target: either an emulator or a real device. Deploying refers to transferring the package file to the target and installing it.

Run MySteps on an emulator

  1. On the Visual Studio menu bar, select Tools > Tizen > Tizen Emulator Manager. Alternatively, click Launch Tizen Emulator on the toolbar to open the Tizen Emulator Manager.

    Figure 8. In Visual Studio, Tools > Tizen > Tizen Emulator Manager
  2. When the Emulator Manager window appears, select Tizen 5.5 Wearable emulator and press the Launch button. If no applicable emulator exists, create an emulator instance.

    Figure 9. Emulator Manager
  3. Once you launch Tizen Wearable emulator, you can run your app in debug mode on it by using F5 shortcut key or use Ctrl-F5 shortcut key to start your app without debug mode.

  1. If the deployment is successful, MySteps will run on the emulator as follows.

    Figure 11. Running MySteps on a Galaxy Watch emulator

Run MySteps on Samsung Galaxy Watch

The connection between a PC and a Galaxy Watch requires a wireless connection. Thus, you need to have a wireless access point.

  1. Turn on the debugging mode by toggling the switch button to On in Settings > About watch > Debugging.

    Figure 12. Turn on debugging mode in Galaxy Watch.
  2. Turn on the Wi-Fi connection in Settings > Connections > Wi-Fi and then select Wi-Fi networks. After the device has completed the scanning for wireless connections, select the Wi-Fi network that you wish to connect.

    Figure 13. For example, the Galaxy Watch is connected to a wireless network named 'TizenAPI'.
  3. After the Galaxy Watch has connected to the Wi-Fi network, you need to check the IP address assigned to the device. This IP address will be used in the following steps by the Tizen Device Manager.

    Figure 14. Check the IP address of your Galaxy Watch.
  4. On the Visual Studio menu bar, open the Tizen Device Manager by clicking Tools > Tizen > Tizen Device Manager.

    Figure 15. In Visual Studio, Tools > Tizen > Tizen Device Manager
  5. Open Remote Device Manager and click Add Device.

    • In the Name edit box, write a name for your Galaxy Watch. (e.g. Wearable Watch)
    • In the IP edit box, write the IP address of your Galaxy Watch.
    • Leave the port number as it is.
    • Click the Add button.
    Figure 16. Tizen Device Manager
  6. Toggle the Connection switch button to "ON".

    Figure 17. Toggle the connection switch to "ON".
  7. Press Ctrl+F5 in Visual Studio to deploy and launch without debugging on the device, or press F5 to launch in debugger mode.

In this tutorial, you've learned how to create, build, and run a Tizen .NET app for Galaxy Watch. In the next tutorial, you'll learn how to create the main page of MySteps.