Exemplo n.º 1
0
 protected void OnTimeEnter(TimedData source)
 {
     if (TimeEnter != null)
     {
         TimeEnter.Invoke(source);
     }
 }
Exemplo n.º 2
0
 protected void OnTimeExit(TimedData source)
 {
     if (TimeExit != null)
     {
         TimeExit.Invoke(source);
     }
 }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 7
0
        /// <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
     });
 }
Exemplo n.º 9
0
        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();
                }
        }
Exemplo n.º 10
0
 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}");
            }
        }
Exemplo n.º 12
0
 /// <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();
 }
Exemplo n.º 13
0
 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);
 }
Exemplo n.º 15
0
        /// <summary> Method that copy selected panel.</summary>
        public void CopySelectedPanel()
        {
            Label selectedSceneLable = _labels.Find(sl => sl.IsSelected);

            _copyData = selectedSceneLable.SourceData;
        }
Exemplo n.º 16
0
 public void Set(TK key, TV value)
 {
     cachedData[key] = new TimedData {
         Data = value, Timestamp = Tools.Now
     };
 }