Skip to content

Instantly share code, notes, and snippets.

View runceel's full-sized avatar

Kazuki Ota runceel

View GitHub Profile
using Microsoft.Practices.Prism.Mvvm;
using Reactive.Bindings;
using Reactive.Bindings.Extensions;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
namespace RxPropEdu
public static IObservable<PropertyPack<TElement, ReactiveProperty<TProperty>>> ObserveElementReactiveProperty<TCollection, TElement, TProperty>(this TCollection source, Expression<Func<TElement, ReactiveProperty<TProperty>>> propertySelector)
where TCollection : INotifyCollectionChanged, IEnumerable<TElement>
where TElement : class
{
if (source == null) throw new ArgumentNullException("source");
if (propertySelector == null) throw new ArgumentNullException("propertySelector");
var memberExpression = (MemberExpression)propertySelector.Body;
var propertyInfo = memberExpression.Member as PropertyInfo;
if (propertyInfo == null)
var person = new Person();
// これをTextBoxとバインドするケースでは
var rp = person.ObserveProperty(x => x.Name).ToReactiveProperty();
// こう書くべきという気もするかな
var rp = new ReactiveProperty<string>(person.Name);
ISensorManager *pSensorManager;
ISensorCollection *pGyrometerSensorCollection;
ISensor *pGyrometerSensor;
if (!SUCCEEDED(::CoCreateInstance(CLSID_SensorManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pSensorManager))))
{
return { -1, -1, -1 };
}
if (!SUCCEEDED(pSensorManager->GetSensorsByCategory(SENSOR_TYPE_GYROMETER_3D, &pGyrometerSensorCollection)))
{
extern "C"
{
struct PluginVector3
{
double x;
double y;
double z;
};
__declspec (dllexport) PluginVector3 GetAccelerometer();
http://compiledexperience.com/blog/posts/windows-10-title-bar/
http://blog.thomasnigro.fr/2015/02/11/exploring-w10-apis-windows-and-titlebar/
using System;
using System.Linq;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
var l = new[]
using Reactive.Bindings;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace WpfApplication11
{
public class MainWindowViewModel
{
private readonly ObservableCollection<Person> people = new ObservableCollection<Person>();
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ASPNETIdentityRole.Models
{
@runceel
runceel / gist:2427098
Created April 20, 2012 08:21
INotifyPropertyChanged Implementation
using System;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using System.ComponentModel;
using Microsoft.Practices.Unity.InterceptionExtension;
using System.Collections.Generic;