Skip to Content

In the previous blog, I had talked about how you can create a fully functional (skeleton) Windows application with just a few clicks.  The business logic still needs to be included in the application by the developer.  In this blog, I will show you the layout of the application files and how you can modify files to add certain functionality.

Nuget Package Manager

Nuget Package Manager has an entry automatically created for the location of the SMP related Nuget packages.  The application wizard is also smart enough to only include the Nuget packages that are needed for the application.  Nuget packages are installed in the following folder – \Program Files (x86)\SAP SE\SMP SDK Installer.  No additional steps are required from the developer unless you want to install / uninstall SMP related Nuget packages.

To install / uninstall SMP related Nuget packages, simply open the Nuget Package Manager.  Select the automatically created Package source and you can install / uninstall SMP related Nuget packages.

Customization1.png

Understanding project files

Depending on the Windows platforms selected during application wizard, one or more projects might be automatically created.  Since the project is created based on Microsoft recommended principles, you will also find a Shared project that contains shared code between Windows 8.1 and Windows Phone 8.1 projects.

Customization2.png

Logging and Tracing files

The Utilities class implements the logging and tracing functionality amongst other things.  The project files are located under the Utilities folder.  The Utilities class is not one big monolithic file.  It is however implemented as partial classes.  This allows the developer to remove or edit files easily. For example, if the developer wants to create a new logger, then he can easily find the right place to add the necessary code in Utilities.LoggingTracing.cs file.

Note:

  • Windows 8.1 and Windows Phone 8.1 logging and tracing files can be found in Shared project
  • Customize these files based on your business logic

Customization3.png

Customization4.png

Settings file (Windows 8.1)

Settings are implemented as flyouts.  The project files are located under the Settings folder.  Registration settings are implemented in the SettingsFlyoutRegistration.xaml file while the logging and tracing settings are implemented in SettingsFlyoutLoggingTracing.xaml file.

Customization5.png

Customization6.png

Online Store

The Global.cs file implements the OpenODataStoreAsync method.  This is a public static method which creates the type of ODataStore instance needed by the application.  In the case of the application wizard, it uses the Online Store implementation.

Customization7.png

HttpClientSetup.cs sets up the SAP.Net.Http.HttpClient that is used for making HTTP requests. It also takes care of SSL certificate logic.

Rendering data is done using the ServiceBrowserControl.  The ServiceBrowser.xaml file is not included in Main.xaml file.  So it is easy to reuse this control in several pages.  It is also easy to remove the control.  All code to access data from the backend is separated in ServiceBrowser.xaml.cs file – This code only deals with accessing data.  So any new developer can get easily familiar with OData library that is provided with SMP SDK.

Adding Push Notifications

The application wizard currently doesn’t have support for push notifications.  But adding support for push notifications is fairly simple. Add the following lines of code after successful logon in the Logon_LogonCompleted event handler.

Customization8.png

Adding Offline Support

The application wizard creates the Windows application using the Online Store.  However, if your business logic requires the use of an Offline Store, then modifications to the generated code is necessary.

The Global.cs file implements the method OpenODataStoreAsync method.  The generated code creates an Online Store.  This method needs to be modified to create an Offline Store instead. This Offline Store is then used by the application for all CRUD operations.

Customization9.png

You also need to add code for Flush and Refresh operations.  Please check the following blog on OData functionality.

This concludes the 2 part series of the new features in Windows SMP SDK 3.0 SP 10.  Stay tuned for more exciting updates in SMP SDK 4.0 !!

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Juan Esteban Marriaga

    Hi Milton,

     

     

    I have a problem with performance of a windows offline application that use SMP, when I create the offline store my App take 3 minutes  downloading 60000 records for one entity, I dont know how can I improve the performance because when the app is offline opening the offline store this operation take another 3 minutes  and this is a big problem.

    Maybe you can help me with any indication of how can I resolve this problem?

    thanks for your tutorial its very useful.

    (0) 

Leave a Reply