Skip to content

Instantly share code, notes, and snippets.

View robinmanuelthiel's full-sized avatar
✌️
Never grow up!

Robin-Manuel Thiel robinmanuelthiel

✌️
Never grow up!
View GitHub Profile
@robinmanuelthiel
robinmanuelthiel / EventHubService.cs
Created October 8, 2016 15:36
Connect to an Azure Event Hub manually
using DachauTemp.Windows.Models;
using Newtonsoft.Json;
using System;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core;
@robinmanuelthiel
robinmanuelthiel / ArduinoLcdKeypadControl.ino
Last active August 17, 2016 22:19
A simple Arduino Sketch to control the LCD Keypad Shield (SKU: DFR0009)
// Use LiquidCrystal library
#include <LiquidCrystal.h>
// Define button values
#define btnNONE 0
#define btnRIGHT 1
#define btnUP 2
#define btnDOWN 3
#define btnLEFT 4
<Application
x:Class="App1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
RequestedTheme="Light">
<Application.Resources>
<!-- The custom color for the new placeholder -->
<SolidColorBrush x:Key="MyCustomPlaceholderForegroundColor" Color="{StaticResource SystemBaseHighColor}"/>
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (!string.IsNullOrEmpty(e.Parameter as string))
{
// Check if all paramters for accessing the light are set
if (App.HomeMatic != null && App.SelectedLightId != 0)
{
var args = ((string)e.Parameter).Split('|');
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
string infos = string.Empty;
// Get voice data
if (args.Kind == ActivationKind.VoiceCommand)
{
var commandArgs = args as VoiceCommandActivatedEventArgs;
var speechRecognitionResult = commandArgs.Result;
Windows.ApplicationModel.VoiceCommands.VoiceCommnadDefinition.VoiceCommandSet commandSet;
if (Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstalledCommandSets.TryGetValue("CortanaCommands_en", out commandSet))
{
await commandSetEnUs.SetPhraseListAsync("room", new string[] {"Bathroom", "Kitchen", "Livingroom", "Bedroom"});
}
// Register Cortana voice commands
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///CortanaCommands.xml"));
await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(file);
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">
<CommandSet xml:lang="en" Name="CortanaCommands_en">
<CommandPrefix>Switch the light</CommandPrefix>
<Example>Switch the light in the bathroom on.</Example>
<Command Name="switchLight">
<Example>in the bathroom on</Example>
<ListenFor>in [the] {room} {status}</ListenFor>
<Feedback>{room}light will be switched {status}.</Feedback>
<Navigate />