Example #1
0
        private void GetDataFromCollector()
        {
            var telemetries = _collector.Collect();

            foreach (var item in telemetries)
            {
                if (item.Kind == "Pressure")
                {
                    // Write the telemetry + date time to pressure file when pressure > 30 psi
                    if (int.Parse(item.Value.Split(' ')[0]) > 30)
                    {
                        using (StreamWriter writer = new StreamWriter("pressures.txt", true))
                        {
                            writer.Write($"[{DateTime.Now}] {item.Value}");
                        }
                    }
                }
                else if (item.Kind == "Temperature")
                {
                    // temparature should be converted to Degree when in fahrenheit
                    var valueInDegree = int.Parse(item.Value.Split(' ')[0]) - 32 * 5 / 9;
                    // Write the temparature + date time to temparature file
                    using (StreamWriter writer = new StreamWriter("temparatures.txt", true))
                    {
                        writer.Write($"[{DateTime.Now}] {valueInDegree} °C");
                    }
                }
                else
                {
                    // Raise error event to be consumed by consumers of TelemetryClient
                    ErrorDetected?.Invoke(this, new ErrorEventArgs(item.Value));
                }
            }
        }
Example #2
0
        /// <summary>
        /// Cette fonction va nous permettre de préparer l'affichage de la main et vérifier que le fichier indiqué existe.
        /// </summary>
        /// <param name="fileName"> Le nom du fichier à lire. </param>
        public void InitVizualisation(string fileName)
        {
            try
            {
                string filePath = string.Format("{0}/{1}.txt", _assetPath, fileName);
                using (StreamReader reader = new StreamReader(filePath))
                {
                    _fileContent = reader.ReadToEnd();
                }

                List <string> lines = _fileContent.Split('\n').ToList();
                _nbHandJoint = lines.Where(l => l.Contains("START")).Count();
            }
            // Cette erreur arrive lorsque le nom du fichier fileName n'existe pas.
            catch (Exception ex)
            {
                Debug.LogError(ex.Message);
                ErrorDetected?.Invoke(this, null);
            }
        }
Example #3
0
 /// <summary>
 /// Triggers <see cref="ErrorDetected"/> event with given exception.
 /// </summary>
 /// <param name="error"></param>
 public void TriggerError(LocateableException error)
 {
     ErrorDetected?.Invoke(this, error);
 }
Example #4
0
 /// <summary>
 /// Caller method for the ErrorDetected event.
 /// </summary>
 protected virtual void OnErrorDetected()
 {
     ErrorDetected?.Invoke(this, EventArgs.Empty);
 }
Example #5
0
        public void NotifyErrorDetected(Models.ScrapingRule scraper, Models.ScrapingResult result)
        {
            Instance.ShowInformation($"{scraper.Name} is failed.");

            ErrorDetected?.Invoke(this, new DetectedEventArgs(scraper, result));
        }
Example #6
0
 internal void onErrorDetected(ErrorDetectedEventArgs args)
 {
     ErrorDetected?.Invoke(PenClient, args);
 }