void timer_Tick(GT.Timer timer) { var data = new SensorData() { Ph = 1 + rnd.Next(10), Relay1 = rnd.Next(2) > 0 ? true : false, Relay2 = rnd.Next(2) > 0 ? true : false, Tds1 = 1 + rnd.Next(100), Tds2 = 1 + rnd.Next(100), Temp1 = 25 + rnd.Next(7), //.ConvertAndReadTemperature(), Temp2 = 25 + rnd.Next(8), //.ConvertAndReadTemperature(), //Temp3 = Temp3.ConvertAndReadTemperature(), WaterDist = 1 + rnd.Next(10) }; //insert to db var item = new DataGridItem(new object[] { DateTime.Now.ToString("HH:mm:ss"), data.Temp1.ToString("n2") + "C", data.Temp2.ToString("n2") + "C", data.WaterDist.ToString("n2") + "CM", data.Tds1.ToString("n2"), data.Tds2.ToString("n2") }); //add data to grid GvData.AddItem(item); GvData.Invalidate(); if (counter++ > 9) { counter = 0; GvData.Clear(); } var jsonStr = Json.NETMF.JsonSerializer.SerializeObject(data); Debug.Print("kirim :" + jsonStr); xBeeAdapter.Port.WriteLine(jsonStr); }
public QueryViewModel() { modelView = new ModelView(); Export = new DelegateCommand(ExportAction); DataGrid.Clear(); _viewId = Guid.NewGuid(); }
private void LinkToDataGrid() { DataGrid.Clear(); foreach (var equipment in Equipmentlist) { DataGrid.Add(equipment); } }
private void findClicked(object sender, RoutedEventArgs e) { string colName = comboInfo.Text; // Year / Model string toFind = textInfo.Text; ItemCollection rows = new DataGrid().Items; rows.Clear(); myGrid.Items.Clear(); foreach (Car car in carsList) { myGrid.Items.Add(new Row { Id = car.Id, Model = car.Model, Engine = car.Engine.ToString(), Year = car.Year, EngineType = car.Engine.Model == "TDI" ? "diesel" : "petrol" }); } if (toFind == "" || colName == "none") { myGrid.Items.Refresh(); return; } if (colName == "Model") { foreach (Row row in myGrid.Items) { if (row.Model.Contains(toFind)) { rows.Add(new Row { Id = row.Id, Model = row.Model, Engine = row.Engine.ToString(), Year = row.Year, EngineType = row.Model == "TDI" ? "diesel" : "petrol" }); } } } else { int x = 0; if (Int32.TryParse(toFind, out x)) { foreach (Row row in myGrid.Items) { if ((x == row.Year)) { rows.Add(new Row { Id = row.Id, Model = row.Model, Engine = row.Engine.ToString(), Year = row.Year, EngineType = row.Model == "TDI" ? "diesel" : "petrol" }); } } } } myGrid.Items.Clear(); foreach (Row row in rows) { myGrid.Items.Add(row); } myGrid.Items.Refresh(); }
private void update_Schedule_DataGrid() { dataGrid_Schedule.Clear(); if (dropDown_PumpSelection.Value != null) { Fertilize_Job[] jobs = Fertilize_Manager.GetFertilizePumpByIndex((int)dropDown_PumpSelection.Value).Get_All_Fertilize_Jobs(); foreach (Fertilize_Job job in jobs) { dataGrid_Schedule.AddItem(new DataGridItem(new object[] { job.StartTime.Hour.ToString("D2") + ":" + job.StartTime.Minute.ToString("D2"), job.Quantity_ml.ToString() + " ml", job })); } } update_DataTextboxes(dataGrid_Schedule.SelectedIndex); dataGrid_Schedule.Invalidate(); }
public void ClearMap() { Terrain?.ClearAllTiles(); Collision?.Clear(); }
public void Destroy() { Destroyed = true; _items.Clear(); }
public void LoadDataTable(DataTable table) { grid.Clear(); grid.DataSource = table; grid.DataBind(); }