Quantcast
Channel: Infragistics Community
Viewing all 2398 articles
Browse latest View live

Developer Humor: Happy Hour

$
0
0

I know I usually post these on a Wednesday to try and provide some extra mid-week inspiration, but this one was too good not to share right away. Hope you enjoy this little end-cap to your May!

Share With The Code Below!

<a href="http://www.infragistics.com/products/wpf"><img src=" http://www.infragistics.com/community/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/d-coding/3487.Tech-toon-_2D00_-2015-_2D00_-med-res-04.jpg " height="636" width="825" /> </a><br /><br /><br />Happy Hour by Infragistics <a href="http://www.infragistics.com/products/wpf">WPF Controls</a>

Creating a Knockout-Style Variable in C#

$
0
0

My first real-world single-page app (SPA) was written using the Knockout library, and it opened my eyes in terms of how powerful JavaScript has become. It appealed to me due to my familiarity with the Model-View-ViewModel pattern, and it was compatible with the jQuery controls used in the project.

As a C# developer, there were a few conventions I had to learn. Both JavaScript and C# are C-like languages, and I’ve used various versions of JavaScript for several years. But in my limited experience, I hadn’t encountered a technique used prevalently in Knockout.

The Technique

A ViewModel contains properties that must notify subscribers on change. In C#, one typically makes a ViewModel implementing INotifyPropertyChanged, then each observable property calls a method to raise the PropertyChanged event. Since properties aren’t necessarily supported in a browser’s JavaScript interpreter, knockout uses a different pattern. Here’s an example ViewModel adapted from the Knockout documentation:

varviewModel = {

    name: ko.observable('Bob'),

    age: ko.observable(123)

};

 

Since JavaScript is a dynamic language, you should try to change the value of one of the properties using an assignment operator. Each property is actually a function, and it can be changed by passing the new value in as an argument. This example will change the name to ‘Chris’.

viewModel.name(‘Chris’);

 

If you’re a C# developer, you may be wondering how to retrieve the value. With no arguments, the function returns the stored value.

viewModel.name();

 

This works exactly the same as a variable. In effect, the technique used by Knockout to create observables allows for variables with getters and setters, which I find rather fascinating.

Now in C#

I first attempted to implement this same technique in C# by implementing conversion operators. This works to a degree, but it doesn’t feel quite the same. The JavaScript variable is a function that holds a value and can change it. How can I implement that?

The function I want can take one or zero arguments. There’s one way to achieve that, but it means allowing any number of arguments. Here’s the delegate type I came up with.

publicdelegate T Observable(params T[] args);

I usually only encounter the params keyword in a method declaration, but it works in a delegate as well. If you want to be truer to the JavaScript version, you could use a non-generic version. In practice, this delegate will take one or zero arguments, so the generic constraint is appropriate.

You can view the ko.observable function as a static factory method that puts together the necessary pieces. In this case, I need it to create the Observable delegate using a closure to alternate execution paths. I’m going to violate typical C# naming conventions for illustration purposes.

publicstaticclassko

{

    publicstaticObservable observable(T initialValue)

    {

        T value = initialValue;

        return args =>

        {

            if (args != null&& args.Length > 0)

            {

                value = args[0];

                // notify subscribers

            }

            return value;

        };

    }

}

The observable method stores the initial value in variable and returns an Observable using a lambda statement. The statement captures the outer variable, setting it if args is neither null nor empty. It then returns the value.

Here’s a program to prove it works.

classProgram

{

    staticvoid Main(string[] args)

    {

        var name = ko.observable("Bob");

        Debug.Assert(name() == "Bob");

        name("Chris");

        Debug.Assert(name() == "Chris");

    }

}

Should I Use This

C# is an object-oriented language, and although recent versions borrow from other paradigms, constructs already exist for scenarios where this is useful. However, I can’t predict every situation one might encounter when creating an application or framework, and this is another tool in your belt. At worst, it makes a great party trick!

SharePlus and Launchpads - Customize SharePoint Data on the Move

$
0
0

As a result of the explosion in smartphones and tablets in recent years, consumers are now used to controlling and accessing many aspects of their lives from mobile devices - whether it’s email, banking, travel or their purchases. It’s therefore no surprise that those same consumers have begun to expect a similar level of flexibility and instant access from their devices in the workplace too.

Bring Your Own Device (BYOD), the consumerization of IT and other related trends offer many benefits and employees take this freedom for granted. Knowledge workers have come to expect their IT experience at work to be just as customizable as the IT they use in their private lives. And this is a good thing for enterprises: using a customizable enterprise IT solution offers a broad range of benefits to the business as well as to employees.

SharePlus from Infragistics taps into this need for customizable IT by offering individual users unique views of their company’s SharePoint solution through our customized Launchpads. Designed for tablets and smartphones - for the worker on the go - these Launchpads allow users to get to what they want directly. Let’s look at how you can customize your Launchpads in a little more detail.

Tailored to users

As the names suggests, Launchpads work as a ‘home screen’ which can be configured for the needs of specific users when they log in to SharePlus on their mobile device. For example, members of the sales team can configure their Launchpads so they can get instant access to the content which is most useful for them - in this case, sales reports, pipelines, targets and SharePoint sites. Project Managers, Admin teams or engineers would all want their Launchpads to show the things they need to get their jobs done.

SharePlus can be configured to match the ways users view the information they need; this can include almost any kind of content - reports, data, team site, PDF files and so on. It’s simple to set up a Launchpad using basic HTML, CSS, and Javascript knowledge.

Configuration within a few clicks

It’s clear that end-user autonomy doesn’t always sit comfortably with concerns around data loss and privacy, but with SharePlus Launchpads, have no fear. With SharePlus, permissions are managed at the content level in SharePoint. Users, developers, or IT admins don’t need to take any extra consideration. If the content is secured in SharePoint, it won’t be available in SharePlus for the specific user, either.

SharePlus allows IT teams to pre-configure and manage devices from a distance. The configuration possibilities here are available on a:

  • Central Application level: In which IT administrators can mandate what layout and customizations a user will experience
  • Site by site level: In which different sites or content sources can be configured with their own layout, which ensures users don’t have to stick to one layout for all their sites.

Mobile Device Management (MDMs) - Citrix XenMobile, Oracle Bitzer, MobileIron, and other integrations into SharePlus, add additional management capabilities and an extra layer of security.

Launch into Launchpads

Launchpads are built with HTML, CSS and JavaScript and can be enhanced with jQuery. SharePlus comes with its own API, which gives you the ability to access SharePoint information and dynamically render it regardless of online or offline status. 

A mature SharePoint platform will have more than likely been optimized for specific audiences.  Sales areas may lean towards being analytical and numbers led whilst Facilities Management areas will be more documents and form heavy. Each of these departments has specific audiences to cater for. In this scenario, all SharePlus enabled users will be able to move towards any of the available content-specific sites. When the SharePlus application opens, the user is presented with a welcome Launchpad that works as a customized doorway to SharePoint.

Now, let’s assume you are the user and want to navigate to the Facilities Management site. After interacting with the appropriate link to the site (via a tap or a swipe), you are presented with another Launchpad displaying the latest maintenance information. All of this content is dynamically loaded from SharePoint. All SharePlus Launchpads are highly interactive and optimized for mobile, and links to the SharePoint content can be navigated easily.

The new normal

Adapting a mature solution such as SharePoint for delivery on mobile devices is essential in a world of constant mobile content consumption. Solutions like SharePlus respond to this need, not only from a content consumer perspective but from an IT and data security angle too.

Try our SharePlus Enterprise for iOS demo now and see the wonders it can do for your team's productivity!

SharePlus for SharePoint - Download for Android

Developer News - What's IN with the Infragistics Community? (5/25-5/31)

Infragistics Reporting - June 2015: Service Release 14.2

$
0
0

With every release of Infragistics Reporting comes a set of release notes that reflects the state of resolved bugs and new additions from the previous release. You’ll find the notes useful to help determine the resolution of existing issues from a past release and as a means of determining where to test your applications when upgrading from one version to the next.

