Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            for (int i = 0; i <= 7; i++)
            {
                for (int j = 0; j <= 7; j++)
                {
                    graphicalTemperatureIndications[j, i] = new GraphicalTemperatureIndication
                    {
                        rectangle = DrawRectangle(j, i)
                    };
                }
            }
            GeneratePalette();
            timer.Elapsed += ShowNextValue;
            timer.Enabled  = false;
            var appSettings = ConfigurationManager.AppSettings;

            valueSuffix = appSettings["ValueSuffix"];
        }
Example #2
0
 private void DisplayIndication(int indicationPosition)
 {
     if (temperatureIndications.Count - 1 >= indicationPosition)
     {
         TemperatureIndication selectedIndication = temperatureIndications[indicationPosition];
         lblTimestamp.Content = selectedIndication.DateTime.ToString();
         SolidColorBrush solidColorBrush = new SolidColorBrush
         {
             Color = colors[ConvertFromAnalogToRGBValue(selectedIndication.Value, minColorValue, maxColorValue, 0, 764)]
         };
         GraphicalTemperatureIndication displayElement = graphicalTemperatureIndications[selectedIndication.PosX, selectedIndication.PosY];
         displayElement.rectangle.Fill = solidColorBrush;
         mainCanvas.Children.Remove(displayElement.textBlock);
         displayElement.textBlock = Text(selectedIndication.PosX * 41 + 7, selectedIndication.PosY * 41 + 12, selectedIndication.Value.ToString() + valueSuffix, Color.FromRgb(0, 0, 0));
         if (shouldShowValues)
         {
             mainCanvas.Children.Add(displayElement.textBlock);
         }
     }
 }
Example #3
0
 private void ReinitializeDisplayElements()
 {
     foreach (GraphicalTemperatureIndication displayElement in graphicalTemperatureIndications)
     {
         mainCanvas.Children.Remove(displayElement.rectangle);
         mainCanvas.Children.Remove(displayElement.textBlock);
     }
     for (int i = 0; i <= 7; i++)
     {
         for (int j = 0; j <= 7; j++)
         {
             graphicalTemperatureIndications[j, i] = new GraphicalTemperatureIndication
             {
                 rectangle = DrawRectangle(j, i)
             };
         }
     }
     temperatureIndications.Clear();
     mainSlider.Value       = 0;
     mainSlider.Minimum     = 0;
     mainSlider.Maximum     = 0;
     timer.Enabled          = false;
     previousSliderPosition = 0;
 }