Skip to content

Instantly share code, notes, and snippets.

View elbruno's full-sized avatar
💭
@Home rocking some AI projects

El Bruno elbruno

💭
@Home rocking some AI projects
View GitHub Profile
@elbruno
elbruno / NetworkCommunication.cs
Created May 16, 2017 01:19
Lego EV3 Network communication Connect Async start lines
public async Task ConnectAsync()
{
_client = new TcpClient();
await _client.ConnectAsync(_address, 5555);
_stream = _client.GetStream();
// unlock the brick (doesn't actually need serial number?)
byte[] buff = Encoding.UTF8.GetBytes(UnlockCommand);
await _stream.WriteAsync(buff, 0, buff.Length);
private static DataRecognitionClient _dataClient;
static void Main()
{
var mode = SpeechRecognitionMode.LongDictation;
var language = "en-US";
var authenticationUri = "https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken";
var crisSubscriptionKey = Config.CrisSubscriptionKey;
var crisUri = Config.CrisUri;
@elbruno
elbruno / MRDesignLabButtonsDialogAndMenuExample.cs
Created August 2, 2017 02:58
20170801 Holo MRDesignLab Buttons DialogAndMenuExample.cs
protected override void OnTapped(GameObject obj, InteractionManager.InteractionEventArgs eventArgs)
{
base.OnTapped(obj, eventArgs);
if (launchedDialog)
return;
SimpleDialog.ButtonTypeEnum buttons = SimpleDialog.ButtonTypeEnum.Close;
string title = string.Empty;
string message = string.Empty;
@elbruno
elbruno / SurfaceDialMediaPlayerElement.cs
Created October 10, 2017 01:11
SurfaceDialMediaPlayerElement
readonly RadialController _controller;
public MediaPlayerPagePage()
{
InitializeComponent();
mpe.PosterSource = new BitmapImage(new Uri(DefaultPoster));
mpe.Source = MediaSource.CreateFromUri(new Uri(DefaultSource));
_controller = RadialController.CreateForCurrentView();
@elbruno
elbruno / SurfaceDialMapControlZoom.cs
Created October 11, 2017 20:27
SurfaceDialMapControlZoom
readonly RadialController _controller;
public MapPagePage()
{
locationService = new LocationService();
Center = new Geopoint(defaultPosition);
ZoomLevel = DefaultZoomLevel;
InitializeComponent();
_controller = RadialController.CreateForCurrentView();
@elbruno
elbruno / SurfaceDialMapRotate.cs
Created October 12, 2017 23:48
SurfaceDialMapRotate
enum ControllerMode { zoom, rotate };
ControllerMode _controllerMode;
readonly RadialController _controller;
public MapPagePage()
{
locationService = new LocationService();
Center = new Geopoint(defaultPosition);
ZoomLevel = DefaultZoomLevel;
InitializeComponent();
@elbruno
elbruno / SurfaceDialMenuItems.cs
Created October 17, 2017 00:42
SurfaceDialMenuItems
enum ControllerMode { Zoom, Rotate, Disable };
ControllerMode _controllerMode;
public MapPagePage()
{
_locationService = new LocationService();
Center = new Geopoint(_defaultPosition);
ZoomLevel = DefaultZoomLevel;
InitializeComponent();
@elbruno
elbruno / UwpPublishToStreamingDataSet.cs
Created October 19, 2017 01:44
UwpPublishToStreamingDataSet.cs
private async void ReportVisitorsAsync(string pushUrl, int totalVisitors, int totalVisitorsIdentified, string centerName)
{
var visitorsMeasurement = new
{
TotalVisitors = totalVisitors,
TotalRecognizedVisitors = totalVisitorsIdentified,
timeStamp = DateTime.Now,
CenterName = centerName
};
var jsonString = JsonConvert.SerializeObject(visitorsMeasurement);
@elbruno
elbruno / SurfaceDialMenuItemCustom.cs
Created October 23, 2017 21:57
SurfaceDialMenuItemCustom.cs
var controller = RadialController.CreateForCurrentView();
controller.RotationResolutionInDegrees = 0.2;
controller.UseAutomaticHapticFeedback = false;
var mapZoomItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno - Maps Zoom", "\xE128", "Segoe MDL2 Assets");
var mapRotationItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno - Map Rotation", "\xE128", "Segoe MDL2 Assets");
var disableDialItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno - Disable Dial", "\xE128", "Segoe MDL2 Assets");
controller.Menu.Items.Add(mapZoomItem);
controller.Menu.Items.Add(mapRotationItem);
controller.Menu.Items.Add(disableDialItem);
@elbruno
elbruno / SurfaceDialMenuDisable.cs
Created October 24, 2017 20:46
SurfaceDialMenuDisable.cs
using Windows.UI.Input;
using SurfaceDialApp01.Views;
namespace SurfaceDialApp01.Services
{
public static class SurfaceDialService
{
public static async void InitSurfaceDialMenu()
{
var surfaceDialConfiguration = RadialControllerConfiguration.GetForCurrentView();