The Release Notes are available in PDF format and summarize the changes to this release along with a listing of each item. In order to download the release notes, use the following links:

Reporting 2014 Volume 2

Simplifying Routing in AngularJS

$
0
0

Usually AngularJS is used to create a single page application with multiple views. But we can create multiple views in an AngularJS-based single page application by using routing – and in this post we’ll learn how to do that!

What is Routing?

Routing allows us to logically divide the application in the multiple logical views to be loaded asynchronously.  Let’s take, for example, a single page Product application. We can break the various tasks that can be performed on that product into separate logical views as shown below,

·         View to add a product

·         View to delete a product

·         View to edit a product

·         View to display the products.

In AngularJS routing, each view has its own URL. For example, the four views of a single page product application as listed above may have URLs as shown below:

 

When we navigate to /ProductApp.html/#Add URL in the browser, the add view will be loaded asynchronously in the application main view. These views would be loaded asynchronously using routing in the application.

 

Routing Steps in AngularJS

More or less, we do the following tasks to accomplish routing in AngularJS:

·         Inject the route module in the app module

·         Add the $routeProvider in the config of the app module

·         Configure the routes

·         Create a controller for the templates

·         Create a view template as a separate html file (we may also have local views in JavaScript with the type text/ng-template)

·         Create the main view section in the HTML using the ng-view directive

To enable routing in the AngularJS app, we need to take the following steps:

 

Step 1

Add a reference of the AngularJS route library in the main html.

<scriptsrc="../Scripts/angular.js">script>

<scriptsrc="../Scripts/angular-route.js">script>

 

Step 2

Inject the ngRoute module to the main application module.

var MyApp = angular.module('MyApp', ['ngRoute']);

 

Step 3

Configure the routes by providing the following:

1.       URL of the route

2.       View template for the route

3.       Controller associated with the route

We can configure a route as shown below:

MyApp.config(['$routeProvider',

  function ($routeProvider) {

      $routeProvider.

        when('/Add', {

            templateUrl: 'templates/add.html',

            controller: 'AddController'

        }).

        when('/Update', {

            templateUrl: 'templates/update.html',

            controller: 'UpdateController'

        }).

        when('/Delete', {

             templateUrl: 'templates/delete.html',

             controller: 'DeleteController'

        }).

        when('/Show', {

             templateUrl: 'templates/show.html',

             controller: 'ShowController'

         }).

        otherwise({

            redirectTo: '/Show'

        });

  }]);

In the configure route above, whenever we navigate to baseurl/Add:

1.       Add.html template will be loaded in the view

2.       The AddController controller will pass #scope object to the template. Keep in mind that we may work with more than one controller on the view - and it’s also not mandatory to have a controller value configured at the time of route configuration.

 

Step 4

Creating the controllers: In AngularJS, a controller holds data and business logic. Each view will have their own data and the business logic. We can have controllers either inside the controller module or in the main module.

Controllers can be created in the main module as shown below:

 

MyApp.controller('AddController', function ($scope) {

 

    $scope.message = "Add View"

});

MyApp.controller('ÚpdateController', function ($scope) {

 

    $scope.message = "Update View"

});

MyApp.controller('DeleteController', function ($scope) {

 

    $scope.message = "Delete View"

});

MyApp.controller('ShowController', function ($scope) {

 

    $scope.message = "Home View"

});

 

Here we have created controllers with only one message property attached to the $scope object.

 

Step 5

Creating the templates: We have configured the route to keep the templates inside the templates folder of the application, however keep in mind that this is not mandatory. The template can be anywhere inside the application. Templates are the html file.

In this example we have created a templates folder, where we’ve added three html files: add.html, update.html, and delete.html.

add.html will look like this:

<divclass="jumbotron text-center"ng-controller="AddController">

    <h1>Add Viewh1>

    <p>{{message}}p>

div>

 

Exactly like the add.html, we can create other templates for update and delete.

 

Step 6

Creating the main view: In the main view, let’s go ahead and create a menu with bootstrap and add a div with directive ng-view.

 

        <navrole="navigation"class="navbar navbar-default">

            <divclass="navbar-header">              

                <ulclass="nav navbar-nav">

                    <liclass="active"><ahref="#Show">Homea>li>

                    <li><ahref="#Add">Adda>li>

                    <li><ahref="#Update">Updatea>li>

                    <li><ahref="#Delete">Deletea>li>

                ul>

            div>

        nav>

 

         <divng-view>div>

           

        div>

 

This view will be loaded in the div, attributed with the ng-view directive. Here we have configured the URL of the menu items to the routes name configured.  Also make sure that the ng-app directive value is set to the MyApp and references to the AngularJS library and AngularJS Route libraries are added to the html.  So the Index.html header will look like this:

 

<htmlng-app="MyApp">

<head>

    <title>Professional Tutortitle>

    <linkhref="../Content/bootstrap.css"rel="stylesheet"/>

    <scriptsrc="../Scripts/angular.js">script>

    <scriptsrc="../Scripts/angular-route.js">script>

    <scriptsrc="home.js">script>

head>

<body>

 

Running the application

On running the application, we can navigate to different views by appending the route name in the base URL. Now we have a complete single-page application in which different views are loaded asynchronously.

 

 

Passing Data to the View

We may have a requirement to pass data to the view. Let’s say we are working on a detailed view of a particular product. In that case, we need to pass the id of the product to display the details of that particular product. To pass the id, we need to configure the route as shown below:

 

when('/Show/:id', {

            templateUrl: 'templates/show.html',

             controller: 'ShowController'

         }).

 

And then in the ShowController we can read the id as shown below:

 

MyApp.controller('ShowController', function ($scope,$routeParams) {

 

    $scope.ProductId = $routeParams.id;

});

 

We can pass the id while navigating to the show view as shown in the listing below:

 

<liclass="active"><ahref="#Show/45">Showa>li>

 

Navigating on the button click

We may have another requirement to navigate to a particular view then a button is clicked. The example below shows how that can be done. In short, we need to call the function changeview on the ng-click of the button to navigate to the Update view:

 

MyApp.controller('SearchController', function ($scope, $http, $location) {

 

   

    $scope.changeview = function () {

        $location.path('/Update');

    }

 

});

 

Conclusion

In this post we covered everything you need to know to work with routing, different views, and single page applications in AngularJS. I hope this post is useful, thanks for reading!

Looking for an advanced set of HTML5 & JavaScript UI controls and components? Download IgniteUI now and see what it can do for you!


Five Basic Rules for Mobile Data Visualization

$
0
0

We’re not sure whether it’s a good thing or a bad thing, but today’s mobile users are a hard crowd to please. When they begin interacting with an interface, they very quickly lose patience with anything even slightly below standard, and can have little interest in learning to use confusing or unpredictable UIs. If you’ve ever found yourself so enraged with an app you’re ready to throw your phone against the wall, you’ll understand the need for creating interfaces which are user friendly.

We see enterprise apps make the same mistakes time and again - navigation is confusing, inputs and outputs are unclear and users end up feeling alienated from the product. Common data visualization errors include:

  • inappropriate display choices
  • variety for the sake of variety
  • too much information
  • noisy patterns and colors
  • inconsistency in coding and ordering

Fortunately, there are a number of simple rules you can follow to ensure you avoid these classic mistakes.

1. Play to your audience

As with any product, it’s essential that you think about who your audience is, what they will be using your creation for, why and in what context. We’re starting from the assumption that you’re building data visualizations for the enterprise context - so concentrate on designing the app so it will be appropriate for business users. Avoid childish animations or silly typefaces - no one wants to be making a sales pitch with an app that makes them look unprofessional.

Crucial considerations include:

  • Can users access data rapidly?
  • Does it tell a tale?
  • Does it let users express information in a way which is relevant to their work?

2. Think about the way information is displayed

