public void Stop() { if (!started) { return; } receiver.Stop(); receiver = null; started = false; }
public void Start() { if (receiver == null) { receiver = new Osc.OscReceiver(); } else { return; } receiver.DefaultOnMessageReceived += (sender, args) => { string address = args.Message.Address.ToString(); if (address.StartsWith("/internal")) { ParseInternal(args); } else { if (address.StartsWith("/root", StringComparison.CurrentCultureIgnoreCase)) { if (Global.CurrentProject.Running) { //Xamarin.Forms.Device.BeginInvokeOnMainThread(() => //{ object[] obj = ToObjectArray(args.Message.Arguments); Global.OscRoot.Deliver(new OscTree.Route(address, OscTree.Route.RouteType.ID), obj); //}); } } } }; try { receiver.Start(11234); started = true; } catch (Exception e) { Debug.WriteLine(e.Message); } }