By Michael Washington on
7/22/2012 9:00 PM
The Visual Studio LightSwitch HTML Client (preview) allows you to consume any JavaScript control. In future versions of the LightSwitch HTML Client, it should be easier to wire up custom JavaScript controls. With the current LightSwitch HTML Client, you have to perform a number of steps, however, it is still much easier than not using LightSwitch. In this article we will incorporate the Toastr plug-in that will display a popup Toast message…
|
By Kostas Christodoulou on
Friday, July 13, 2012
One of my favorite design patterns since the age of c++ is the Visitor Pattern. I will not explain here what the visitor pattern is. But, if you know how to use the design pattern this is a post worth reading. One may ask what the visitor pattern has to do with LightSwitch. Well, it doesn’t! I mean not exclusively. But the code below provides a full visitor pattern implementation background that can also be used in LS. Also, a part of the implementation is ideal for LS, since one of the challenges I had to face, when trying to widely use the visitor pattern, was make it work for “sealed” classes, classes that were not written by me and could not easily fit to my –reflection based- visitor pattern implementation. To solve this the best thing I could think of was “wrapping”. And working with LS, most of the classes (apart from the ones that belong to the domain/datasource) are actually “sealed” in the way described above.(I have...
|
By Kostas Christodoulou on
Friday, July 13, 2012
One very common task when one is implementing the business logic in Common project is writing custom PropertyName_Changed partial methods. This “approach” has an undesired “side-effect” when the property is an entity property (as compared to screen properties). The property changes many times during the lifetime of the object. While loading, while deleting etc., whereas what we want to implement is handle the “actual” property changes caused either by the user or by some other piece of business logic. I found myself debugging code that shouldn’t be executing (according to my logic, obviously LS had another opinion) before ending up writing a small extension method to use in all PropertyName_Changed partial methods. I don’t claim this method will help you avoid ALL unwanted business logic code execution, but covers most of the cases. I would be glad to read any comments improving it in a generic way. Here is the code of the extension method: public static bool IgnorePropertyChange(this IEntityObject...
|
By Kostas Christodoulou on
Friday, July 13, 2012
In the previous post I presented an extension method used mostly for overriding the edit and delete commands of a collection. One may ask “why do I want to do this?”. Apart from any other requirements/business logic dependent reason one might want to implement, for me there is one simple yet important reason: I don’t like at all (to be kind) the default add/edit modal windows when adding or editing an entry. It’s not a coincidence that the FIRST sample I wrote for LightSwitch and posted in the Samples of msdn.com/lightswitch was a set of extension methods and contracts to easily replace standard modal windows with custom ones. Most of the times when I have an editable grid screen, selecting Add or Edit I DON’T want the modal window to pop-up, I just want to edit in the grid. Or in list and details screen I want to edit the new or existing entry in the detail part of the screen. This is the main reason I most...
|
By Kostas Christodoulou on
Friday, July 13, 2012
As soon as I started writing LightSwitch applications I noticed that many times I was repeating the same code over and over for trivial tasks. So after all this time I have collected a number of extension methods that I widely use in my apps. For me reusing code is a must and although the implementation of LS (IMHO) does not provide for this out of the box the underlying framework is ideal for writing extension classes and methods that are a major step towards code reusability. If you have downloaded any of my samples from msdn or have seen my Application Logo post, you already suspect I am an “extension method fanatic”. So I will present a small series (I don’t know how small) of posts with extension methods from my Base.LightSwitch.Client library. The first method is one of the first (if not the first one) extension methods I wrote. As soon as you want to override the code for default commands like Edit and Delete for a collection (let’s name it MyCollection) you have to write something like that: partial void MyCollectionDelete_CanExecute(ref bool result){ if (this.MyCollection is null || this.MyCollection.SelectedItem == null) result = false; else result = true;}...
|
By Kostas Christodoulou on
Thursday, July 12, 2012
This is the most recent comment in the Application Logo Sample post: “Hi Kostas, I wanted to find out if there is a way of opening an active screen as soon as I click on the logo. I have tried but my attempt was in vain. If it is possible, could you please help me out? Thanks, Darryn” My first reaction was to ask for details (typical way of buying time ). But then I though I could do the changes required and post a new article. So simply put, this is the answer I propose to Darryn: public static void AddLogo(this Microsoft.LightSwitch.Client.IClientApplication application, System.Windows.HorizontalAlignment...
|
By Delordson on
Wed, 11 Jul 2012 07:24:43 GMT
The Golf Clubs app is a LightSwitch HTML Client Preview sample app which has a fully featured Silverlight Client as well as a mobile html client. You can download it from the Gallery. Here I describe how the HTML client was built. I wont cover the Silverlight client as there are many tutorials on the website and elsewhere showing how to do that.
|
By Michael Washington on
7/6/2012 3:00 PM
Visual Studio LightSwitch provides the fastest and easiest way to create Line-Of-Business, Forms-Over-Data applications. Previously LightSwitch produced only Silverlight applications. Now with LightSwitch in Visual Studio 2012, LightSwitch now allows you to communicate with its security and business layer through OData…
|
By Michael Washington on
7/1/2012 9:23 PM
This article describes a proof of concept for a native mobile application that can run on an Android or IOS tablet, and communicate with a Visual Studio LightSwitch application using OData…
|