Example #1
0
        /// <summary>
        /// Updates the graph and time display
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GlobalTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
                if (GlobalTimer.Instance.TimeRemaining == TimeSpan.Zero)
                {
                    TimeRemaining = "";
                }
                else
                {
                    TimeRemaining = $"Time Remaining: {GlobalTimer.Instance.TimeRemaining.ToString()}";
                }

                var dataArray = _currentProfile.GetGraphData();

                //Temperature data
                dataArray[3] = new Graph.GraphPointSet()
                {
                    Points = new ObservableCollection <TemperatureProfile.ObservablePoint>
                    {
                        new TemperatureProfile.ObservablePoint(_currentProfile.ProfileMinTime.TotalMinutes, Watlow.GlobalWatlow.LastTemperature),
                        new TemperatureProfile.ObservablePoint(GlobalTimer.Instance.TimeElapsed.TotalMinutes, Watlow.GlobalWatlow.LastTemperature),
                        new TemperatureProfile.ObservablePoint(GlobalTimer.Instance.TimeElapsed.TotalMinutes, _currentProfile.ProfileMinTemperature)
                    },
                    LineColor    = Brushes.Blue,
                    StrokeWeight = 2
                };

                //Title
                CurrentStepGraph.Title = _currentProfile.Name;

                //Update
                CurrentStepGraph.SetGraphData(dataArray);
            });
        }
Example #2
0
        //Updates the UI to reflect the current step
        private void GlobalScriptHandler_StepStarted(ScriptHandler.Step step)
        {
            Dispatcher.Invoke(() =>
            {
                RunScriptsButton.IsEnabled  = false;
                StopScriptsButton.IsEnabled = true;
                CurrentStepName             = $"Running {step}";
                PreviewGrid.Visibility      = Visibility.Collapsed;
                CurrentStepGraph.Visibility = Visibility.Visible;
            });

            switch (step)
            {
            case ScriptHandler.Step.TempCal:
                Dispatcher.Invoke(() =>
                {
                    _currentProfile = TP.GetProfile(Properties.Settings.Default.TempCalProfileURI);

                    _currentProfile.Name = "TempCal";

                    CurrentStepGraph.Title = _currentProfile.Name;
                    CurrentStepGraph.SetGraphData(_currentProfile.GetGraphData());
                });
                break;

            case ScriptHandler.Step.LampComp:
                Dispatcher.Invoke(() =>
                {
                    _currentProfile = TP.GetProfile(Properties.Settings.Default.LampCompProfileURI);

                    _currentProfile.Name = "Lamp Comp";

                    CurrentStepGraph.Title = _currentProfile.Name;
                    CurrentStepGraph.SetGraphData(_currentProfile.GetGraphData());
                });
                break;

            case ScriptHandler.Step.TempComp:
                Dispatcher.Invoke(() =>
                {
                    _currentProfile = TP.GetProfile(Properties.Settings.Default.TempCompProfileURI);

                    _currentProfile.Name = "Temp Comp";

                    CurrentStepGraph.Title = _currentProfile.Name;
                    CurrentStepGraph.SetGraphData(_currentProfile.GetGraphData());
                });
                break;

            case ScriptHandler.Step.TempCheck:
                Dispatcher.Invoke(() =>
                {
                    _currentProfile = TP.GetProfile(Properties.Settings.Default.TempCheckProfileURI);

                    _currentProfile.Name = "Temp Check";

                    CurrentStepGraph.Title = _currentProfile.Name;
                    CurrentStepGraph.SetGraphData(_currentProfile.GetGraphData());
                });
                break;

            case ScriptHandler.Step.DriftCheck:
                Dispatcher.Invoke(() =>
                {
                    _currentProfile = TP.GetProfile(Properties.Settings.Default.DriftCheckProfileURI);

                    _currentProfile.Name = "Drift Check";

                    CurrentStepGraph.Title = _currentProfile.Name;
                    CurrentStepGraph.SetGraphData(_currentProfile.GetGraphData());
                });
                break;

            case ScriptHandler.Step.Custom:
                Dispatcher.Invoke(() =>
                {
                    _currentProfile = TP.GetProfile(Properties.Settings.Default.CustomProfileURI);

                    _currentProfile.Name = "Custom";

                    CurrentStepGraph.Title = _currentProfile.Name;
                    CurrentStepGraph.SetGraphData(_currentProfile.GetGraphData());
                });
                break;
            }
        }