Skip to content

Instantly share code, notes, and snippets.

@incoplex
incoplex / LoadOnDemandExtensions.cs
Created January 19, 2020 05:42 — forked from janvanderhaegen/LoadOnDemandExtensions.cs
Loading of collections in the desktop client on a 'need to see' basis.
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;
@incoplex
incoplex / ShortGuid.cs
Created December 14, 2019 01:55 — forked from 06b/ShortGuid.cs
ShortGuid - A shorter and url friendly GUID class in C#
using System;
namespace CSharpVitamins
{
/// <summary>
/// Represents a globally unique identifier (GUID) with a
/// shorter string value. Sguid
/// </summary>
public struct ShortGuid
{
@incoplex
incoplex / export-named-sheet-as-csv.gs
Created November 26, 2019 04:09 — forked from mrkrndvs/export-named-sheet-as-csv.gs
Google apps script to export an individual sheet as csv file
/*
* script to export data of the named sheet as an individual csv files
* sheet downloaded to Google Drive and then downloaded as a CSV file
* file named according to the name of the sheet
* original author: Michael Derazon (https://gist.github.com/mderazon/9655893)
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "Download Primary Time File", functionName: "saveAsCSV"}];
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".cs" encoding="UTF8" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Xml.Linq" #>
<#
//
@incoplex
incoplex / MyCommand.cs
Created September 14, 2019 03:56 — forked from sschutten/MyCommand.cs
Implement IShellCommand
public class MyCommand : IShellCommand
{
    public string Description
    {
        get { return "This is My Command"; }
    }
 
    public string DisplayName
    {
        get { return "My Command"; }
@incoplex
incoplex / MyGroupProvider.cs
Created September 14, 2019 03:56 — forked from sschutten/MyGroupProvider.cs
Implement IShellCommandGroupProvider
[Export(typeof(IShellCommandGroupProvider))]
public class MyGroupProvider : IShellCommandGroupProvider
{
    public IEnumerable<IShellCommandGroup> GetShellCommandGroups(Microsoft.LightSwitch.Client.IScreenObject currentScreen)
    {
        yield return new MyGroup();
    }
}
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Microsoft.LightSwitch.Framework.Client;
using LightSwitch = Microsoft.LightSwitch.Model.Storage;
using Microsoft.LightSwitch.Model;
using System.Runtime.InteropServices.Automation;
namespace ODataFinderLibrary
@incoplex
incoplex / lightswitchPortFindingHack.cs
Created September 14, 2019 03:50 — forked from namman/lightswitchPortFindingHack.cs
Lightswitch port finding hack
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Management;
using System.Linq;
using System.Text.RegularExpressions;
namespace YourApp
{
@incoplex
incoplex / oncollectionchange
Created September 14, 2019 03:48 — forked from iamrommel/oncollectionchange
On collection changed, trap the added item and put some logic and set value for it
partial void Plants_Changed(NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
var addedItem = e.NewItems[0] as HaulerPlant;
if (addedItem == null) return;
addedItem.IsActive = true;
}
@incoplex
incoplex / Keyboard Shortcut
Created September 14, 2019 03:48 — forked from iamrommel/Keyboard Shortcut
Creating a keyboard shortcuts for Lightswitch application
partial void Tickets_Created()
{
this.FindControl("ScreenLayout").ControlAvailable += Tickets_ControlAvailable;
}
void Tickets_ControlAvailable(object sender, Microsoft.LightSwitch.Presentation.ControlAvailableEventArgs e)
{
var screenLayout = e.Control as System.Windows.Controls.Grid;
if (screenLayout == null) return;