Friday, May 22, 2015
Wednesday, May 13, 2015
Crafting Bytes announces partnership with RedGate Software
Crafting Bytes is proud to announce a special partnership with RedGate software.
http://blog.red-gate.com/redgate-partners-alm-experts/
People have been talking about Database Lifecycle Management (DLM) for a while. It’s all about extending existing ALM practices like source control, continuous integration, and automated deployments to the database.
Now I’m going to be talking about it in Philadelphia, San Diego, and Baton Rouge. Specifically, I’ll be running training workshops for Redgate on two aspects of DLM: Database Source Control and Automated Database Deployment. I’m really looking forward to this because Redgate have an amazing DLM solution that solves real problems bringing significant advantages to SQL Server professionals.
Want to know more? Visit Redgate’s workshop pages As a Redgate certified partner, I’m also happy to talk with you about your DLM needs. Feel free to contact me at contact@craftingbytes.com.
Saturday, May 9, 2015
Resource Sharing in Windows Universal Apps
CraftingBytes recently took on a Windows Universal project. As with any multiple device project one of the goals is to share as much as possible to avoid writing the same code twice.
The is no conditional compile in XAML, so that means that separate XAML files are needed in the cases where complete sharing is not possible. Luckily the Windows Universal project structure is set up so that all you need to do to share a XAML file is move the file into the Shared folder/project.
Styles are the appropriate way of providing a consistent styling across multiple pages /sections of the application, so it makes sense to try and place those in a common area. However, there will be some styles which will be specific to the Windows or Windows Phone projects. The tricky part is finding a way to share the bulk of the style, except for those pieces which are specific.
My first thought was to have a SharedStyles.xaml in the Shared folder, and a PlatformSpecificStyles.xaml in each Windows and WindowsPhone directory. Then in the App.xaml include first the shared files followed by the specific files. Something like this:
ResourceSharing.Shared\SharedStyles.xaml<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="HubSection" x:Key="HubSectionStyle"> <Setter Property="Background" Value="Pink" /> </Style> </ResourceDictionary>ResourceSharing.Windows\PlatformSpecificStyles.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="HubSection" BasedOn="{StaticResource HubSectionStyle}"> <Setter Property="Foreground" Value="Purple" /> </Style> </ResourceDictionary>ResourceSharing.WindowsPhone\PlatformSpecificStyles.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="HubSection" BasedOn="{StaticResource HubSectionStyle}"> <Setter Property="Foreground" Value="Blue" /> </Style> </ResourceDictionary>ResourceSharing.Shared\App.xaml
<Application x:Class="ResourceSharing.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="SharedStyles.xaml" /> <ResourceDictionary Source="PlatformSpecificStyles.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
However, it turns out that doesn't work. In order for ResourceDictionary A to reference a resource from ResourceDictionary B, the ResourceDictionary A needs to include the ResourceDictionary B itself. So the end result ended up looking like this:
ResourceSharing.Shared\SharedStyles.xaml unchanged ResourceSharing.Windows\Styles.xaml (renamed from PlatformSpecificStyles.xaml)<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="SharedStyles.xaml" /> </ResourceDictionary.MergedDictionaries> <Style TargetType="HubSection" BasedOn="{StaticResource HubSectionStyle}"> <Setter Property="Foreground" Value="Purple" /> </Style> </ResourceDictionary>ResourceSharing.WindowsPhone\Styles.xaml (renamed from PlatformSpecificStyles.xaml)
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="SharedStyles.xaml" /> </ResourceDictionary.MergedDictionaries> <Style TargetType="HubSection" BasedOn="{StaticResource HubSectionStyle}"> <Setter Property="Foreground" Value="Blue" /> </Style> </ResourceDictionary>ResourceSharing.Shared\App.xaml
<Application x:Class="ResourceSharingHubApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Styles.xaml" /> <!-- Styles contains both Shared and PlatformSpecific --> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>Hope that helps