Exemplo n.º 1
0
        private void AutosaveTimer_Tick(object sender, EventArgs e)
        {
            AutosaveTimer.Stop();
            if (CurrentProject.file.Length > 0)
            {
                CurrentProject.Save();
            }

            AutosaveTimer.Start();
        }
Exemplo n.º 2
0
 private static void AutosaveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     AutosaveTimer.Interval = Settings.ExportSettings.AutosaveInterval * 1000;
     if (!Stm32Ads1220.AcquisitionInProgress)
     {
         AutosaveTimer.Stop();
     }
     if (AdcChannels.Values.Count > 0)
     {
         new Thread(() => { CsvExporter.AutoSave(AdcChannels.Values); }).Start();
     }
 }
Exemplo n.º 3
0
 private static void Stm32Ads1220_AcquisitionDataReceived(object sender, AcquisitionEventArgs e)
 {
     Trace("App DataReceived");
     if (!AdcChannels.ContainsKey(e.Channel))
     {
         bool added = AdcChannels.TryAdd(
             e.Channel,
             new AdcChannel(e.Channel,
                            (int)Math.Ceiling(Settings.Default.AcquisitionDuration * Settings.Default.AcquisitionSpeed),
                            Settings.Default.Average, Settings.Default.AcquisitionSpeed
                            )
             );
         if (added)
         {
             AdcChannels[e.Channel].DropPoints = Settings.Default.AcqDropPoints;
             AdcChannels[e.Channel].CalculatedXColumnSelector = x => CsvExporter.OADateToSeconds(x);
             if (ChannelEnable.ContainsKey(e.Channel))
             {
                 AdcChannels[e.Channel].IsVisible = ChannelEnable[e.Channel];
             }
             if (ChannelNames.ContainsKey(e.Channel))
             {
                 AdcChannels[e.Channel].Name = ChannelNames[e.Channel];
             }
             if (ColorSet.ContainsKey(e.Channel))
             {
                 AdcChannels[e.Channel].Color = ColorSet[e.Channel];
             }
             if (ChannelMathY.ContainsKey(e.Channel))
             {
                 AdcChannels[e.Channel].MathExpressionY = ChannelMathY[e.Channel];
             }
             new Thread(() =>
             {
                 NewChannelDetected?.Invoke(Stm32Ads1220, new NewChannelDetectedEventArgs(e.Channel));
             }).Start();
         }
         else
         {
             Logger.Error(Default.msgAdcChannelConcurrency);
             return;
         }
     }
     AdcChannels[e.Channel].AddPoint(e.Value);
     if (!AutosaveTimer.Enabled)
     {
         AutosaveTimer.Start();
     }
 }
        private void AutosaveTimer_Tick(object sender, EventArgs e)
        {
            AutosaveTimer.Stop();
            if (string.IsNullOrEmpty(CurrentProject.file))
            {
                var old = CurrentProject.file;
                CurrentProject.file = Path.Combine(AppConfig.ExeDirectory, "autosave.npcproj");
                CurrentProject.Save();
                CurrentProject.file = old;
            }
            else
            {
                CurrentProject.Save();
            }

            AutosaveTimer.Start();
        }