Пример #1
0
        // 查询
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string strDate = date.Text.ToString();

            nowTextBlock.Text = strDate;
            nowText           = strDate;

            DataTable dataTable = new DataTable();

            dbTool.getNodeTeperature(strDate, this.node, out dataTable);

            // 将dataTable中的temperature加入到datasource
            plotter.Children.Remove(graphTemperature);
            dataSource       = new ObservableDataSource <Point>();
            graphTemperature = plotter.AddLineGraph(dataSource, Colors.Green, 2, "结点" + this.node.ToString());
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                float temperature = float.Parse(dataTable.Rows[i].ItemArray[1].ToString());
                //Console.WriteLine("{0}", temperature);
                dataSource.AppendAsync(base.Dispatcher, new Point(i, temperature));
            }
        }