View LoadOnDemandExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.LightSwitch.Client; | |
using Microsoft.LightSwitch.Details.Client; | |
using Microsoft.LightSwitch.Framework.Client; | |
using Microsoft.LightSwitch.Presentation; | |
using Microsoft.LightSwitch.Presentation.Extensions; | |
using Microsoft.LightSwitch.Presentation.Internal; | |
using Microsoft.LightSwitch.Sdk.Proxy; | |
using Microsoft.VisualStudio.ExtensibilityHosting; | |
using System; | |
using System.Collections.Generic; |
View myscreen.lsml.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myapp.menuHome.buttonResources_postRender = function (element, contentItem) { | |
$(element).spOverlay(contentItem, 'Content/Images/TouchIcons/ResourcesLarge.png', { height:170, width:170}); | |
}; | |
myapp.menuHome.buttonDesigns_postRender = function (element, contentItem) { | |
$(element).spOverlay(contentItem, 'Content/Images/TouchIcons/DesignsLarge.png'); | |
}; | |
myapp.menuHome.buttonProjects_postRender = function (element, contentItem) { | |
$(element).spOverlay(contentItem, 'Content/Images/TouchIcons/ProjectsLarge.png'); |
View ExpressionCombiner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Shoutout to MBoros on stackoverflow | |
public static class ExpressionCombiner { | |
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> exp, Expression<Func<T, bool>> newExp) | |
{ | |
// get the visitor | |
var visitor = new ParameterUpdateVisitor(newExp.Parameters.First(), exp.Parameters.First()); | |
// replace the parameter in the expression just created | |
newExp = visitor.Visit(newExp) as Expression<Func<T, bool>>; | |
// now you can and together the two expressions |
View offendingJs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userViewer = $('<a id="userviewer" href="#" target="_self" >' + user.Name + '</a>'); | |
userViewer.appendTo($(".msls-screen-buttons")); | |
//interaction 1 | |
userViewer.on('click', function () { | |
myapp.showEditMyProfile(user); | |
}); | |
contentItem.dataBind("value.Name", function () { | |
//interaction 2 | |
$("#userviewer").text(contentItem.value.Name); |
View createUserLink.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$(".msls-navmenu-button").hide(); | |
$(".msls-screen-buttons").empty(); | |
var hijackUI = function (contentItem) { | |
var user = contentItem.value; | |
//Create a link | |
var userViewer = $('<a id="userviewer" href="#" target="_self" >' + user.Name + '</a>'); | |
userViewer.appendTo($(".msls-screen-buttons")); | |
//Bind the click event |
View ColorBackground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<IContentItemPresenter> GetAssociatedPresenters(this IContentItem contentItem) | |
{ | |
var internale = contentItem as IContentItemInternal; | |
if (internale == null) | |
return new List<IContentItemPresenter>(); | |
return internale.AssociatedPresenters; | |
} | |
public static void SetBackground(this IContentItemPresenter presenter, Color color) |
View FindContentItems.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<IContentItem> FindContentItems(this IScreenObject screen, IEntityProperty viewModel) | |
{ | |
IPresentationScreenView screenView = VsExportProviderService | |
.GetServiceFromCache<IServiceProxy>().ScreenViewService.GetScreenView(screen) as IPresentationScreenView; | |
if (screenView == null) | |
{ | |
throw new InvalidOperationException(); | |
} | |
IContentItem currentView = screenView.ContentItemTree; |
View script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CheckMySite() { | |
//Thanks to Sandrino Di Mattia: http://fabriccontroller.net/blog/posts/job-scheduling-in-windows-azure/ | |
warmUpSite("https://mysite.azurewebsites.net/HTMLClient/default.htm"); | |
warmUpSite("https://mysecondsite.azurewebsites.net/HTMLClient/default.htm"); | |
} | |
function warmUpSite(url) { | |
var currentdate = new Date(); | |
View LightSwitch T4 Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ template debug="true" hostSpecific="true" #> | |
<#@ output extension=".cs" #> | |
<#@ Assembly Name="System" #> | |
<#@ Assembly Name="System.Core.dll" #> | |
<#@ Assembly Name="System.Xml.dll" #> | |
<#@ Assembly Name="System.Xml.Linq.dll" #> | |
<#@ Assembly Name="System.Windows.Forms.dll" #> | |
<#@ import namespace="System" #> | |
<#@ import namespace="System.IO" #> | |
<#@ import namespace="System.Diagnostics" #> |
View Script.SampleCustomers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET IDENTITY_INSERT [dbo].[Customers] ON; | |
MERGE INTO [dbo].[Customers] AS Target | |
USING (VALUES | |
(1, 'Beth Massi', 'F', 'Burg 1', '8000', 'Brugge', 'Belgium', 1.00), | |
(2, 'Chris Rummel', 'M', 'Burg 1', '8000', 'Brugge', 'Belgium', 0.90 ), | |
(3, 'Matt Evans', 'M', 'Burg 1', '8000', 'Brugge', 'Belgium', 0.80 ), | |
(4, 'Andy Kung', 'M', 'Burg 1', '8000', 'Brugge', 'Belgium', 0.70 ), | |
(5, 'Brian Moore', 'M', 'Burg 1', '8000', 'Brugge', 'Belgium', 0.60 ), | |
(6, 'Matt Sampson', 'F', 'Burg 1', '8000', 'Brugge', 'Belgium', 0.50 ), |
NewerOlder