Example #1
0
 private void openFileName(string str)
 {
     if (str != null)
     {
         plotTemplate_ = JsonConvert.DeserializeObject <PlotDataTemplate>(File.ReadAllText(str));
         // Display the file contents by using a foreach loop.
         WelcomeText.Text = JsonConvert.SerializeObject(plotTemplate_, Formatting.Indented);
     }
 }
Example #2
0
 void MessageReceived(object sender, EventArgs e)
 {
     if (sender is PointsConfigWindow configWin && e is ConfigMessageEventArgs plotTemplateArgs)
     {
         // change the plot Data Template as per the window message
         this.plotTemplate_ = plotTemplateArgs.dataTemplate;
         //todo use notifypropertychanged with a vm to notify the background and text colors
         NotifyPropertyChanged("PlotBackgroundColor");
         AddLinesToConsole("Plot Config changes saved...");
     }
Example #3
0
        private async void OpenFileName(string str)
        {
            if (str != null)
            {
                AddLinesToConsole(str);
                plotTemplate_ = JsonConvert.DeserializeObject <PlotDataTemplate>(File.ReadAllText(str));
                // Display the file contents by using a foreach loop.
                AddLinesToConsole(JsonConvert.SerializeObject(plotTemplate_, Formatting.Indented));
                await FetchAndPlotData();

                ResetAxes();
            }
        }
Example #4
0
 public MeasurementsVM()
 {
     plotTemplate_             = new PlotDataTemplate();
     plotTemplate_.dataSetName = "Plot Title";
     plotTemplate_.dataRate    = 25;
     plotTemplate_.measIds     = new List <int> {
         1, 2, 3
     };
     plotTemplate_.measurementNames = new List <string> {
         "One", "Two", "Three"
     };
     PlotTemplate = plotTemplate_;
 }
Example #5
0
        public MainWindow()
        {
            InitializeComponent();
            String str = (String)((App)Application.Current).Properties["FilePathArgName"];

            openFileName(str);

            _configManager = new ConfigurationManager();
            _configManager.Initialize();
            _historyAdapter = new HistoryDataAdapter();
            _historyAdapter.Initialize(_configManager);
            SeriesCollection = new SeriesCollection();
            timeStamps_      = new List <DateTime>();
            plotTemplate_    = new PlotDataTemplate();
            //Labels = new string[0];
            Step       = 1;
            YFormatter = value => String.Format("{0:0.###}", value);
            XFormatter = delegate(double val)
            {
                if (timeStamps_.Count > 0)
                {
                    DateTime startTimeStamp = timeStamps_.ElementAt(0);
                    DateTime timeStamp;
                    timeStamp = startTimeStamp.AddSeconds(val / (double)plotTemplate_.dataRate);
                    return(timeStamp.ToString("HH:mm:ss.fff"));

                    /*
                     * if (val == 0 || val == (double)(timeStamps_.Count - 1))
                     * {
                     *  timeStamp = timeStamps_.ElementAt((int)val);
                     *  return timeStamp.ToString("dd-MM-yyyy HH:mm:ss.fff");
                     * }
                     * else
                     * {
                     *  timeStamp = startTimeStamp.AddSeconds(val / (double)plotTemplate_.dataRate);
                     *  if (timeStamp.Hour == 0 && timeStamp.Minute == 0 && timeStamp.Second == 0 && timeStamp.Millisecond == 0)
                     *  {
                     *      return timeStamp.ToString("dd-MM-yyyy");
                     *  }
                     *  return timeStamp.ToString("HH:mm:ss.fff");
                     * }
                     */
                }
                return(val.ToString());
            };
            MyChart.LegendLocation = LegendLocation.Top;
            DataContext            = this;
        }
Example #6
0
        public GearedPlotWindow()
        {
            InitializeComponent();
            AddLinesToConsole("Welcome User!");
            plotTemplate_    = new PlotDataTemplate();
            AutoFetchConfig_ = new AutoFetchConfig();
            _configManager   = new ConfigurationManager();
            _configManager.Initialize();
            _historyAdapter = new HistoryDataAdapter();
            _historyAdapter.Initialize(_configManager);

            String str = (String)((App)Application.Current).Properties["FilePathArgName"];

            OpenFileName(str);
            SeriesCollection = new SeriesCollection();
            timeStamps_      = new List <DateTime> {
                DateTime.Now
            };
            //Labels = new string[0];
            Step       = 1;
            YFormatter = value => String.Format("{0:0.###}", value);
            XFormatter = delegate(double val)
            {
                if (timeStamps_.Count > 0)
                {
                    DateTime startTimeStamp = timeStamps_.ElementAt(0);
                    DateTime timeStamp;
                    timeStamp = startTimeStamp.AddSeconds(val / 25.0);
                    return(timeStamp.ToString("HH:mm:ss.fff\ndd-MMM-yy"));
                }
                return(val.ToString());
            };
            MyChart.LegendLocation = LegendLocation.Top;
            DataContext            = this;
            FetchTimer_            = new DispatcherTimer();
            UpdateFetcherInterval();
            FetchTimer_.Tick += Fetch_Timer_Tick;
        }
Example #7
0
 public ConfigMessageEventArgs(PlotDataTemplate dataTemplate)
 {
     this.dataTemplate = dataTemplate;
 }
Example #8
0
 public void setDataTemplate(PlotDataTemplate template)
 {
     measurementsVM.PlotTemplate = template;
 }