I hereby claim:
- I am rkusa on github.
- I am rkusa (https://keybase.io/rkusa) on keybase.
- I have a public key whose fingerprint is CBC2 3F65 3DB7 B0CB 7298 BF32 01FE FDC2 E399 E2B7
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Install to ~/Library/Application Support/Zwoptex/Coordinates Formats/
require 'open-uri' | |
require 'zlib' | |
require 'yajl' | |
require 'net/http' | |
require 'json' | |
Net::HTTP.start('localhost', 5984, read_timeout: 3600) do |http| | |
24.times do |d| | |
24.times do |h| |
var statusChangedToReady = from sc in statusChanged | |
where sc.Status == GeoPositionStatus.Ready | |
select sc; | |
var positionChanged = from _ in statusChangedToReady | |
from pc in watcher.GetPositionChangedEventObservable() | |
where !pc.EventArgs.Position.Location.IsUnknown | |
select pc.EventArgs.Position; |
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(); |
public static class GeoPositionWatcherExtensions | |
{ | |
public static IObservable<IEvent<GeoPositionStatusChangedEventArgs>> GetStatusChangedEventObservable<T>(this IGeoPositionWatcher<T> watcher) | |
{ | |
return Observable.FromEvent<GeoPositionStatusChangedEventArgs>(ev => watcher.StatusChanged += ev, ev => watcher.StatusChanged -= ev); | |
} | |
public static IObservable<IEvent<GeoPositionChangedEventArgs<T>>> GetPositionChangedEventObservable<T>(this IGeoPositionWatcher<T> watcher) | |
{ | |
return Observable.FromEvent<GeoPositionChangedEventArgs<T>>(ev => watcher.PositionChanged += ev, ev => watcher.PositionChanged -= ev); |
var statusChanged = from sc in watcher.GetStatusChangedEventObservable() | |
select sc.EventArgs; | |
statusChanged.Subscribe(item => Deployment.Current.Dispatcher.BeginInvoke(() => { | |
// update your status textblock | |
TextBlock.Text = Enum.GetName(typeof(GeoPositionStatus), item.Status); | |
if (item.Status == GeoPositionStatus.Ready) | |
{ | |
// f.e. hide your loading bar |
positionChanged.Skip(1).Zip(positionChanged, (lhs, rhs) => new | |
{ | |
Position1 = rhs, | |
Position2 = lhs, | |
Distance = lhs.Location.GetDistanceTo(rhs.Location) | |
}).Subscribe(item => Deployment.Current.Dispatcher.BeginInvoke(() => | |
{ | |
// handle position ... f.e. add to a map's location collection | |
})); |
protected void Application_Start() | |
{ | |
IKernel kernel = new StandardKernel(new YourNinjectModule()); | |
DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); | |
// register global filters, routes, ... | |
} |