There are a number of principles involved in displaying data effectively and these play into the way the human eye perceives and categorizes data and patterns. Awareness of these is crucial when you build an app which displays large quantities of data. You need to think about what information users need to understand your argument, and how much detail they need to comprehend the story the data is telling. When dealing with the limited space of a smartphone screen, consider the following ‘Gestalt principles’ in particular:

  • Proximity: objects close together will be perceived as connected
  • Similarity: objects, shapes and colours which look similar will be perceived as a group
  • Enclosure and continuity: objects or items which appear to be held within some kind of container are assumed to be related

3. Consider color

The colors you use to represent data are extremely important. Check out this source for tips on colors which work together well, and follow these guidelines for using color in charts. It might at first appear simple to use color in your data visualizations; assigning a shade to a value seems straightforward. However, if you have hundreds of values you’ll also have a confusing and inexplicable graph or chart. It’s a general rule that ‘less is more’ - so try and restrict the number of colors you’re using to somewhere between three and seven at a maximum. Much more, and users will be overwhelmed by what all those shades means.

And another thing: most UX designers should remember this, but a significant minority of the population is colorblind, and struggle to tell the difference between green and red. So, never put these two colors beside one another and avoid this classic mistake in your designs!

4. Keep it simple!

Why do we have graphs, charts and infographics in the first place? No, it’s not because they look awesome, it’s because they represent large quantities of data and tell a story in a simple way which the human brain can process more easily than brute figures and enormous spreadsheets. Bearing that in mind, the last thing a chart should do is be complicated and confusing to read. Anyone should be able to look at a graph and work out what it’s trying to say (check out this source for some basic guidelines). Given the reduced space on a mobile, it’s particularly important to:

  • Keep data on the graph or chart where possible - it’s ugly and confusing to have to read a ‘key’ on the side of the screen
  • Avoid side bars
  • Let users make selections easily

5. Space

Smartphones and tablets offer awesome possibilities for users to interact with and manipulate graphs, charts and other data visualizations. At the touch of a finger, they can play with information in a way which was previously very difficult if not impossible. But remember, they’re also exploring that information on a much more limited screen size. When designing the UX for your data visualizations, it must make the best use of screen space:

  • It needs to adjust to different screen sizes
  • Consider orientation - will your charts be as clear in landscape and portrait?
  • Is it touch friendly?
  • Does it include smooth representations such as carousels?

How to cope with a lot of data and concepts which can't fit in one screen? See Tobias Komischke's webinar on building effective dashboards.

Same data, but smarter

At Infragistics, we’re well aware of the challenges involved in displaying data effectively on mobile devices. Mobile devices offer awesome opportunities for interaction and manipulation, yet pose serious challenges when it comes to visualization and display on different devices and operating systems. Developers can explore our mobile controls and discover an even smarter way of displaying data. 

Download our mobile business intelligence app, ReportPlus, to see how we approach mobile dashboard design. ReportPlus is built for all levels of BI users - anyone can pull data from their data sources and turn that into meaningful information!
ReportPlus - Your Reports on iPad

An Introduction to Slopegraphs - Part 1

$
0
0

When discussing the origin of the slopegraph, the go-to reference seems to be Edward Tufte's "The Visual Display of Quantitative Information". On page 159 (of the second edition) he introduces a chart or "table-graphic" that "when read vertically, ranks 15 countries by government tax collections in 1970 and again in 1979, with names spaced in proportion to the percentages". In addition, each pair of names is connected by a single straight line. This is a slopegraph.

Rather than just redraw this graphic (you can find it here), the chart below uses the same principles but a different dataset: populations (in millions) of thirteen of the nineteen G-20 countries in 1960 and 2013, obtained from the World Bank website. I've also added a horizontal line to indicate the baseline of the scale used.

The elegance of the slopegraph comes from its simplicity - (usually) two columns of structured data and clear links between them, indicating changes and emphasizing discrepancies. In Tufte's original example, Britain stands out as the only listed nation whose receipts decreased. In the data above the lines show that the populations of all countries increased between 1960 and 2013, but some (e.g. Mexico) increased by a much greater amount than others (e.g. Germany).

I frequently use slopegraphs but they do have their limitations. Perhaps the most notable of these is that you will frequently find labels overlapping. In fact that's why the chart above doesn't display the other six G-20 nations. Five of the six omitted countries (Brazil, China, India, Indonesia and the USA) had a population in 2013 of 200 million or more. Including all these would have meant squashing all the other countries in to the bottom ~10% of the figure. But this is a problem that most chart types will struggle to deal with well, not just slopegraphs. The sixth omitted country, South Africa, had a population of "just" 53 million in 2013. In 1960 it was only 17 million and it is this that creates a problem, with its label overlapping with that of Canada. I'll look at dealing with overlapping labels in Part 2, and concentrate on the visual (rather than verbal) display of data in the rest of this article.

Alongside the slopegraph, Tufte is associated with a push for more data-rich graphics, exemplified by his invention of the sparkline. A slopegraph with just two data points for each country or other entity seems somewhat at odds with this philosophy. So what happens if we plot all the World Bank data on population size for the 13 countries?

When we plot a point for every year from 1960 to 2013 we get a completely different picture of the changes in population that have taken place. While the line for Mexico might not look massively different, for Japan and Russia things are far from linear. Japan's population growth rate started out high but shrank and is now slightly negative. And, roughly speaking, Russia's population grew, reached a maximum, started to decline, declined at a greater rate, levelled off and - in recent years - has started to rise once more! The simple slopegraph joining the two endpoints doesn't pick up any of that rich variability.

As is, the last chart has a problem of it's own that wasn't present in the original. Specifically, crossings can make following some curves from one side to the other rather difficult. For example, if I start off at the UK on the left and try to follow the curve I keep finding myself at Italy on the right-hand-side. If I follow Italy from the left-hand-side I still end up at Italy though. This is (I assume) a result of the Gestalt principle of continuity: "we are more likely to construct visual entities out of visual elements that are smooth and continuous, rather than ones that contain abrupt changes in direction" (Colin Ware, Information Visualization (Third Edition), page 183). In other words, in both cases after the lines meet, my brain chooses to follow the flatter line of Italy across rather than the UK's line when it diverges upwards. We can overcome this tendency by making the lines different colors as below. While multiple lines share the same color, there is no specific attribute they have in common - this is purely a matter of perceptual convenience.

I don't think this last chart is as elegant as the one at the top, but in this case the much finer detail it conveys more than makes up for that.


Working with Office 365 REST API with Fiddler

$
0
0

 

In one of my previous blog posts, I explained how to Setup an Application in Azure AD for Office 365 API Access – but in this blog post, we’ll take the next step and see how to work with the raw data and interact with the Office 365 REST API using a tool called “Fiddler”.

You heard me right: I will not be using Visual Studio, but instead will be working with the raw data to get the response from the services of Office 365.

Note: This is a blog post in continuation of the previous blog post “Setting up the Application in Azure AD for Office 365 API Access.”We will be using the same app that we configured in the Azure AD.

Steps to interact with Office 365 REST API

To interact with the Office 365 API you need to do three things:

1. Get the authorization code from OAuth Authorization Endpoint.

2. Get the Access Token for the specific resource from OAuth Token Endpoint.

3. Use the Office 365 REST URL to perform Office 365 Specific operations.

1. Get the authorization code from OAuth Authorization Endpoint.

Use the OAuth Authorization Endpoint URL to let the user sign in to Office 365 and give the application consent (in case of multi-tenant apps) for the requesting resources. Once the user logs in successfully, you will get the authorization token.

The following is the URL structure for getting the authorization code from the OAuth Authorization Endpoint:

Single tenant apps

https://login.windows.net/<.. tenantid="">/oauth2/authorize

?client_id=<.. clientid="">

&resource=Microsoft.SharePoint

&redirect_uri=<..replyurl>

&response_type=code

Multi-tenant apps

https://login.windows.net/Common/oauth2/authorize

