This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainViewModel : ReactiveObject | |
{ | |
public MainViewModel() | |
{ | |
LoadTweetsCommand = new ReactiveCommand(); | |
LoadTweetsCommand.RegisterAsync(_ => { | |
throw new Exception("AA"); | |
return LoadTweets(); | |
}).Subscribe(x => TheTweets = x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Reflection; | |
using System.ServiceModel; | |
using LinFu.DynamicProxy; | |
namespace UAV.Communication | |
{ | |
public static class CommunicationHelpers | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var host = CommunicationHelpers.CreateHost<UAVControl>(hostSuffix: args.Length > 0 ? args[0] : "")) { | |
host.Open(); | |
Console.WriteLine("Service is available. Press <ENTER> to exit."); | |
Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UAVAsyncControl Connect(string endpointPostfix = "") | |
{ | |
return new UAVAsyncControl(CommunicationHelpers.CreateClient(endpointPostfix)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public const int WaitOutRange = 367; | |
public const int SkipInRange = 368; | |
public const int SkipOutRange = 369; | |
public const int WaitHdgInRange = 370; | |
public const int WaitHdgOutRange = 371; | |
public const int SkipHdgInRange = 372; | |
public const int SkipHdgOutRange = 373; | |
public const int RotateRelativeWaypoint = 374; | |
private static readonly Dictionary<int, string> Translations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string Translate(int commandId) | |
{ | |
string ret; | |
if (Translations.TryGetValue(commandId, out ret)) | |
return ret; | |
return "unknown"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Начали писать серию статей по NemerleWeb, и там понадобился макрос, который сделал бы объявление типов более лаконичными. | |
На данный момент первый пример — это классический todo список. Для такого списка неплохо было бы создать тип: | |
public class Task | |
{ | |
public Name : string { get; set; } | |
public Priority : string { get; set; } | |
public IsDone : bool { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
public class ReactiveToDo | |
{ | |
[Dto] public class Task { Name : string; IsDone : bool; Priority : string; } | |
mutable _tasks = List.[Task](); | |
mutable _todoName = "New task"; | |
mutable _todoPriority = "high"; | |
public this() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new TestScheduler().With(sc => { | |
var client = Substitute.For<IQuadClient>(); | |
var packets = new Subject<IMavLinkPacket>(); | |
client.Packets.Returns(packets); | |
var quad = new Quad(client, MessageBus.Current); | |
packets.OnNext(new Mav.mavlink_heartbeat_t { base_mode = (byte)Mav.MAV_MODE_FLAG.SAFETY_ARMED }); | |
sc.AdvanceByMs(1); | |
quad.State = new LandState(); |