public PulverizerOverview(int numOfSensors) { InitializeComponent(); for (int i = 0; i < numOfSensors; i++) { ComponentGrid.RowDefinitions.Add(new RowDefinition()); ComponentGrid.RowDefinitions[i].Height = new GridLength(400); } //Creation of our live graph from the user control LiveGraph l1 = new LiveGraph(); LiveGraph l2 = new LiveGraph(); // Current plan is to hard code a parameter that can allow for some diversity among the graphs LiveGraph l3 = new LiveGraph(); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); Task.Factory.StartNew(l2.Read); Task.Factory.StartNew(l3.Read); //Placing the graph on the screen in the viewable area ComponentGrid.Children.Add(l1); ComponentGrid.Children.Add(l2); ComponentGrid.Children.Add(l3); Grid.SetRow(l1, 0); Grid.SetRow(l2, 1); Grid.SetRow(l3, 2); }
private void LiveGraphs_Checked(object sender, RoutedEventArgs e) { if (!hasChild) { for (int i = 0; i < 2; i++) { viewableArea.RowDefinitions.Add(new RowDefinition()); viewableArea.ColumnDefinitions.Add(new ColumnDefinition()); viewableArea.RowDefinitions[i].Height = new GridLength(25, GridUnitType.Star); viewableArea.ColumnDefinitions[i].Width = new GridLength(25, GridUnitType.Star); } //Creation of our live graph from the user control LiveGraph l1 = new LiveGraph("SensorData_TurbineGetLastPhysicalVibrationValue", "Vibration (P)"); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); //Placing the graph on the screen in the viewable area viewableArea.Children.Add(l1); Grid.SetRow(l1, 0); Grid.SetColumn(l1, 0); } if (hasChild) { viewableArea.RowDefinitions.Clear(); viewableArea.ColumnDefinitions.Clear(); viewableArea.Children.Clear(); for (int i = 0; i < 2; i++) { viewableArea.RowDefinitions.Add(new RowDefinition()); viewableArea.ColumnDefinitions.Add(new ColumnDefinition()); viewableArea.RowDefinitions[i].Height = new GridLength(25, GridUnitType.Star); viewableArea.ColumnDefinitions[i].Width = new GridLength(25, GridUnitType.Star); } ///Creation of our live graph from the user control LiveGraph l1 = new LiveGraph("SensorData_TurbineGetLastPhysicalVibrationValue", "Gas (P)"); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); //Placing the graph on the screen in the viewable area viewableArea.Children.Add(l1); Grid.SetRow(l1, 0); Grid.SetColumn(l1, 0); } }
/* This function has a switch statement inside becuase it is the default value. If it was not implemented, the application * would crash on the first time a user selects one of the components to view the sensor overview.*/ private void LiveGraph_Checked(object sender, RoutedEventArgs e) { if (!hasChild) { LiveGraph liveGraph = new LiveGraph(LiveGraphProcedure, yLabel); //Creates the instance and passes in the procedure and axis label viewableArea.Children.Add(liveGraph); Task.Factory.StartNew(liveGraph.Read); //This starts the multi-threading Grid.SetRow(liveGraph, 1); } if (hasChild) { viewableArea.Children.Clear(); LiveGraph liveGraph = new LiveGraph(LiveGraphProcedure, yLabel); viewableArea.Children.Add(liveGraph); Task.Factory.StartNew(liveGraph.Read); Grid.SetRow(liveGraph, 1); } }
private void LiveGraphs_Checked(object sender, RoutedEventArgs e) { if (!hasChild) { for (int i = 0; i < 2; i++) //Creates the correct number of rows and columns for the number of sensors each component has. { viewableArea.RowDefinitions.Add(new RowDefinition()); viewableArea.ColumnDefinitions.Add(new ColumnDefinition()); viewableArea.RowDefinitions[i].Height = new GridLength(25, GridUnitType.Star); viewableArea.ColumnDefinitions[i].Width = new GridLength(25, GridUnitType.Star); } //Creation of our live graph from the user control LiveGraph l1 = new LiveGraph("SensorData_BoilerGetLastPhysicalPressureValue", "Pressure (P)"); LiveGraph l2 = new LiveGraph("SensorData_BoilerGetLastVirtualTempValue", "Temperature (V)"); LiveGraph l3 = new LiveGraph("SensorData_BoilerGetLastVirtualPHValue", "pH (V)"); LiveGraph l4 = new LiveGraph("SensorData_BoilerGetLastVirtualWaterLevelValue", "Water Level (V)"); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); Task.Factory.StartNew(l2.Read); Task.Factory.StartNew(l3.Read); Task.Factory.StartNew(l4.Read); //Placing the graph on the screen in the viewable area viewableArea.Children.Add(l1); viewableArea.Children.Add(l2); viewableArea.Children.Add(l3); viewableArea.Children.Add(l4); //Places them in the corect row and column Grid.SetRow(l1, 0); Grid.SetColumn(l1, 0); Grid.SetRow(l2, 0); Grid.SetColumn(l2, 1); Grid.SetRow(l3, 1); Grid.SetColumn(l3, 0); Grid.SetRow(l4, 1); Grid.SetColumn(l4, 1); } if (hasChild) { viewableArea.RowDefinitions.Clear(); viewableArea.ColumnDefinitions.Clear(); viewableArea.Children.Clear(); for (int i = 0; i < 2; i++) { viewableArea.RowDefinitions.Add(new RowDefinition()); viewableArea.ColumnDefinitions.Add(new ColumnDefinition()); viewableArea.RowDefinitions[i].Height = new GridLength(25, GridUnitType.Star); //The star unit type is used because it means the row will take up 25% of the screen viewableArea.ColumnDefinitions[i].Width = new GridLength(25, GridUnitType.Star); } //Creation of our live graph from the user control LiveGraph l1 = new LiveGraph("SensorData_BoilerGetLastPhysicalPressureValue", "Pressure (P)"); LiveGraph l2 = new LiveGraph("SensorData_BoilerGetLastVirtualTempValue", "Temperature (V)"); LiveGraph l3 = new LiveGraph("SensorData_BoilerGetLastVirtualPHValue", "pH (V)"); LiveGraph l4 = new LiveGraph("SensorData_BoilerGetLastVirtualWaterLevelValue", "Water Level (V)"); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); Task.Factory.StartNew(l2.Read); Task.Factory.StartNew(l3.Read); Task.Factory.StartNew(l4.Read); //Placing the graph on the screen in the viewable area viewableArea.Children.Add(l1); viewableArea.Children.Add(l2); viewableArea.Children.Add(l3); viewableArea.Children.Add(l4); Grid.SetRow(l1, 0); Grid.SetColumn(l1, 0); Grid.SetRow(l2, 0); Grid.SetColumn(l2, 1); Grid.SetRow(l3, 1); Grid.SetColumn(l3, 0); Grid.SetRow(l4, 1); Grid.SetColumn(l4, 1); } }
private void LiveGraphs_Checked(object sender, RoutedEventArgs e) { if (!hasChild) { for (int i = 0; i < 2; i++) { viewableArea.RowDefinitions.Add(new RowDefinition()); viewableArea.ColumnDefinitions.Add(new ColumnDefinition()); viewableArea.RowDefinitions[i].Height = new GridLength(25, GridUnitType.Star); viewableArea.ColumnDefinitions[i].Width = new GridLength(25, GridUnitType.Star); } //Creation of our live graph from the user control LiveGraph l1 = new LiveGraph("SensorData_StackGetLastPhysicalGasValue", "Gas (P)"); LiveGraph l2 = new LiveGraph("SensorData_StackGetLastVirtualTempValue", "Temperature (V)"); LiveGraph l3 = new LiveGraph("SensorData_StackGetLastVirtualParticulateValue", "Particulate (V)"); LiveGraph l4 = new LiveGraph("SensorData_StackGetLastVirtualAirFlowValue", "Air Flow (V)"); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); Task.Factory.StartNew(l2.Read); Task.Factory.StartNew(l3.Read); Task.Factory.StartNew(l4.Read); //Placing the graph on the screen in the viewable area viewableArea.Children.Add(l1); viewableArea.Children.Add(l2); viewableArea.Children.Add(l3); viewableArea.Children.Add(l4); Grid.SetRow(l1, 0); Grid.SetColumn(l1, 0); Grid.SetRow(l2, 0); Grid.SetColumn(l2, 1); Grid.SetRow(l3, 1); Grid.SetColumn(l3, 0); Grid.SetRow(l4, 1); Grid.SetColumn(l4, 1); } if (hasChild) { viewableArea.RowDefinitions.Clear(); viewableArea.ColumnDefinitions.Clear(); viewableArea.Children.Clear(); for (int i = 0; i < 2; i++) { viewableArea.RowDefinitions.Add(new RowDefinition()); viewableArea.ColumnDefinitions.Add(new ColumnDefinition()); viewableArea.RowDefinitions[i].Height = new GridLength(25, GridUnitType.Star); viewableArea.ColumnDefinitions[i].Width = new GridLength(25, GridUnitType.Star); } ///Creation of our live graph from the user control LiveGraph l1 = new LiveGraph("SensorData_StackGetLastPhysicalGasValue", "Gas (P)"); LiveGraph l2 = new LiveGraph("SensorData_StackGetLastVirtualTempValue", "Temperature (V)"); LiveGraph l3 = new LiveGraph("SensorData_StackGetLastVirtualParticulateValue", "Particulate (V)"); LiveGraph l4 = new LiveGraph("SensorData_StackGetLastVirtualAirFlowValue", "Air Flow (V)"); //Starts a thread for each graph that allows it to read the values from the database Task.Factory.StartNew(l1.Read); Task.Factory.StartNew(l2.Read); Task.Factory.StartNew(l3.Read); Task.Factory.StartNew(l4.Read); //Placing the graph on the screen in the viewable area viewableArea.Children.Add(l1); viewableArea.Children.Add(l2); viewableArea.Children.Add(l3); viewableArea.Children.Add(l4); Grid.SetRow(l1, 0); Grid.SetColumn(l1, 0); Grid.SetRow(l2, 0); Grid.SetColumn(l2, 1); Grid.SetRow(l3, 1); Grid.SetColumn(l3, 0); Grid.SetRow(l4, 1); Grid.SetColumn(l4, 1); } }