public MainWindow() { InitializeComponent(); TabControl _control = new TabControl(); #region 静态图表 TabItem _Sitem = new TabItem(); _Sitem.Header = "静态绘图"; // 连接数据库 SqlDataAccess Sconn = new SqlDataAccess("Data Source=(local);Initial Catalog=数据发送数据库;Integrated Security=True"); DataSet Sds = Sconn.SelectDataSet("Select * from WS_Drilling_Depth_Based where WELLID = '龙109井' and WELLBOREID ='主井眼' order by DEPTMEAS asc"); if (Sds.Tables[0].Rows.Count == 0) { System.Windows.MessageBox.Show("'龙109井'的录井数据为空,请重新选择!"); return; } else { StaticDiagram.DataModel Smodel = new StaticDiagram.DataModel("..\\..\\StaticDiagram\\DataConfig.xml", Sds); StaticDiagram.StaticDiagram diagram = new StaticDiagram.StaticDiagram(900, Smodel, "..\\..\\StaticDiagram\\DiagramConfig.xml"); diagram.drawGraphics(); _Sitem.Content = diagram; _control.Items.Add(_Sitem); } #endregion #region 动态图表 _Ditem = new TabItem(); _Ditem.Header = "动态绘图"; initializeDataBase(); initializeGraphics(); System.Windows.Forms.Timer _timer = new System.Windows.Forms.Timer(); _timer.Enabled = true; _timer.Interval = 1000; _timer.Tick += new EventHandler(DataCollect); _control.Items.Add(_Ditem); #endregion this._grid.Children.Add(_control); }
public void startDynamicDrawing(SqlDataAccess conn, String TableName, String WellID, String WellBoreID, ScaleData data) { this.conn = conn; this.TableName = TableName; this.WellID = WellID; this.WellBoreID = WellBoreID; this.data = data; _timer = new System.Windows.Forms.Timer(); _timer.Enabled = true; _timer.Interval = _model.Interval; _timer.Tick += new EventHandler(getData); }
private void initializeDataBase() { DSconn = new SqlDataAccess("Data Source=(local);Initial Catalog=数据发送数据库;Integrated Security=True"); DRconn = new SqlDataAccess("Data Source=(local);Initial Catalog=数据接收数据库;Integrated Security=True"); SendDs = DSconn.SelectDataSet("Select * from WS_Drilling_Depth_Based where WELLID = '龙109井' and WELLBOREID ='主井眼' order by TDATE ASC, TTIME ASC"); string sql = "DELETE FROM WS_Drilling_Depth_Based where WELLID = '龙109井' and WELLBOREID ='主井眼'"; DRconn.ExeSQL(sql); }