Ejemplo n.º 1
0
        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);
        }
 private void initializeData(StaticDiagram diagram, int index, UIElement invoker)
 {
     _diagram = diagram;
     _invoker = invoker;
     _index = index;
     _listBox = new ListBox();
     _listBox.SelectionMode = SelectionMode.Multiple;
     foreach (Data data in _diagram.Model.DataList)
     {
         ListBoxItem item = new ListBoxItem() { Content = data.Name, Tag = data };
         _listBox.Items.Add(item);
     }
 }
 /*
  * 构造函数
  */
 public ChooseColumnWindow(StaticDiagram diagram, int index, UIElement invoker)
 {
     initializeData(diagram, index, invoker);
     initializeGraphics();
 }