Telerik blogs

It has been a great two weeks since we introduced the Telerik platform.  I hope that you have had a chance to watch the keynote introducing the platform and showing how easy it is to use the Platform to build mobile applications.  A common question that has come up since we released the Platform, the Telerik website, and the Telerik 3.0 branding has been “What does this mean for my .NET development skills?  What about the Telerik .NET tools that I am currently using?” 

What this means for your .NET development skills is that you are going to see the benefit of a focused Telerik that is delivering to you a complete platform that allows you to build applications and services with your favorite tools for users on any screen.  The DevCraft collection is not going away, in fact, it is becoming even stronger with the addition of Platform resources to support it.  Instead of sounding like one of my favorite Brady Bunch characters chanting “Marsha, Marsha, Marsha” , I’m going to show you how the Platform brings great features to our .NET products.

AppBuilder

The AppBuilder feature on the Telerik Platform comes with Kendo UI built in.  Did you know that you can download editors and extensions to allow you to build applications from your Windows desktop?  Click the download button on the top menu of the Platform website and choose AppBuilder.


You will then have the option to download a stand-alone Windows client or a Visual Studio plugin to get started in an environment that you are already comfortable with.  In the future we will add more ways to work with the platform. For example, we’re planning to release a command-line interface that will allow any editor to integrate or the hardcore coders to work with the Platform from a console window.  Stay tuned for more cool integrations with the Telerik Platform.




Pro Tip:

Install the Visual Studio client, then grab the
Visual Studio Web Essentials extension.  With this extension, you will get amazing CSS, JavaScript, TypeScript and CoffeeScript support for your application development.  Web Essentials will parse all referenced JavaScript and CSS, giving you automatic completion of classes and JavaScript references as you work through your application.  It gets better:  while you are debugging your mobile application with Visual Studio, Web Essentials provides updates to Browser Link that work with the Telerik Mobile Device Emulator.  There is no substitute, install Web Essentials and build your application like a pro!

Back End Services

You have seen the keynote video where Burke showed off the sweet JavaScript API for working with our data services.  How can these be used with the other Telerik controls?  We’ve got you covered, with integrations available no matter your .NET environment.

First, download the .NET SDK by entering the same download screen as described with AppBuilder and select the ‘Backend Services’ item this time.  Select either .NET or Windows Phone depending on your needs:



Choose your project from the drop down list of projects that you have already configured.  Click the download button for the appropriate version of .NET that you are using, and then let the fun commence!

Common .NET Data Access

If you are constructing applications with .NET 4.0 and later, you can bind our controls to any object.  Consider building a repository object with the following syntax to begin trafficking data to Telerik Backend Services:

public class Repository
{
 
  private EverliveApp app;
 
  public Repository()
  {
    this.app = new EverliveApp("MY_API_KEY");
    app.WorkWith().Authentication().Login("USER_ID", "PASSWORD");
  }
}
Listing 1 - Simple Repository

Now you have the beginning of a Repository object to create, read, update, and delete data in your Backend Services project.  The User_ID and Password fields are the user id that you want to authenticate into your application with, and these could be requested from your application’s user.  The API Key comes from the API Keys menu on the left side of a Backend Services project.

 

With this information, you can create classes to match the types that you have created in Backend services.  These classes should descend from the Telerik.Everlive.Sdk.Core.Model.Base.DataItem type, so that they can be easily worked with over the service connection.  Add a Telerik.Everlive.Sdk.Core.Serialization.ServerType attribute to the class to indicate the name of the content type that the class represents.

For example, check this code snippet from my Activity data-transfer-object class that represents the Activities content type from the sample Friends application:

[ServerType("Activities")]
public class Activity : DataItem
{
 
  private string _Text;
  public string Text
  {
    get
    {
      return _Text;
    }
    set
    {
      _Text = value;
      this.OnPropertyChanged("Text");
    }
  }
 
}
Listing 2 - Sample Activity DataItem Class

Of course, my final implementation has references to the other fields in the Activity content type.  What is important to note here, is that we are raising the OnPropertyChanged event when the value of the property changes.  This prepares the API to know which values have changed when performing updates.

Finally, we can fetch and work with our data with syntax similar to:

public Activity GetById(Guid id)
{
  return app.WorkWith().Data<Activity>().GetById(id).ExecuteAsync().Result;
}

 

Listing 3 - Simple GetById method

With this approach, you can now use the data provided by Backend Services with any of the Telerik controls for any platform: WPF, ASP.NET, WinForms, or Windows 8.

Windows Phone Data Access

If you are developing apps for Windows Phone, we have you completely covered with a set of controls that make integration a breeze.  Check out the CloudDataForm, CloudFeedback, and CloudSettings for controls that simplify the storage of data, feedback, and settings information for your app using our Telerik Backend Services data storage. 

File Access

Telerik Backend services provides for File storage as well.  Fortunately, with the Telerik control sets in ASP.NET and Windows Phone you can easily store and retrieve data using this service.  Check out the following controls that we provide that make interacting with your cloud data a breeze:

 

 

Framework

 

Controls

 

ASP.NET

 

CloudUpload

 

Windows Phone

 

CloudPictureUpload

CloudPictureGallery

 

If you need access to your files stored on Backend services with another platform, we have APIs available in the same .NET SDK for you to be able to make simple calls to the server to fetch and store your files.  Uploading is as simple as:

var fileField = new FileField(“MyFiles”, “My File Name”, fileStream);
app.WorkWith().Files().Upload(fieldField).ExecuteSync();

 

