Skip to content

Instantly share code, notes, and snippets.

var mes = new TObs()
{
messageid = Guid.NewGuid().ToString(),
source = this.SourceName,
status = "OK",
};
var options = MessagePack.MessagePackSerializerOptions.Standard.WithResolver(MessagePack.Resolvers.StandardResolverAllowPrivate.Instance);
var jsonString = MessagePack.MessagePackSerializer.ConvertToJson(MessagePack.MessagePackSerializer.Serialize<TObs>(mes, options));
@hatsunea
hatsunea / MainActivity.cs
Created August 15, 2016 02:46
Xamarin.Forms (Android) でスリープ状態にさせないためには
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
// スクリーンオフやロックスクリーン回避
Window.AddFlags(Android.Views.WindowManagerFlags.KeepScreenOn |
@hatsunea
hatsunea / GetAzureDataMarketToken.cs
Created December 12, 2016 14:33
Azure API認証
/// <summary>
/// OAuth認証を実行する
/// </summary>
/// <returns></returns>
private async Task<string> GetAzureDataMarketToken()
{
var properties = new Dictionary<string, string>
{
{ "grant_type", "client_credentials" },
{ "client_id", _clientId},
<Style x:Key="NavRadioButtonStyle" TargetType="RadioButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
NetworkInformation.NetworkStatusChanged += async (object sender) =>
{
this.Context.Post(async (o) =>
{
this.IsWCFEnable = await CheckWCFEnable();
},
null);
};
NetworkChange.NetworkAddressChanged += (object sender, EventArgs e) =>
{
this.Context.Post(async (o) =>
{
this.IsEnable = await CheckEnable();
},
null);
};
#include <SoftwareSerial.h>
SoftwareSerial ESP8266_Serial(2, 3);
Servo CameraServo;
Servo WaterServo;
long LastTime = 0;
boolean WROOM_boot = false;//WROOMが起動したかどうかの判定
boolean WiFi_setup = false;//WIFIセットアップが済んだかどうかの判定
using System;
using System.IO.Ports;
using Microsoft.SPOT.Hardware;
namespace Gr.NETMF.Hardware.Peach
{
internal class GR_PEACHHardwareProvider : HardwareProvider
{
static GR_PEACHHardwareProvider()
{
@hatsunea
hatsunea / LeapModel.cs
Last active August 29, 2015 14:22
LeapCamp
using Leap;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
namespace HandsOn.Models
{
public class TItem
{
@hatsunea
hatsunea / KinectModel.cs
Last active August 29, 2015 14:22
Kinect Camp
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using WindowsPreview.Kinect;
namespace HandsOn.Models
{
public class KinectModel : INotifyPropertyChanged