?client_id=< .. ClientID ..>

&resource=Microsoft.SharePoint

&redirect_uri=<..replyurl>

&response_type=code

You should replace <..tenant-id..> with your tenant id . The tenant id can be retrieved from your Azure AD. The client id and the reply URL can be found in the Configure tab of the application in your Azure AD.

 

Below is the URL that’s been constructed to get the authorization code for my app.

https://login.windows.net/1960666b-26cd-4bbb-b89f-11f505f8b3c8/oauth2/authorize?client_id=ae2bae60-fc94-411e-bba0-43083e42ab1a&resource=Microsoft.SharePoint&redirect_uri=http://Infragistics.com&response_type=code

Now let’s open Fiddler and track what is happening. Let’s also open a browser and enter the above URL. This will redirect you to the sign in page. Login with your Office 365 login credentials. After a successful login, you will be redirected to the address set in the reply URL.

Switch back to Fiddler and you will see an HTTP 200 result with your Reply URL. Select it and then navigate to the Inspector window and select WebForms tab, then copy the authorization code as shown in the below screenshot.

 

2. Get the Access Token for the specific resource from OAuth Token Endpoint

This step requires us to the use the authorization code that we got in the previous step to request an access token for the specified resource.

We need to perform the POST request. The URL format the OAuth Token Endpoint is:

https://login.windows.net/<..tenantid..>/oauth2/token

The request body should contain the following parameters filled:

grant_type=authorization_code

&redirect_uri=<..redirect url="">

&client_id=<.. client="" id="">

&client_secret=<.. client="" secret="">

&code=<..  code ..>

&resource=https://outlook.office365.com

Replace the code with the authorization code that was created in the previous step. The client secret needs to be encoded.

Below you’ll see the sample URL and the request body constructed with the authorization token received from the previous step and used in Fiddler.

1. Open Fiddler and enter the Composer Tab.

2. Enter the following URL:

https://login.windows.net/1960666b-26cd-4bbb-b89f-11f505f8b3c8/oauth2/token

3. Add the code below in the header:

Content-Type: application/x-www-form-urlencoded

4. In the request body, paste the code below:

grant_type=authorization_code

&redirect_uri=http://Infragistics.com

&client_id=ae2bae60-fc94-411e-bba0-43083e42ab1a

&client_secret=n8wkm4fApdvmyfUNPcHaffEs0YYmwUCUrmb6l%2F0btSI%3D

&code=AAABAAAAiL9Kn2Z27UubvWFPbm0gLaBXb6-_i_KRM5kEQh4JBf8K9DSUsNq7elx95U9XPa-oz8LMghBPmnbqsorgAUlMoDGVMlk9oUfwL8K3xPBNZQSds-qKt96RJMOpz4EpLIyZ8e2zVrwT5TRERD0FMPc2Sh-LXTQbFUAFn-vvdLWcjPas23pcbZLMrpbwhse2-N_rxzT_s3sYwMmlyEZjjV14ETS1nIq0osmAiKIIBorxr0I7xOuxAX6G_OlSHvfAvtC2OvwfYBeRiukQ1GIqXrujSpXXwE3teaD4NGmVEMW6SOaUaX22UfvtdaeBLLN5g9-yc52zG1HjsqBna-lzd_g2l5Wl2OKpOBn5Lq06qpWMTr2lq6r5WXenmU-8SGRF9n0gDnPHo2xvIT7ssAeeByAeWHb26wmEz9JmdE-ziavF09r6vfTZUPv1A8MA0Gu1NEbm9DEY_eHC0qWM9FT2PbCgYp9_1r6wACh8GFpwCy98lMyjOMObaAcpS5zDaQQutp8KrL5oPj51q69loM2csnJGJZ3_hgjx1YAsfaSoyzL8hSBex5eGKHffh5CBNPeXL2a_etqv5SYyuvEJvSc3oRHlrl2S47M7pd0Q_QA-oS9OBhkgAA

&resource=https://outlook.office365.com

5. Change the request type to POST and execute the request.

As soon as you execute this in Fiddler, the response that you receive in json format contains the necessary access code which can be used to interact with Office 365.

3. Use the Office 365 REST URL to perform Office 365 Specific operations.

The next step is to query the Office 365 data using the access token that was received. In this example, let’s try to get the Calender events from the Office 365 account.

 

This requires us to construct the query against the Office 365 Exchange REST API.

1. In Fiddler, open the composer tab and select the Http method as GET.

2. Enter the URL in the composer tab's host

https://outlook.office365.com/api/v1.0/me/events

3. Enter the following the header

Accept:application/json

Authorization: Bearer {access token}

Replace the {access token} with the access token that was retrieved in the previous step.

Below is the sample request constructed with this demo app:

Accept:application/json

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL291dGxvb2sub2ZmaWNlMzY1LmNvbSIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzE5NjA2NjZiLTI2Y2QtNGJiYi1iODlmLTExZjUwNWY4YjNjOC8iLCJpYXQiOjE0MzA1MDU2MzYsIm5iZiI6MTQzMDUwNTYzNiwiZXhwIjoxNDMwNTA5NTM2LCJ2ZXIiOiIxLjAiLCJ0aWQiOiIxOTYwNjY2Yi0yNmNkLTRiYmItYjg5Zi0xMWY1MDVmOGIzYzgiLCJvaWQiOiIwZjRiZDhmNS02NGE3LTRmNDQtYjJkYS1jMzFmMjlmOTE5MTciLCJ1cG4iOiJzZW50aGlsQGlzZW50aGlsLm9ubWljcm9zb2Z0LmNvbSIsInB1aWQiOiIxMDAzN0ZGRTg5QUZEMDYxIiwic3ViIjoiWXR1NGctd3g3X0g2YlhudUxueFBHMDAzSzQycTEta05MMXEzVFhYMVBYQSIsImdpdmVuX25hbWUiOiJTZW50aGlsIiwiZmFtaWx5X25hbWUiOiJLdW1hciIsIm5hbWUiOiJTZW50aGlsIEt1bWFyIiwiYW1yIjpbInB3ZCJdLCJ1bmlxdWVfbmFtZSI6InNlbnRoaWxAaXNlbnRoaWwub25taWNyb3NvZnQuY29tIiwiYXBwaWQiOiJmN2U5N2E1Mi0xMjIzLTRlODEtODQzMS00ZTllMzc2ZmMyNjUiLCJhcHBpZGFjciI6IjEiLCJzY3AiOiJDYWxlbmRhcnMuUmVhZCBDb250YWN0cy5SZWFkIENvbnRhY3RzLldyaXRlIGZ1bGxfYWNjZXNzX2FzX3VzZXIgTWFpbC5SZWFkIE1haWwuU2VuZCBNYWlsLldyaXRlIiwiYWNyIjoiMSJ9.XFXS9V9ICbVgKcWw9-HKsXg1SC198MFHQ7mmxyKDFndzgnZbgfh1GLJyUIfYpkm4lkAYAPiJ3l8zt1kZar3u_TZ5md0tOby7H9b_GvSpy0TO_FCtQubPZ4DVUuodqKtU5B3c4ilbEBeeqs95iJ1EeIFsihZfDkiVO-YtYPyKvDcvw-w_4yTARL7gBwh8Vav1u5EUh8rSCDkyIhGq_Yz0Ny70GZfuBgt8OEdUwlX3P0BFmP7rNZdIRqDtklUjQb6oFMdOon2yothFvwB96RSB2j-ZSsbb-RUm7usI9Z-gwn8ii0qCgKDdGMeNImWGyUqxRzxXwfeOiqyxhsqSYcGjmA

4. Hit the Execute button to execute the request.

Immediately, you should see a HTTP 200 result with your events list in the results available in JSON format.

 

And there you have it! You’ve now seen how to work with the Office 365 REST API with RAW format using Fiddler. The sample we used here demonstrated how to get the user’s event list from the Calender. I hope you found this interesting! Stay tuned for more articles related to Office 365 in my upcoming blog posts.

 

 

