/// <summary> /// <para> /// Add symbol to subscription. /// </para> /// <para> /// A wildcard symbol "*" will replace all symbols: there will be an unsubscription from messages on all current symbols /// and a subscription to "*". The subscription type will be changed to STREAM /// If there is already a subscription to "*", then nothing will happen /// </para> /// </summary> /// <param name="symbol">Symbol.</param> /// <exception cref="ArgumentException">Invalid <paramref name="symbol"/> parameter.</exception> /// <exception cref="InvalidOperationException">You try to add more than one symbol to snapshot subscription.</exception> /// <exception cref="DxException">Internal error.</exception> public void AddSymbol(string symbol) { if (string.IsNullOrWhiteSpace(symbol)) { throw new ArgumentException("Invalid symbol parameter."); } if (eventType.HasFlag(EventType.Candle) && IsCandleSymbol(symbol)) { AddSymbol(CandleSymbol.ValueOf(symbol)); } C.CheckOk(C.Instance.dxf_add_symbol(subscriptionPtr, symbol)); }
void Awake() { if (type.HasFlag(EventType.FireOnce)) { Event.AddListener(() => this.enabled = false); } }
private static List <EventType> GetEventTypes(EventType eventTypes) { var result = new List <EventType>(); foreach (var type in Enum.GetValues(typeof(EventType))) { if (eventTypes.HasFlag((EventType)type)) { result.Add((EventType)type); } } return(result); }
static void OnLogEntryReceived(object sender, Client.LogEntry e) { if (_eventFilter.HasFlag(EventType.Log)) { lock (_syncRoot) { ConsoleColor wColor; if (!mColorMapping.TryGetValue(e.Severity, out wColor)) { wColor = ConsoleColor.White; } Console.ForegroundColor = wColor; Console.Write("{0} {1}-{2} [{3}] {4}: ", e.TimeStamp, e.ProcessName, e.ProcessId, e.Source, e.Severity); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(e.Text); } Log("{0} {1}-{2} [{3}] {4}: {5}", e.TimeStamp, e.ProcessName, e.ProcessId, e.Source, e.Severity, e.Text); } }
// It would be nice if these were unnecessary; we could just provide a list of events somehow // that each component cares about and the system would be smart enough to add/remove them itself. public void RegisterEvents(World w) { //Console.WriteLine("{0} registering events", this); if (HandledEvents.HasFlag(EventType.OnUpdate)) { w.OnUpdate += OnUpdate; } if (HandledEvents.HasFlag(EventType.OnKeyDown)) { w.OnKeyDown += OnKeyDown; } if (HandledEvents.HasFlag(EventType.OnKeyUp)) { w.OnKeyUp += OnKeyUp; } if (HandledEvents.HasFlag(EventType.OnDeath)) { w.OnDeath += OnDeath; } if (HandledEvents.HasFlag(EventType.OnCollision)) { Log.Assert(Owner != null); Log.Assert(Owner.Body != null); Owner.Body.Fixture.OnCollision += OnCollision; } if (HandledEvents.HasFlag(EventType.OnSeparation)) { Log.Assert(Owner != null); Log.Assert(Owner.Body != null); Owner.Body.Fixture.OnSeparation += OnSeparation; } }