Development by Davis

Headlines

sábado, 13 de octubre de 2012

Development by Davis: “Text animation in LightSwitch” plus 5 more

Development by Davis: “Text animation in LightSwitch” plus 5 more


Text animation in LightSwitch

Posted: 12 Oct 2012 02:57 AM PDT

As you might know, in LightSwitch 2012 you can now add text labels that are not data-bound, which is something you could not do in the previous version except if using some tricks.

So you basically select the Add Text command in a screen:

Then you specify the text to be displayed:

Such a label is shown as Normal text but in the properties you can change this behavior by selecting a different formatting such as Warning, Note, etc.

Behind the scenes it is a TextBlock control from Silverlight, so you can definitely create nice animations so that your text message is more appealing, e.g. like in a Welcome screen.

So you can create an animation in code, through a Storyboard and a ColorAnimation that you apply to the Foreground property, of course after you get the instance of the TextBlock. Translating in code:

        Private Sub Search_Created()

            ' Find the control

            Dim newsText = Me.FindControl("TextNews")

 

            AddHandler newsText.ControlAvailable, Sub(sender, e)

                                                      'Get the istance

                                                      Dim block = CType(e.Control, TextBlock)

                                                      'Set a different color, if you like

                                                      block.Foreground = New SolidColorBrush(Colors.Blue)

 

                                                      'Create an animation

                                                      Dim sb As New Storyboard

                                                      Dim colorAnim As New ColorAnimation

                                                      colorAnim.AutoReverse = True

                                                      colorAnim.RepeatBehavior = RepeatBehavior.Forever

                                                      colorAnim.From = Colors.Blue

                                                      colorAnim.To = Colors.Orange

                                                      colorAnim.Duration = TimeSpan.FromSeconds(1)

 

                                                      'Apply the animation

                                                      Storyboard.SetTarget(colorAnim, block.Foreground)

                                                      Storyboard.SetTargetProperty(colorAnim, New PropertyPath("Color"))

                                                      sb.Children.Add(colorAnim)

                                                      sb.Begin()

                                                  End Sub

 

        End Sub

You can certainly change animation properties as you like more, so you can choose different colors or a different duration. When you open the screen that contains the aforementioned label, you will see how it is animated. Sweet

Alessandro


LightSwitch: a small guide for migrating apps from v1 to v2

Posted: 11 Oct 2012 01:47 AM PDT

I have been recently busy in migrating a quite complex LightSwitch application from v1 (2011) to v2 (2012) and so I'd like to share some considerations that can be useful before you start the migration process.

Actually, the process is very simple but requires you to pay attention against the following situations.

Extensions and 3rd party components

If your application uses extensions or controls by 3rd party producers, it is particularly important to ensure that a version supported by Visual Studio 2012 exists. In most cases, extensions for v1 are also correctly recognized and used in v2, but this is not a rule. So, before you do anything else, create a new empty LightSwitch project in VS 2012 and check that everything you need is available in the Extensions tab of the project's properties. If not, check for the availability of a new version. If one is not available, make an installation repair of the controls so that they can be recognized by VS 2012 if this has been installed after the extensions.

Server side: prerequisites

If your application is going to be published onto a Web server, as it often happens, you just need to install the .NET Framework 4.5 and the Web Deployment 3.0 tool. Assuming you are publishing the upgraded app onto the same server of the previous version, the Visual Studio LightSwitch 2011 server prerequisites are still good for version 2012, so you don't need anything else. Let me suggest to download the Web Deployment tool via the Web Platform Installer which makes things the appropriate way.

Server side: the database

Unless you want to upgrade to SQL Server 2012, your existing database will not need any changes since LightSwitch 2012 still supports previous versions of the db engine. Really cool.

Client side: Silverlight 5