Deep Dive into Custom Directives in AngularJS – Webinar recap

$
0
0

We recently held a webinar for the Indian region on May 29th titled “Deep dive Into Custom Directives in AngularJS”.

The presentation was attended by a good number of developers from the Indian region, and I covered a range of topics, including:

  • Directives in AngularJS
  • Create first custom directive
  • Controller in custom directive
  • Shared Scope
  • Inherited Scope
  • Isolated Scope

You can find a recording of the webinar here:

[youtube] width="560" height="315" src="http://www.youtube.com/embed/Ghex40XGdLY" [/youtube]

You can also find the presentation slides here.

Many questions were asked during the webinar, and while we tried to answer all of them, we may have missed some, so here are some of the important questions followed by our answers:

What are the scopes in AngularJS Directives?

There are three scopes:

  1. Shared scope
  2. Inherited scope
  3. Isolated scope

How we pass data in an isolated scope?

Data can be passed in three possible ways:

  1. Using the ‘@’ literal , string data can be passed
  2. Using the ‘=’  literal, an object can be passed
  3. Using the ‘&’ literal, an external function can be called.

What is the naming convention for AngularJS directives?

When we create custom AngularJS directives, names must be given in the camel case. So a custom directive can be created with the name myFirstDirective.

We can use the myFirstDirective custom directive either using the dash, underscore, or colon. It can be used as either of the following,

  1. My-first-directive
  2. My:first:directive
  3. My_first_directive
  4. My:first-direcrtve, etc.

Can we use custom directive as attributes of existing elements?

It depends on how the directive has been created. While creating the custom directive, by setting the value of restrict property, we can decide how the directive would be used. A directive can be used:

  1. As an element – value of the restrict property is E
  2. As an Attribute – value of the restrict property is A
  3. As a comment –  value of the restrict property is C
  4. As a class - value of the restrict property is M


We can also set multiple values for the restrict property. For example, if we want the directive to be used either as an element or attribute, then the value of the restrict property should be set to EA.

Once again, thank you so much for your interest in our webinars – and we look forward to seeing you at a future presentation!

Citrix Synergy 2015 Event Summary

$
0
0

2015 is the first year in which Infragistics exhibited at Citrix Synergy, which is one of

Citrix's annual trade shows. The conference itself boasts 5,000 attendees, Citrix employees and users alike, and they all are able to attend educational sessions as well as peruse the expo hall at their leisure. From Infragistics, the event team for this show was Michael Wit, Bill Masur, Chris Sullivan and myself.

The expo hall was open during all three days of the conference, and we had the pleasure of meeting with all different types of Citrix users, many of whom were incredibly excited about our Enterprise Mobility suite, which includes ReportPlus and SharePlus. 

If you haven't been to a Citrix show, I highlyrecommend you take advantage of the opportunity if it presents itself. Not only were the workshops and panels exceptional (I even got to attend a Women in Technology Networking Luncheon, which blew me out

of the water!), but the facilities of the conference, as well as the after-hours activities, were amazing! Citrix even went so far as to have one of their sponsors host the attendee party by renting out Universal Studios for the evening! 

Plus, I got to meet Iron Man. What beats that?!

A Step-by-Step Guide to Working with the ASP.NET Web API and AngularJS

$
0
0

In this post we will learn to work with AngularJS and ASP.NET Web API in a step by step manner. I’ll assume that you are already familiar with some of the basic terms like what AngularJS and a Web API is, and we’ll work in a hands-on way, fetching data from the database and displaying that in an AngularJS application using the following:

·         Database in the SQL Server

·         Data model using Entity Framework database-first approach

·         The ASP.NET Web API

·         Using the Web API in an AngularJS application

Essentially, data resides in the SQL Server database and is exposed as JSON data using the ASP.NET Web API. We then consume the JSON data from the ASP.NET Web API in the AngularJS application.

 

Setting up the Database

Here we have a table named city with the following columns:

 

The table is populated with the following data:

This table is inside the SQL Server, and we’ll connect to SQL Server using the Entity Framework database first approach.

 

ASP.NET Web API

Let us go ahead and create a Web API project in Visual Studio. To do this, select File->New Project-> Web Application>Web API as shown in the image below.

 

 On clicking Ok, we can verify in the solution explorer that a web API project has been created.

 

Creating the Data Model

Next, to create the data model we’re going to follow the Entity Framework database first approach. To do this, right click on the Model folder in the project and select Add new item.

 

From the next screen, select the “EF Designer from database” option.

 

On the next screen, click on the New Connection option. To create a new connection to the database we need to provide the database server name and choose the database from the drop down. Here we are working with the “Masterjee” database, so we’ve selected that from the drop down and provided the database server name djpc.

 

 

On the next screen, leave the default name of the connection string and click next. On the next screen we need to select the tables. Since we have only one table in the database, we will click on the table checkbox and select the City table.

 

 

As of now we have created the data model and added it to the project. Now we should see an EDMX file that has been added as part of the model in the project. At this point, let’s go ahead and build the project to verify whether everything is correct or not.

 

Scaffolding the Web API

Up til now, we’ve created the data model. Next, to create the WEB API, right click on the controller folder and a new controller.  In the installed template of controllers, select Web API 2 controller with actions, using Entity Framework as shown in the image below.  

 

 

As the model class, select the City class, and for the data context class, select masterjeeEntities class. We need to keep in mind that “masterjee” is the name of the database and by leaving everything as the default, the created context class name would be [databasename]Entities.

 

By clicking on Add, we are able to create the Cities Web API using the scaffolding. The created controller class will have a Web API for all the CRUD operations on the city table.

Now let’s build the project and run the application. In the browser we should be able to view the XML response of the created API as shown in the image below.

 

 

 

As of now we have successfully created the ASP.NET Web API for the CRUD operations on the City table.

 

Creating AngularJS Application

Now we need to create the AngularJS App to use the data returned from the API; essentially we need to create:

1.       A service to fetch the data from the Web API;

2.       A controller to use the service and pass data using the $scope object on the view;

3.       And a view to render the data.

 

Service

To consume to a Web API, let’s create an AngularJS Service. A service factory can be created as shown here:

 

MyApp.factory('CityService', ['$http', function ($http) {

 

    var urlBase = 'http://localhost:19098/api';

    var CityService = {};

    CityService.getCities = function () {

        return $http.get(urlBase + '/Cities');

    };

 

    return CityService;

}]);

 

We are using the AngularJS service $http to make an HTTP get operation.  AngularJS creates an instance of service when it is used, so unless the controller does not need data, AngularJS will not make a call to the ASP.NET Web API.

 

Controller

Now that we’ve created a service, next we need to create the controller and use the service to get the cities in the $scope object.  A controller can be created as follows:

 

MyApp.controller('UpdateController', function ($scope, CityService) {

 

    getCities();

 

    function getCities() {

        CityService.getCities()

            .success(function (cities) {

                $scope.cities = cities;

 

            })

            .error(function (error) {

                $scope.status = 'Unable to load customer data: ' + error.message;

 

            });

    }

});


Here we are injecting the CityService in the controller and on the success of the $http.get assigning the returned data to the $scope cities property.

 

View

On the view, using the $scope object, data will be passed from the controller. The view will render the data as shown below:

 

<divng-controller="UpdateController">

    <tableclass="table">

        <tr>

            <th>Idth>

            <th>Nameth>

            <th>Countryth>

        tr>

        <trng-repeat="a in cities">

            <td>{{a.Id}}td>

            <td>{{a.Name}}td>

            <td>{{a.Country}}td>

        tr>

    table>

 

div>

 

Running the application

On running the application in the view, the data will be rendered in the table as shown in the image below:

 

Conclusion

In this post we successfully demonstrated how to work with the ASP.NET Web API and AngularJS. I hope you found this post useful, and thanks for reading!

An Introduction to Slopegraphs - Part 2

$
0
0

