Hi all, I will really appreciate your help in any way. I am working on a project and I will try to explain it then ask my question.

1) I have to read some data through the serial port into a text/csv file, and will be updated more often.

2) I need to write some code that will be getting those data from the file and plot a graph (real time graph) using the data everytime the data is updated.

Now I am true with writing into the file, I can get the data into the file. And when I was seeking for help on the real time graph I came across WPF (windows presentation foundation) and fortunately I got a sample code which I made use of, and after doing the necessary editing, the code looks like this:


Code:
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows;
using Microsoft.Research.DynamicDataDisplay;
using Microsoft.Research.DynamicDataDisplay.DataSources;
using System.Collections;
using System.IO.Ports;


namespace Lekasteel
{
  
  /// <summary>
  /// Interaction logic for Window1.xaml
  /// </summary>
  public partial class Window1 : Window
  {
    // Three observable data sources. Observable data source contains
    // inside ObservableCollection. Modification of collection instantly modify
    // visual representation of graph. 
    ObservableDataSource<Point> source1 = null;
    ObservableDataSource<Point> source2 = null;
    //ObservableDataSource<Point> source3 = null;
    //ObservableDataSource<Point> source4 = null;

    public Window1()
    {
      InitializeComponent();
    }

    private void Lekasteel()
    {
      CultureInfo culture = CultureInfo.InvariantCulture;
      Assembly executingAssembly = Assembly.GetExecutingAssembly();
      // load spim-generated data from embedded resource file      
      const string spimDataName = "Lekasteel.lekasteel.csv";
      //const string spimDataName = "Lekasteel.lekas.txt";
      using (Stream spimStream = executingAssembly.GetManifestResourceStream(spimDataName))
      {
        using (StreamReader r = new StreamReader(spimStream))
        {
          string line = r.ReadLine();
          while (!r.EndOfStream)
          {
            line = r.ReadLine();
            string[] values = line.Split(',');

            double x = Double.Parse(values[0], culture);
            double y1 = Double.Parse(values[1], culture);
            double y2 = Double.Parse(values[2], culture);
            //double y3 = Double.Parse(values[3], culture);
            //double y4 = Double.Parse(values[4], culture);

            Point p1 = new Point(x, y1);
            Point p2 = new Point(x, y2);
            //Point p3 = new Point(x, y3);
            //Point p4 = new Point(x, y4);

            source1.AppendAsync(Dispatcher, p1);
            source2.AppendAsync(Dispatcher, p2);
            //source3.AppendAsync(Dispatcher, p3);
            //source4.AppendAsync(Dispatcher, p4);

            Thread.Sleep(1); // Long-long time for computations...
          }
        }
      }
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
      // Create first source
      source1 = new ObservableDataSource<Point>();
      // Set identity mapping of point in collection to point on plot
      source1.SetXYMapping(p => p);

      // Create second source
      source2 = new ObservableDataSource<Point>();
      // Set identity mapping of point in collection to point on plot
      source2.SetXYMapping(p => p);

      // Create third source
      //source3 = new ObservableDataSource<Point>();
      // Set identity mapping of point in collection to point on plot
      //source3.SetXYMapping(p => p);

      /*// Create fourth source
      source4 = new ObservableDataSource<Point>();
      // Set identity mapping of point in collection to point on plot
      source4.SetXYMapping(p => p);*/

      // Add all three graphs. Colors are not specified and chosen random
      plotter.AddLineGraph(source1, 2, "Power(kW)");
      plotter.AddLineGraph(source2, 2, "Torque(Nm)");
      //plotter.AddLineGraph(source3, 2, "Ap3");
      //plotter.AddLineGraph(source4, 2, "Data row 3");


      // Start computation process in second thread
      Thread simThread = new Thread(new ThreadStart(Lekasteel));
      simThread.IsBackground = true;
      simThread.Start();
    }     
  }
}
The above code works fine (getting the data and plotting the graph).

But now my problem is that I will like to get this as an executable file which can work outside the visual Csharp environment that am using. Though I get the stand-alone application in the Bin\Debug directory, but anytime the file is updated and I try to run this application then it does not work with the update but still get to display the graphical analysis for the old data. When I go back to compile the code then I get an information that says "the file has been updated outside the source, and ask to confirm the update or not before it compiles again".

Please this is my first experience with WPF and Csharp, and I will sincerely appreciate your help.