Of course LightSwitch 2012 relies on Silverlight 5, so clients that will access your application will receive a warning which says that Silverlight must be also upgraded to version 5. In scenarios like the one I work for, so a Windows domain and users with limited privileges, this is a thing to take care about since if you want to avoid the need of (or you can't from remote connections) going to every workstation and logon with admin credentials to install the plug-in, you might want to plan a distribution like a WSUS server.

Silverlight projects with custom controls

In LightSwitch 2012, when you open a solution containing a Silverlight project exposing custom controls, such a project will not be automatically upgraded to version 5. For this reason, you must upgrade the project to version 5 of Silverlight by changing the project properties, but most importantly you need to upgrade references to assemblies if an updated edition targeting Silverlight 5 exists. Consequently, if an updated version of the assemblies does not exist, do not migrate. It is a good way to avoid a number of problems.

Deployment

The LightSwitch 2012's Publish Wizard now includes some more options especially when publishing to Web servers, but it is not mandatory to use them when upgrading. You won't change the previous settings and you can still publish the same way you did with version 1. Cool  However, let me give you a suggestion based on my practical experience: if you use 3rd party extensions or libraries, after you upgrade these components as well and before you publish to the server, remove the Bin subfolder from the application folder on the hosting Web server. After you have done this, go publish! The reason is that despite LightSwitch is careful enough to update all the required components, it can happen that not all of them are replaced with updated versions. By doing so, it will deploy all the correct files. Of course, make a backup of the Bin subfolder.

Conclusions

According to my personal real-world experience, these have been the most critical points when upgrading a LightSwitch application from v1 to v2. Keep in mind that Visual Studio 2012 will also upgrade the .LsProj file, which cannot be reverted. So, even if the IDE makes a backup, make one yourself: you never know. 

Happy migration!

Alessandro


WordPress 3.5 Beta 2

Posted: 12 Oct 2012 05:02 PM PDT

Two weeks after the first beta, WordPress 3.5 Beta 2 is now available for download and testing.

This is software still in development, so we don't recommend that you run it on a production site. Set up a test site to play with the new version. To test WordPress 3.5, try the WordPress Beta Tester plugin (you'll want "bleeding edge nightlies"). Or you can download the beta here (zip).