In my previous post I looked at showing changes in time using slopegraphs. This was done with reference to changes in population for thirteen of the G20 nations between 1960 and 2013. However, slopegraphs can also be used to show differences between categorical variables. Sticking with the theme of demographics, and with those same thirteen countries, the slopegraph below - created using R (you could use Excel) - shows life expectancies for the year 2012. The horizontal dimension no longer portrays changes in time, but two distinct categories: male and female. The data comes from the World Heath Organization.

This, clearly, doesn't look great. In Part 1 I pointed out that one may have to adjust labels in order to prevent overlapping of text. In the example above all numbers are given to the nearest integer, so we have multiple instances of two or more labels that should go in exactly the same place. To overcome this we can use a vector-editing tool (with a pdf version of the above chart) and create lists of labels.

The example below has a similar problem to the one above. In this case we are comparing crude birth rates and death rates in 2013, using data from the World Bank website. Numbers are given to one decimal place and this chart suffers from both partial and completely overlapping labels.

We can give some labels a little nudge up or down (when values differ by 0.1) and list the others (when values are identical).

The big issue with both of the edited slopegraphs above is that, because we have multiple labels in the same vertical position, we have ambiguity working out which country name corresponds to which line. We can, of course, work things out by glancing from one side of the chart to the other but this does require some extra mental processing. In Part 1 I used color to help distinguish overlapping lines. Here we can use color to associate labels with their corresponding lines. In the case of the life expectancy chart we need four colors in order to unambiguously pair each label with a line; in the birth and death rate example, two is enough.

