Exemplo n.º 1
0
 public void ReceiveNewData(DataDotObject data)
 {
     if (StaticValues.graphViewModel.StreamingPlay)
     {
         StaticValues.dotList.Add(data);
         StaticValues.graphViewModel.AddNewDot(data.Value, data.Value);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// To be able to add a new row of data to the SQLite database, not connected to any entries for
 /// in parameters at the moment.
 /// </summary>
 /// <param name="theDate"></param>
 /// <param name="theTime"></param>
 /// <param name="theValue"></param>
 /// <param name="theResult"></param>
 /// <summary>
 public void AddNewSentracSQLiteData(DataDotObject dot)
 {
     this.SentracData.
     Add(new SentracSQLiteData
     {
         Date   = dot.Date,
         Time   = dot.Time,
         Value  = dot.Value,
         Result = dot.Result
     });
 }
Exemplo n.º 3
0
        /// <summary>
        /// Converts a list of strings into DataDotObjects
        /// </summary>
        /// <param name="stringList"></param>
        /// <returns></returns>
        public List <DataDotObject> TranslateListIntoDots(List <String> stringList)
        {
            List <DataDotObject> tempList = new List <DataDotObject>();

            foreach (string s in stringList)
            {
                DataDotObject tempObj = TranslateIntoOneDot(s);

                if (tempObj != null)
                {
                    tempList.Add(TranslateIntoOneDot(s));
                }
            }

            return(tempList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a DataDotObject from string read from sentrac
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public DataDotObject TranslateIntoOneDot(string s)
        {
            string sep = "\t";                                  // split between the tabs

            string[] splitContent = s.Split(sep.ToCharArray()); // string parts

            DateTime date = new DateTime().Date;
            TimeSpan time = new DateTime().TimeOfDay;

            double value        = -1.0; // -1.0 to check if later
            string resultString = "";   // maybe better name on this?

            if (DateTime.TryParse(splitContent[0], out DateTime dateValue))
            {
                date = dateValue.Date;
            }

            if (TimeSpan.TryParse(splitContent[1], out TimeSpan timeValue))
            {
                time = timeValue;
            }

            bool result = Double.TryParse(splitContent[2], out double val);

            if (result)
            {
                value = val;
            }

            try
            {
                resultString = splitContent[3];
            }
            catch (IndexOutOfRangeException e)
            {
                Debug.WriteLine(e.Message);
            }

            if (date != null && time != null && value != -1.0 && resultString != null)
            {
                DataDotObject newDot = new DataDotObject(date, time, value, resultString);
                return(newDot);
            }
            return(null);
        }