Beispiel #1
0
        public IDictionary <string, string[]> GetLoggingSummaryColumsContents(SuperDevice device, DeviceDataFrom deviceDatafrom)
        {
            IDictionary <string, string[]> result = new Dictionary <string, string[]>();

            string[] column1Contents = new string[5];
            string[] column2Contents = new string[5];

            result.Add("column1Contents", column1Contents);
            result.Add("column2Contents", column2Contents);

            column1Contents[0] = string.Format("Highest Temperature: {0}", Common.SetTempTimeFormat(device.HighestC));
            column1Contents[1] = string.Format("Lowest Temperature: {0}", Common.SetTempTimeFormat(device.LowestC));
            column1Contents[2] = string.Format("Average Temperature: {0}{1}", device.AverageC, string.IsNullOrEmpty(device.AverageC) ? string.Empty : "°" + device.TempUnit);
            column1Contents[3] = string.Format("Mean Kinetic Temperature: {0}{1}", device.MKT, string.IsNullOrEmpty(device.MKT) ? string.Empty : "°" + device.TempUnit);
            string finalString      = string.Empty;
            int    maxDisplayLength = 10;
            string loggerReader     = device.LoggerRead;

            if (loggerReader == null)
            {
                loggerReader = string.Empty;
            }
            string[] loggerReadereString = loggerReader.Split(new char[] { '@' });
            if (loggerReadereString.Length >= 2)
            {
                if (Common.Versions == SoftwareVersions.S || string.IsNullOrWhiteSpace(loggerReadereString[0]))
                {
                    finalString = string.Format("Logger Read: @{0}", TempsenFormatHelper.GetFormattedDateTime(Convert.ToDateTime(loggerReadereString[1])));
                }
                else if (Common.Versions == SoftwareVersions.Pro)
                {
                    if (loggerReadereString[0].Length > maxDisplayLength)
                    {
                        finalString = string.Format("Logger Read: By {0}@{1}", loggerReadereString[0].Substring(0, maxDisplayLength) + "...", TempsenFormatHelper.GetFormattedDateTime(Convert.ToDateTime(loggerReadereString[1])));
                    }
                    else
                    {
                        finalString = string.Format("Logger Read: By {0}@{1}", loggerReadereString[0], TempsenFormatHelper.GetFormattedDateTime(Convert.ToDateTime(loggerReadereString[1])));
                    }
                }
            }
            else
            {
                finalString = "Logger Read:";
            }

            column1Contents[4] = finalString;

            column2Contents[0] = string.Format("Start Time/First Point: {0}", device.LoggingStart == DateTime.MinValue ? string.Empty : TempsenFormatHelper.GetFormattedDateTime(device.LoggingStart.ToLocalTime()));
            column2Contents[1] = string.Format("Stop Time: {0}", device.LoggingEnd == DateTime.MinValue ? string.Empty : TempsenFormatHelper.GetFormattedDateTime(device.LoggingEnd.ToLocalTime()));
            column2Contents[2] = string.Format("Data Points: {0}", device.DataPoints == 0 ? string.Empty : device.DataPoints.ToString());
            column2Contents[3] = string.Format("Trip Length: {0}", device.TripLength);
            column2Contents[4] = string.Empty;
            return(result);
        }