So are these multicolored slopegraphs useful? For all countries featured we see that the life expectancy for males is less than that of females. (I've arranged the color scheme according to how big this discrepancy is - green for four years, pink for five years, blue for six years and orange for more than six years.) If you read Part 1 you would have seen that the populations of Japan and Russia both changed in interesting ways between 1960 and 2013 and have not grown much recently. From the chart we see that the life expectancy of men in particular is low. By contrast, the life expectancy in Japan for men is one of the highest and for women is the highest. From the right-hand chart above we can see that Japan does have the lowest birth rate (the colours used in this case are just alternating and have no other meaning). It also has the third-highest death rate. It isn't that the Japanese are dying young, they just have an aging population (and little immigration).

The color examples above allow for a general visual exploration of the data. But if we really are just concerned with the details of one or two countries - like Russia and Japan - we can keep things grayscale and not have to worry about whether the charts will work in print or if readers with color-vision deficiencies will be able to distinguish labels. We can emphasize the countries of interest by making their labels bold and their lines black. We can deemphasize the other countries by using gray for their labels as well as lines.

Russian and Japan stand out as desired, yet we still have a background of other lines and labels to provide context. We might not be able to distinguish Australia from Italy without glancing from side to side but we can still read down the columns and compare the slopes of Russia and Japan to, collectively, everything else.

With reference countries relatively faint we can add a few more without worrying too much about clutter. Furthermore, the charts are useful coming from the other direction. Rather than highlighting countries of interest and looking to see if they're different, we can highlight countries that are different in some way. For example, below on the left we highlight only countries whose difference in life expectancy between men and women is greater than 7 (just Russia). On the right we highlight countries with a higher death rate than birth rate. In both cases we include (emphasized or deemphasized) all 19 of the G-20 nations.

To summarize, slopegraphs can be a simple (in terms of visual components) but effective form of data presentation. However, in some cases it can take a little extra thought and effort to make them clear and readable.

Want to build your desktop, mobile or web applications with high-performance controls? Download Ultimate Free trial now and see what it can do for you!

Developer News - What's IN with the Infragistics Community? (6/1-6/7)

$
0
0

I can't even begin to pinpoint a theme for this week's Developer News, you guys were all over the map! There's some great information in here, ranging from Business Insider all the way to Designer Depot, so check it out!

5. Microsoft vs. Google for Employees (Business Insider)

4. Angular JS, Backbone.js and Ember.js, Which Should You Choose? (gooroo_io)

3. 9 Programming Languages and the Women Who Created Them (JavaWorld)

2. Microsoft Edge: What Designers Need to Know (Designer Depot)

1. 10 Memes Only a Programmer Will Understand (Silicon Republic)

SharePoint as a Productivity Tool in the Modern Workplace: Our Top 10 Picks

$
0
0

Mobile workforce, 24/7 connectivity, Bring Your Own Device (BYOD), IoT, Cloud Computing … in the last few years the needs of individuals, teams and enterprises have become more complex than ever before. SharePoint, as one of the most widely used enterprise collaboration tools, tries to keep up with this new flexible work style. What is SharePoint’s current story and what features are Microsoft planning on their product roadmaps?

See our Top-10 list of blog pieces on the latest SharePoint innovations released and the new features expected in SharePoint and Office 365, as well as some practical insights on how to mobilize your SharePoint content:

1. The Microsoft Roadmap: Enterprise collaboration tools– what significant releases of Microsoft Office, SharePoint, Visual Studio, and Microsoft Dynamics CRM to expect in the coming months of 2015;

2. What's new on the Office 365 roadmap? – keep up with the most important changes announced on the Office 365 roadmap, regarding Yammer, OneDrive for Business, Outlook for iOS and Android, and Lync support for Mac;

3. Five ways going mobile with SharePoint increases efficiency– how enabling mobile collaboration can be a game-changer for enterprise team productivity;

4. Bringing a Mobile SharePoint Solution to Your Enterprise– which are the benefits from implementing a mobile SharePoint solution in your enterprise;

5. The Office 365 API vs. SharePlus for Building Mobile SharePoint Solutions– on the advantages of using SharePlus, a mobile SharePoint platform, versus using the Office 365 API for developing personalized enterprise-wide mobile SharePoint solutions for Android and iOS;

6. The Social Side of SharePoint– SharePoint is gradually becoming the social hub of the modern workplace. Learn more about Document Conversations and Groups in Office 365, Yammer in SharePoint, Delve - the next generation start page for your documents, and more;

7. Three tools every SharePoint tester needs to know about– the three testing tools that we think are absolutely essential for SharePoint managers, developers, and QA's;

8. How will Microsoft replace InfoPath forms in SP? - InfoPath allowed business and power users to build forms in portals. In this post we look at some alternatives to InfoPath;

9. What can we expect from SharePoint 2016? -  Will Microsoft provide us with the best of both worlds - SharePoint On-Premises features in conjunction with Office 365 in the Cloud?

10. Customize SharePoint Data on the Move– how to embrace the “bring your own device’ movement with custom mobile SharePoint views for iOS and Android devices.

Looking for a comprehensive and secure mobile Office 365 and SharePoint solution? Look no further. Download our SharePlus Enterprise for iOS free demo now and see the wonders it can do for your team's collaboration and productivity on the go!

SharePlus - Your Mobile SharePoint Solution


What’s New in The Latest Version of ReportPlus

$
0
0

We’ve been working hard to make it easier to design beautiful dashboards in ReportPlus, and we’re excited to tell you that this newest release of ReportPlus introduces completely redesigned visualizations for ReportPlus on iOS and Android!

Completely Redesigned Dashboards

In this release, we set out with two goals in mind. The first was to improve the overall design of the dashboards created in ReportPlus and the second was to make the experience of creating a beautiful dashboard incredibly easy. We feel that we’ve made huge strides in reaching those goals in this release.

In previous versions of ReportPlus, it was a little challenging and time consuming to create a great looking dashboard. Now with just a few taps you can apply an eye-popping design to your dashboards, leaving more time for the important things like creating and sharing dashboards with your team.

Themes, Themes, and More Themes

We’ve designed over 15 new themes that can be applied to any dashboard instantly with pre-selected color palettes chosen by our talented designers. You don’t have to waste time choosing each individual color, you simply select a theme and the design of your dashboard is instantly updated. We’ve used our knowledge in designing effective dashboards and have chosen themes and colors that help you clearly convey a story with your data. This way you can focus on your data and the insights you are trying to uncover.

In the app, in order to change the theme on a dashboard, click on “edit” when viewing a dashboard and then click on the “paint brush” icon to see the full list of themes available.

Choosing a Start Color for a Specific Widget

Each theme comes with an 8 color palettes chosen by our expert designers. By editing a widget, you can choose which color is the primary color of that specific visualization. For example, in our “traffic lights” theme in which the primary colors are green, yellow, and red, you can choose the order of the colors to ensure you are conveying the proper message with your data.

ReportPlus for Android

Back in April we released the first version of ReportPlus for Android devices and with this new release we will be including our new dashboard themes. If you are already a Pro subscriber on the iOS version, you can access your dashboards on your Android device at no additional cost. 

Now you can have practically your entire team sharing insights around their data whenever and wherever they are.  Currently, our Android app allows users to view dashboards created on iOS devices, so that your whole organization can see what’s going on in your business. This is an increasingly mobile world and we’ve got your mobile BI needs covered.  

In addition to adding themes to ReportPlus for Android, we have also added:

  • Support for Dropbox as a data source;
  • Improved support for SSAS Quick (local) filters;
  • Usability improvements;
  • And an Enterprise WebService that allows you to easily deploy the Enterprise version of ReportPlus directly through the App Store.

What This Means for Existing Users

For existing users, this release changes how your current dashboards are styled. We believe that if you take some time to look at our new themes you will find something that you will love.

Here’s a list of features that are no longer available in this release:

  • Inserting background images or colors.
  • Editing margins and borders.
  • Choosing individuals colors in color palette.
  • Chart Layout Options.

We have removed these features in an effort to simplify the experience of creating dashboards in ReportPlus. We didn’t take this decision lightly and we feel strongly that it’s the right direction for the future of ReportPlus. Our vision for ReportPlus has always been to make it insanely easy to create stunning data visualizations, and this update does exactly that.

A Look into the Future of ReportPlus

Our team is busy working on making ReportPlus the best cross-platform application in the business intelligence industry.  We are actively working on the future releases of ReportPlus for iOS, Android, Web, and Desktop, so that no matter where you are you can connect to your data and gain insights instantly. Stay tuned for more information on these future releases!

Please feel free to reach out to me directly at bmasur@infragistics.com with any questions, comments, or suggestions. Thanks! 

Want to Learn More About ReportPlus?

Download the app on iOS or Android today!


The Future of WPF Beyond the .NET Framework 4.6

$
0
0

Since WPF (Windows Presentation Foundation) was introduced by Microsoft in 2006 as part of the .NET framework, the platform has been on the rise in popularity among Windows developers. However, the lack of major improvements since August 2012 and Microsoft’s notion during Build 2014 that it was “… not planning on any investing in major changes to WPF” have reinforced speculations about the platform’s uncertain future. Fast forward several months to November 2014 and Microsoft’s Program Manager Harikrishna Menon announced that an active development on the platform has been resumed, focusing mainly in the areas of Performance, DirectX Interoperability, Modern HW Support and Tooling.  They acknowledged that WPF is still a very important technology, pointing that 10% of all newly created Visual Studio Projects at that time were using the WPF project template outlining some of the recent fixes developers will see in .NET Framework 4.6. However, some felt that the announcement was lacking true details regarding where the future of WPF is headed as one without a true roadmap.

The New Year started to bring more details around the specific areas of investment in WPF. In January 2015, the Microsoft WPF team published the Timeline Profiling Tool for VS2015 CTP5, which is a replacement for the existing XAML UI Responsiveness tool that supports WPF applications in Visual Studio 2015 CTP 5 – news that was welcomed by the community.

The WPF team continued to show that they listen to developers’ requests and in February of this year the XAML UI Debugging Tools available in VS2015 CTP 6 were released. These tools include the Live Visual Tree, Live Property Explorer and In-App Selection.

March 2015 brought a well-received, live Q&A session with members of the WPF and XAML Experiences Team, where they reassured attendees that “[Microsoft] is going to make WPF better, we are going to listen to our customers ‘’ stating that ‘’[WPF] is the UI Framework of choice for a large number of mission critical apps and we see that not to change in the near future.”

This statement brings us to the question around the future of WPF beyond the .NET Framework 4.6. Now that it seems to be more defined and clearer, how will it be judged by the recent and the future planned actions of Microsoft.

In support to this assertion comes the WPF team revealing that it is actively working to optimize WPF with the goal to react more quickly to customers’ needs. To achieve this, they are working on WPF App local or WPF Local. The principle here is that they extract the WPF assemblies out of the .NET framework and will be shipping them as NuGet packages. This approach would allow them to release much more quickly and more frequently. The same approach has been taken by the Entity Framework, for example.

With WPF Local, WPF will, by default, defer loading of certain parts of the visual tree. This means that invisible visuals, for example, will only be loaded when required, with the goal being to have less elements in the visual tree and therefore better performance.

By all means, it appears the Windows developers’ community has welcomed the news that Microsoft keeps investing in the platform, given that a great number of them use WPF as their first choice for building desktop business applications!

Understanding scopes in AngularJS custom Directives

$
0
0

In this post we will learn about different kinds of scopes in AngularJS custom directives. First we’ll start with a high level introduction of directives and then focus on scopes.

Directives

Directives are one of the most important components of AngularJS 1.X, and have the following purposes:

1.       Gives special meaning to the existing element

2.       Creates a new element

3.       Manipulates the DOM

Beyond ng-app, ng-controller, and ng-repeat, there are plenty of built-in directives that come with AngularJS, including:

·         ng-maxlength

·         ng-minlength

·         ng-pattern

·         ng-required

·         ng-submit

·         ng-blur

·         ng-change

·         ng-checked

·         ng-click

·         ng-mouse

·         ng-bind

·         ng-href

·         ng-init

·         ng-model

·         ng-src

·         ng-style

·         ng-app

·         ng-controller

·         ng-disabled

·         ng-cloak

·         ng-hide

·         ng-if

·         ng-repeat

·         ng-show

·         ng-switch

·         ng-view

 

Mainly, directives perform either of the following tasks:

·         Manipulate DOM

·         Iterate through data

·         Handle events

·         Modify CSS

·         Validate data

·         Data Binding

Even though there are many built-in directives provided by the Angular team, there are times when you might need to create your own custom directives. A custom directive can be created either as an element, attribute, comment or class. In this post, a very simple custom directive can be created as shown in the listing below:

 

MyApp.directive('helloWorld', function () {

    return {

        template: "Hello IG"

    };

});

 

While creating custom directives, it’s important to remember:

• The directive name must be in the camel case;

• On the view, the directive can be used by separating the camel case name by using a dash, colon, underscore, or a combination of these.

 

Scopes in Custom Directives

Scopes enter the scene when we pass data to custom directives. There are three types of scopes:

1.       Shared scope

2.       Inherited scope

3.       Isolated scope

 

We can create a custom directive with an inherited scope by setting the scope property to true as shown in the listing below:

MyApp.directive('studentDirective', function () {

    return {

        template: "

{{student.name}} is {{student.age}} years old !!

",

        replace: true,

        restrict: 'E',

        scope : true ,

        controller: function ($scope) {

            console.log($scope);

        }

    }

});

 

Shared and Inherited Scope

Shared scope and inherited scope are relatively easier to understand. In a shared scope, directives share the scope with the enclosed controller.

Let us assume that we have a controller as shown in the listing below:

 

MyApp.controller('StudentController', ['$scope', function ($scope) {

    console.log($scope);

    $scope.student = {

        name: "dj",

        age: 32,

        subject: [

            "math",

            "geography"

        ]

    }

 

    $scope.setGrade = function (student) {

        student.grade = "A+"

    }

 

}]);

 

Next let’s go ahead and create a custom directive as shown in the listing below:

 

MyApp.directive('studentDirective', function () {

    return {

        template: "

{{student.name}} is {{student.age}} years old !!

",

        replace: true,

        restrict: 'E',

        controller: function ($scope) {

            console.log($scope);

        }

    }

});

 

Here we can use the studentdirective on the view as shown in the listing below:

 

<divng-controller="StudentController">

            <student-directive>student-directive>

  div>

In the above snippet we are using the directive inside the div, where the ng-controller directive is set to StudentsController. Since we have not set any value for the scope property in the directive, by default that works in the shared scope mode.  Directives can access the properties attached to the controller scope. Any changes to the properties in the directive would be reflected to the controller and vice versa.  You’ll also notice that I’m printing the scope id for both the controller and the directive, and both id’s must be the same.

 

There is one problem with the shared scope: we cannot pass data explicitly to the directive, the directive directly takes the data from the enclosed controller.

In the inherited scope, the directive inherits the scope of the controller. Let’s take a look at how to create a directive with inherited scope below:

 

MyApp.directive('studentDirective', function () {

    return {

        template: "

{{student.name}} is {{student.age}} years old !!

",

        replace: true,

        restrict: 'E',

        scope : true ,

        controller: function ($scope) {

            console.log($scope);

        }

    }

});

 

Inherited scope is very useful in nested custom directives.

 

Isolated Scope

In Isolated scope, the directive does not share a scope with the controller; both directive and controller have their own scope. However, data can be passed to the directive scope in three possible ways.

1.       Data can be passed as a string using the @ string literal

2.       Data can be passed as an object using the = string literal

3.       Data can be passed as a function the & string literal

 

 

Isolated scope is very important because it allows us to pass different data to the controller.  To understand it better, let’s assume that we have a controller as listed below:

 

MyApp.controller("ProductController", function ($scope) {

    $scope.product1 = {

        name: 'Phone',

        price: '100',

        stock: true

    };

    $scope.product2 = {

        name: 'TV',

        price: '1000',

        stock: false

    };

    $scope.product3 = {

        name: 'Laptop',

        price: '800',

        stock: false

    };

 

    $scope.ShowData = function () {

        alert("Display Data");

    }

 

});

 

As you can see here, we have three different products and we want to pass it differently.

 

Pass data as a string

In the isolated scope, we can pass data as a string using the @ string literal. We can create a custom directive which will accept the string as an input parameter as shown in the listing below:

 

MyApp.directive('inventoryProduct', function () {

    return {

        restrict: 'E',

        scope: {

            name: '@',

            price:'@'

        },

        template: '

{{name}} costs {{price}} $
Change name

'

    };

});

 

In the above listing, we are passing two string parameters using the @ literal, meaning a string will be passed in the name and price variable.  The directive can be used on the view as shown in the listing below, where you’ll see we are passing a string value for name and the price in the directive.

 

<divng-controller="ProductController">

    <h1>{{product1.name}}h1>

    <inventory-productname="{{product1.name}}"price="{{product1.price}}">inventory-product>

div>

 

On running the application, we should able to see name and the price of product1.

 

When we click on the Change name button, only the name of the directive will be changed and ProductController product1 object would not be affected due to the isolated scope.

Also keep in mind that when we pass data in isolated scope as a string, it get passed in a one-way manner, so any change in the controller scope will be reflected in the directive. However, a change in the directive would not be reflected in the controller.

 

Pass data as an object

In isolated scope we can pass data as an object using the = string literal. We can create a custom directive which will accept object as input parameter as shown in the listing below:

 

MyApp.directive('inventoryProduct', function () {

    return {

        restrict: 'E',

        scope: {

            data: '='

        },

        template: '

{{data.name}} costs {{data.price}} $
Change name

'

    };

});

 

In the above listing we are passing one object parameter using the = literal. Here the object will be passed in the data variable. Directive can be used on the view as shown in the listing below. As we see we are passing an object value for a data variable in the directive.

 

 

<divng-controller="ProductController">

    <h1>{{product1.name}}h1>

    <inventory-productdata="product1">inventory-product>

    <h1>{{product2.name}}h1>

    <inventory-productdata="product2">inventory-product>

    <h1>{{product3.name}}h1>

    <inventory-productdata="product3">inventory-product>

div>

 

In the above listing we are using the directives three times and passing three distinct objects as input. On running, we’ll see the output as shown below:

 

 

Passing the object in the isolated scope works in two way binding mode, meaning any changes in the directive would be reflected to the enclosed controller. Let us say we pass product1 twice as shown in the listing below:

 

<divng-controller="ProductController">

            <inventory-productdata="product1">inventory-product>

            <inventory-productdata="product1">inventory-product>

        div>

 

When we run the application, the same object will be passed to both instances of the directive.

 

Clicking any of the Change name buttons will change the name of both the instance of the directives because same object is passed, and passing an object works in two-way mode. Any change in the directive would be reflected to the enclosing controller and vice versa.

Calling an external function

We can call an external function in the enclosed directive using the literal variable &. As we see with the ProductController, there is a ShowData() function. This function can be called in a custom directive by modifying the directive as shown below:

 

MyApp.directive('inventoryProduct', function () {

    return {

        restrict: 'E',

        scope: {

            data: '&',         

        },

        template: '

{{data.name}} costs {{data.price}} $

Change name

'

    };

});

 

Here the directive can be used on the view as shown here:

 

<divng-controller="ProductController">

            <inventory-productdata="ShowData()">inventory-product>

 div>

 

Conclusion

In this post, we started with a basic understanding of directives and then moved to scopes, where we learned that:

1.       Shared scope: directive and controllers share the scope and the data. We cannot pass data explicitly to the directive.

2.       Inherited scope: directive inherits the scope of the controller. We cannot pass data explicitly to the directive.

3.       Isolated scope: directive and controllers don’t share the data and scope. We can pass data either as a string or an object explicitly to the directive.

I hope you find this post useful. Thanks for reading!

 Looking for an advanced set of HTML5 & JavaScript UI controls and components? Download IgniteUI now and see what it can do for you!

Pluralsight and Infragistics Partner for an MVVM & Prism Webinar!

$
0
0

On June 30th at 11am EST, Infragistics and Pluralsight will partner for the first time to bring you a brand new, free webinar from Brian Lagunas - MVVM Made Simple with Prism.

Brian Lagunas, as one of the new owners of the Prism platform, and as a Pluralsight Author and Infragistics WPF Product Manager, is a true field expert on this topic. As such, in my opinion the best way to introduce this webinar is with a short excerpt directly from the expert himself:

"WPF developers have been using the MVVM design pattern since it was first introduced by John Gossman back in 2005. While MVVM has become the standard for the majority of WPF developers, there are a number of issues that have become side effects of the separations created by MVVM.

In a lot of cases, more questions than answers are the result of using the MVVM pattern: “how do I make the connection between the View and ViewModel?”, “how do I invoke actions in my ViewModels?”, “how do I communicate between ViewModels?”, “how do I navigate to other views from within my ViewModels?”, and more.

This session will walk you through how to simplify your WPF applications by using the features of Prism to implement MVVM and answer all of these questions and more. "

So if you have these questions, or really any others around the platforms Brian will be covering, be sure to register now and join us for the webinar. Hope to see you there!

Infographic: Why You Should Build Office-Inspired Apps

$
0
0

Why do many custom-built apps fail? Because they aren't familiar to their users. Check out the infographic below for more information on why you should build Office-inspired apps, and how Infragistics can help you!

You can also view the full-size infographic HERE.

Sources: Microsoft by the Numbers; 2014 Infragistics Survey

Share With The Code Below!

<a href="http://www.infragistics.com/products/wpf"><img src=" http://static.infragistics.com/marketing/Website/Infographic/office-inspired-infographic-2015.jpg" height="3406" width="612" /> </a><br /><br /><br /> Why Office Inspired is the Way to Go <a href="http://www.infragistics.com/products/ultimate">Infragistics Ultimate</a>

Infographic by Infragistics Infragistics Ultimate
Viewing all 2398 articles
Browse latest View live


Latest Images