Esempio n. 1
0
        private void SaveToFileTimerTick(object state)
        {
            if (CurrentFilePath == null)
            {
                CurrentFilePath = FolderFilePath + DateTime.Now.ToString("yyyMMdd_hhmmss") + ".txt";
            }

            IsDataPointList1Active = !IsDataPointList1Active;

            lock (DataPointsFileLockObject)
            {
                if (!IsDataPointList1Active)
                {
                    lock (GeneratedDataPointsList1)
                    {
                        if (GeneratedDataPointsList1.Count != 0)
                        {
                            File.AppendAllText(CurrentFilePath, String.Join(Environment.NewLine, GeneratedDataPointsList1) + Environment.NewLine);
                            GeneratedDataPointsList1.Clear();
                        }
                    }
                }
                else
                {
                    lock (GeneratedDataPointsList2)
                    {
                        if (GeneratedDataPointsList2.Count != 0)
                        {
                            File.AppendAllText(CurrentFilePath, String.Join(Environment.NewLine, GeneratedDataPointsList2) + Environment.NewLine);
                            GeneratedDataPointsList2.Clear();
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void UnloadDataFromAllLists()
 {
     if (App.Current != null)
     {
         App.Current.Dispatcher.Invoke((System.Action) delegate
         {
             LineDataPoints.Clear();
             GeneratedDataPointsList1.Clear();
             GeneratedDataPointsList2.Clear();
             NewDataPointsList1.Clear();
             NewDataPointsList2.Clear();
         });
     }
 }