Listing 4 - Upload a File Sample Code

Downloading is just as easy:

app.WorkWith().Files().GetFileDownloadUrl(fileId);

Security

There are a number of security options that you can use to protect your application with Telerik Backend Services, and they are all accessible through the .NET SDK.  You can easily authenticate your users with a Telerik Backend Services UserId and Password using:

var token = app.WorkWith().Authentication().Login("user", "password").ExecuteSync();

 

However, if  your users you would like to authenticate with Facebook, Google, or their Microsoft account you can easily use those services APIs to retrieve an access token and authenticate with a statement like:

var token = app.WorkWith().Authentication().LoginWithFacebook("FB_TOKEN").ExecuteSync();

 

This will take the Facebook access token and retrieve a Telerik access token for use on working with your application hosted on the Platform.  Every subsequent request will carry this account into authorization requests for data stored in Backend Services.

If you are a Windows Phone developer, you’re in luck!  We’ve already done a bit of the work for you, and there are controls to make this a breeze.  Check out the CloudRegistration and CloudLogin controls to allow you to secure your application.

Analytics

Telerik Analytics is the third pillar of the platform, and can easily be integrated into any .NET or JavaScript application.  You can download the Analytics SDK for .NET from the same download screen we saw previously, just choose the Analytics project type.  You can find your Analytics project API key on your Analytics project dashboard.  Just click Settings on the bottom left of the menu and your API key for use in your applications is in the middle of the screen:

In a .NET application, simply add the following code to be run at startup of the application:

IAnalyticsMonitor monitor = AnalyticsMonitorFactory.CreateMonitor("YOUR-PRODUCT_KEY");
monitor.Start();

and run the following code when your application stops:

monitor.Stop();

This will report back to your Analytics dashboard a user’s actions, locations, and any errors that are thrown by your application.  You can add custom feature tracking by adding the following code when an event occurs that you want to count:

App.Monitor.TrackFeature("Fritz.ReallyCoolApplication.BigRedButtonClicked");

WPF Development

If you are a WPF developer, and you are already using our WPF controls, you’ve got it REAL easy.  The new Telerik WPF project wizard will walk you through adding your API key and getting your project configured to track feature usage automatically.  Check out this great article from our Carey Payette about how to configure and get Analytics running with our WPF controls.

JavaScript Development

JavaScript developers who building a web application or perhaps a Windows 8 application with WinJS can find the JavaScript SDK in the same Download screen as the .NET developers.  Add the JavaScript library to your project, and during your application startup process add the following code to begin your monitoring session:

(function (g) {
  if (g._eqatecmonitor)
    return;
  try {
    // Create the monitor instance
    var settings = _eqatec.createSettings("YOUR_PROJECT_KEY");
    settings.version = "1.2.3";
    g.monitor = g._eqatecmonitor = _eqatec.createMonitor(settings);
    // Start the monitor when your application starts
    g.monitor.start();
  }
  catch (e) {
    console.log("Telerik Analytics exception: " + e.description);
  }
})(window);
Listing 5 - JavaScript Analytics Configuration

You can then add custom tracking for features of your application by calling:

window.monitor.trackFeature(“Fritz.ReallyCoolWebApplication.BigRedButtonClicked”);

Recommendation:

At this time, Telerik analytics is not optimized for server-side feature tracking and error reporting.  While it is possible to use Analytics in this environment, we do not currently recommend it.

You can learn more about getting started with Telerik Analytics and how to further customize your user tracking features in our helpful Analytics Getting Started documentation.

Mobile Testing

The final pillar of the platform is Mobile Testing.  By the very name of it, you can deduce that it doesn’t support testing of desktop applications.  However, besides being able to test your iOS and Android apps, you can also test web applications using a JavaScript plugin.

You can grab your Testing API Key from the dashboard of your Telerik Mobile Test Project.  In the top left corner, next to the Test Suites header is an API Key button.  Click that and you will be presented with a modal box that you can get your API key from:





Download the Mobile Testing JavaScript framework from the platform download screen.  With these libraries, you can begin configuring your website for testing.

Add the following three files from the framework you downloaded to your website in a folder called agent:

  • /Telerik Mobile Testing/extensions/web/TelerikTestingPrepareDomain.html
  • /Telerik Mobile Testing/extensions/web/TelerikTestingStorageFrame.html
  • /Telerik Mobile Testing/extensions/web/TelerikTestingWebAgent.js

You can then enable testing on pages that you want to instrument by adding a reference to the TelerikTestingWebAgent.js.

You can then write, execute, and publish tests just as you would against the iOS and Android frameworks.

If you are looking for a more robust testing tool that can perform performance testing, functional testing, and load testing we recommend that you check out Telerik Test Studio to assist with those tasks.

Summary

Telerik has introduced a powerful platform that provides immediate and first class support for mobile and hybrid application development. With a little bit of configuration, all of these features can be used by web developers and most of them can be used by all .NET developers.  What’s more, if you currently have a DevCraft complete package, many of the features of the Platform are built in to the various control suites for you to use.


About the Author

Jeffrey T. Fritz

Jeffrey T. Fritz is a Microsoft MVP in ASP.Net and an ASPInsider with more than a decade of experience writing and delivering large scale multi-tenant web applications. After building applications with ASP, ASP.NET and now ASP.NET MVC, he is crazy about building web sites for all sizes on any device. You can read more from Jeffrey on his personal blog or on Twitter at @csharpfritz. Google Profile


Comments

Comments are disabled in preview mode.