protected void OnTimeEnter(TimedData source) { if (TimeEnter != null) { TimeEnter.Invoke(source); } }
protected void OnTimeExit(TimedData source) { if (TimeExit != null) { TimeExit.Invoke(source); } }
/// <summary> Method that copy and remove selected panel.</summary> public void CutSelecedPanel() { Label selectedSceneLable = _labels.Find(sl => sl.IsSelected); _copyData = new TimeLabelData(selectedSceneLable.SourceData as TimeLabelData); RemoveLabel(selectedSceneLable.SourceData); }
protected void OnSelected(TimedData source) { if (Selected != null) { Selected.Invoke(source); } }
void produceNextValue() { var nextVal = m_DataGenerator.GetNextValue(); var nextData = new TimedData(nextVal, DateTime.Now); Debug.WriteLine("Data produced. Timestamp={0}, Value={1}", nextData.Timestamp, nextData.Value); m_DataBus.Publish(nextData); }
private void notifyClients(TimedData data) { if (data == null) { throw new ArgumentNullException("data"); } m_HubContext.Clients.All.onNewData(mapToJsModel(data)); }
/// <summary> Create new timeline bookmark label. </summary> /// <param name="owner"> Owning timeline.></param> /// <param name="sourceData">Source data</param> /// <param name="timeLinePanel">TimeLinePanel.</param> public Label(Panel owner, TimeLinePanel timeLinePanel, TimedData sourceData) { _owner = owner; _timeLinePanel = timeLinePanel; _sourceData = sourceData; SetStartAndEnd(SourceData.Start, SourceData.End, SourceData.Duration); _redrawOrder = true; _borderThickness = _borderThicknessNormal; _timeLinePanel.TimeLineEngine.CurrentTimeChanged += TimeLineEngine_TimeChanged; }
private static object mapToJsModel(TimedData data) { if (data == null) { throw new ArgumentNullException("data"); } return(new { time = data.Timestamp.ToJsTimestamp(), val = data.Value }); }
public void Save(TimedData data) { if (data == null) { throw new ArgumentNullException("data"); } using (var connection = connect()) using (var cmd = connection.CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = SqlQueries.SAVE_DATA; cmd.Parameters.AddWithValue("@timestamp", data.Timestamp); cmd.Parameters.AddWithValue("@value", data.Value); cmd.ExecuteNonQuery(); } }
public ICollection <TimedData> LoadAll(DateTime @from, DateTime to) { using (var connection = connect()) using (var cmd = connection.CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = SqlQueries.LOAD_DATA; cmd.Parameters.AddWithValue("@to", to); cmd.Parameters.AddWithValue("@from", @from); using (var reader = cmd.ExecuteReader()) { Debug.Assert(reader != null); var result = new Collection <TimedData>(); while (reader.Read()) { var data = new TimedData( reader.GetInt32(reader.GetOrdinal("Value")), reader.GetDateTime(reader.GetOrdinal("Timestamp"))); result.Add(data); } return(result); } } }
public void TrFunc() { try{ d($"TrFunc started"); UdpClient udpClient = null; this.terminateReceivingThread = () => { d("*** terminateReceivingThread"); if (udpClient != null) { udpClient.Close(); udpClient = null; } Thread toTerminate = thread; thread = null; toTerminate.Join(); this.terminateReceivingThread = null; }; int c = 0; do { try { udpClient = new UdpClient(62731); } catch (Exception) { Thread.Sleep(100); d($"reconnecting to UDP : {++c}"); } } while (udpClient == null && thread == Thread.CurrentThread); d($"q connected to UDP : {c}"); if (udpClient == null || thread != Thread.CurrentThread) { if (null != terminateReceivingThread) { this.terminateReceivingThread(); } } IPEndPoint remoteIP = new IPEndPoint(IPAddress.Any, 0); IPEndPoint broadcastIP = new IPEndPoint(IPAddress.Broadcast, 62731); udpClient.Client.ReceiveTimeout = 100; //ms while (thread == Thread.CurrentThread) { Byte[] data = null; try { data = udpClient.Receive(ref remoteIP); } catch (SocketException se) { // probably timeout d($"SOCKET EXCEPTION : {se}"); } int t = TickCount; if (null != data) { var td = new TimedData(); td.data = data; td.time = t; lock (dataChannel.SyncRoot) { // cleanup if (dataChannel.Count >= 5) { dataChannel.Dequeue(); } if (dataChannel.Count >= 5) { dataChannel.Dequeue(); } dataChannel.Enqueue(td); } } if (fUiLastActive + 1000 < TickCount) { // need to terminate if got disconneected from UI thread events (i.e. plugin unloaded) d($"UI timeout"); if (null != terminateReceivingThread) { this.terminateReceivingThread(); } break; } } } catch (Exception e) { d($"EXCEPTION : {e}"); } }
/// <summary> Remove label with given sourceData.</summary> /// <param name="sourceData">Source data that is used by label to remove.</param> public void RemoveLabel(TimedData sourceData) { sourceData.MarkToDelete(); }
public void Store(K key, V value) { cachedData[key] = new TimedData { Data = value, Timestamp = Util.GetNow() }; }
public void Save(TimedData data) { m_Storage.Add(data); }
/// <summary> Method that copy selected panel.</summary> public void CopySelectedPanel() { Label selectedSceneLable = _labels.Find(sl => sl.IsSelected); _copyData = selectedSceneLable.SourceData; }
public void Set(TK key, TV value) { cachedData[key] = new TimedData { Data = value, Timestamp = Tools.Now }; }