/* * updateSampleBlock * update the inforation in the given sample station in the Grid * */ private void updateSampleBlock(Grid aGrid, byte sampleNumber, SampleOvenManager.SampleData? sampleData) { Object timeObject = LogicalTreeHelper.FindLogicalNode(aGrid, "elapsedTimeValueText" + sampleNumber); if (timeObject is TextBlock) { TextBlock timeTextBlock = timeObject as TextBlock; if (sampleData.HasValue) { timeTextBlock.Text = String.Format("{0:N0}", (sampleData.Value.finalTime.Days * 24 * 60 + sampleData.Value.finalTime.Hours * 60 + sampleData.Value.finalTime.Minutes)); } else { timeTextBlock.Text = ""; } } Object tempObject = LogicalTreeHelper.FindLogicalNode(aGrid, "temperatureValueText" + sampleNumber); if (tempObject is TextBlock) { TextBlock elapsedTemperatureTextBlock = tempObject as TextBlock; if (sampleData.HasValue) { if (settings.TemperatureFormat == TemperatureFormatEnum.Farenheit) { elapsedTemperatureTextBlock.Text = System.Math.Round(sampleData.Value.finalTemp) + "°F"; } else { elapsedTemperatureTextBlock.Text = System.Math.Round(sampleData.Value.finalTemp) + "°C"; } } else { elapsedTemperatureTextBlock.Text = ""; } } }
/* * startRun * start a new sample run * */ private void startRun() { sampleLogger.Info("Run Started"); // Get a fresh copy of the application settings settings = DataObjects.SettingsManager.Instance.ApplicationSettings; // Shade unused stations colorDisabledStations(sampleGrid); // Get a new OvenManager try { ovenManager = new SampleOvenManager(settings); } catch (Exception e) { sampleLogger.Info("Run Ended - Error configuring device", e); logger.Error("Run Ended - Error configuring device", e); return; } // Add event handler for dispatch timer tick and start the timer dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Start(); // Change start/stop button to show stop startStopButton.Content = "Stop"; // Disable the config menu while running configMenuItem.IsEnabled = false; running = true; }