For more, check out the extensive Beta 1 blog post, which covers what's new in version 3.5 and how you can help. What's new since beta 1? I'm glad you asked:

  • New workflow for working with image galleries, including drag-and-drop reordering and quick caption editing.
  • New user interface for setting static front pages for the Reading Settings screen. (#16379)
  • New image editing API. (#6821)

As always, if you think you've found a bug, you can post to the Alpha/Beta area in the support forums. Or, if you're comfortable writing a reproducible bug report, file one on the WordPress Trac. There, you can also find a list of known bugs and everything we've fixed so far. Happy testing!


This posting includes an audio/video/photo media file: Download Now

Text animation in LightSwitch

Posted: 12 Oct 2012 02:57 AM PDT

As you might know, in LightSwitch 2012 you can now add text labels that are not data-bound, which is something you could not do in the previous version except if using some tricks.

So you basically select the Add Text command in a screen:

Then you specify the text to be displayed:

Such a label is shown as Normal text but in the properties you can change this behavior by selecting a different formatting such as Warning, Note, etc.

Behind the scenes it is a TextBlock control from Silverlight, so you can definitely create nice animations so that your text message is more appealing, e.g. like in a Welcome screen.

So you can create an animation in code, through a Storyboard and a ColorAnimation that you apply to the Foreground property, of course after you get the instance of the TextBlock. Translating in code:

        Private Sub Search_Created()

            ' Find the control

            Dim newsText = Me.FindControl("TextNews")

 

            AddHandler newsText.ControlAvailable, Sub(sender, e)

                                                      'Get the istance

                                                      Dim block = CType(e.Control, TextBlock)

                                                      'Set a different color, if you like

                                                      block.Foreground = New SolidColorBrush(Colors.Blue)

 

                                                      'Create an animation

                                                      Dim sb As New Storyboard

                                                      Dim colorAnim As New ColorAnimation

                                                      colorAnim.AutoReverse = True

                                                      colorAnim.RepeatBehavior = RepeatBehavior.Forever

                                                      colorAnim.From = Colors.Blue

                                                      colorAnim.To = Colors.Orange

                                                      colorAnim.Duration = TimeSpan.FromSeconds(1)

 

                                                      'Apply the animation

                                                      Storyboard.SetTarget(colorAnim, block.Foreground)

                                                      Storyboard.SetTargetProperty(colorAnim, New PropertyPath("Color"))

                                                      sb.Children.Add(colorAnim)

                                                      sb.Begin()

                                                  End Sub

 

        End Sub

You can certainly change animation properties as you like more, so you can choose different colors or a different duration. When you open the screen that contains the aforementioned label, you will see how it is animated. Sweet

Alessandro


LightSwitch: a small guide for migrating apps from v1 to v2

Posted: 11 Oct 2012 01:47 AM PDT

I have been recently busy in migrating a quite complex LightSwitch application from v1 (2011) to v2 (2012) and so I'd like to share some considerations that can be useful before you start the migration process.

Actually, the process is very simple but requires you to pay attention against the following situations.

Extensions and 3rd party components

If your application uses extensions or controls by 3rd party producers, it is particularly important to ensure that a version supported by Visual Studio 2012 exists. In most cases, extensions for v1 are also correctly recognized and used in v2, but this is not a rule. So, before you do anything else, create a new empty LightSwitch project in VS 2012 and check that everything you need is available in the Extensions tab of the project's properties. If not, check for the availability of a new version. If one is not available, make an installation repair of the controls so that they can be recognized by VS 2012 if this has been installed after the extensions.

Server side: prerequisites

If your application is going to be published onto a Web server, as it often happens, you just need to install the .NET Framework 4.5 and the Web Deployment 3.0 tool. Assuming you are publishing the upgraded app onto the same server of the previous version, the Visual Studio LightSwitch 2011 server prerequisites are still good for version 2012, so you don't need anything else. Let me suggest to download the Web Deployment tool via the Web Platform Installer which makes things the appropriate way.

Server side: the database

Unless you want to upgrade to SQL Server 2012, your existing database will not need any changes since LightSwitch 2012 still supports previous versions of the db engine. Really cool.

Client side: Silverlight 5

Of course LightSwitch 2012 relies on Silverlight 5, so clients that will access your application will receive a warning which says that Silverlight must be also upgraded to version 5. In scenarios like the one I work for, so a Windows domain and users with limited privileges, this is a thing to take care about since if you want to avoid the need of (or you can't from remote connections) going to every workstation and logon with admin credentials to install the plug-in, you might want to plan a distribution like a WSUS server.

Silverlight projects with custom controls

In LightSwitch 2012, when you open a solution containing a Silverlight project exposing custom controls, such a project will not be automatically upgraded to version 5. For this reason, you must upgrade the project to version 5 of Silverlight by changing the project properties, but most importantly you need to upgrade references to assemblies if an updated edition targeting Silverlight 5 exists. Consequently, if an updated version of the assemblies does not exist, do not migrate. It is a good way to avoid a number of problems.

Deployment

The LightSwitch 2012's Publish Wizard now includes some more options especially when publishing to Web servers, but it is not mandatory to use them when upgrading. You won't change the previous settings and you can still publish the same way you did with version 1. Cool  However, let me give you a suggestion based on my practical experience: if you use 3rd party extensions or libraries, after you upgrade these components as well and before you publish to the server, remove the Bin subfolder from the application folder on the hosting Web server. After you have done this, go publish! The reason is that despite LightSwitch is careful enough to update all the required components, it can happen that not all of them are replaced with updated versions. By doing so, it will deploy all the correct files. Of course, make a backup of the Bin subfolder.

Conclusions

According to my personal real-world experience, these have been the most critical points when upgrading a LightSwitch application from v1 to v2. Keep in mind that Visual Studio 2012 will also upgrade the .LsProj file, which cannot be reverted. So, even if the IDE makes a backup, make one yourself: you never know. 

Happy migration!

Alessandro


Text animation in LightSwitch

Posted: 12 Oct 2012 02:57 AM PDT

As you might know, in LightSwitch 2012 you can now add text labels that are not data-bound, which is something you could not do in the previous version except if using some tricks.

So you basically select the Add Text command in a screen:

Then you specify the text to be displayed:

Such a label is shown as Normal text but in the properties you can change this behavior by selecting a different formatting such as Warning, Note, etc.

Behind the scenes it is a TextBlock control from Silverlight, so you can definitely create nice animations so that your text message is more appealing, e.g. like in a Welcome screen.

So you can create an animation in code, through a Storyboard and a ColorAnimation that you apply to the Foreground property, of course after you get the instance of the TextBlock. Translating in code:

        Private Sub Search_Created()

            ' Find the control

            Dim newsText = Me.FindControl("TextNews")

 

            AddHandler newsText.ControlAvailable, Sub(sender, e)

                                                      'Get the istance

                                                      Dim block = CType(e.Control, TextBlock)

                                                      'Set a different color, if you like

                                                      block.Foreground = New SolidColorBrush(Colors.Blue)

 

                                                      'Create an animation

                                                      Dim sb As New Storyboard

                                                      Dim colorAnim As New ColorAnimation

                                                      colorAnim.AutoReverse = True

                                                      colorAnim.RepeatBehavior = RepeatBehavior.Forever

                                                      colorAnim.From = Colors.Blue

                                                      colorAnim.To = Colors.Orange

                                                      colorAnim.Duration = TimeSpan.FromSeconds(1)

 

                                                      'Apply the animation

                                                      Storyboard.SetTarget(colorAnim, block.Foreground)

                                                      Storyboard.SetTargetProperty(colorAnim, New PropertyPath("Color"))

                                                      sb.Children.Add(colorAnim)

                                                      sb.Begin()

                                                  End Sub

 

        End Sub

You can certainly change animation properties as you like more, so you can choose different colors or a different duration. When you open the screen that contains the aforementioned label, you will see how it is animated. Sweet

Alessandro


No hay comentarios:

Publicar un comentario