DatasetWatchFrm.cs
资源名称:DSWatch.zip [点击查看]
上传用户:jfy123
上传日期:2021-10-28
资源大小:14k
文件大小:5k
源码类别:
网络截获/分析
开发平台:
C++ Builder
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace DSWatch
- {
- /// <summary>
- /// Summary description for DatasetWatchFrm.
- /// </summary>
- public class DatasetWatchFrm : System.Windows.Forms.Form
- {
- private System.Windows.Forms.TabControl tabControl1;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private System.Windows.Forms.TabPage tabPage1;
- private System.Windows.Forms.TextBox XMLtextBox;
- private System.Data.DataSet ds;
- public DatasetWatchFrm()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- }
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.XMLtextBox = new System.Windows.Forms.TextBox();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.SuspendLayout();
- //
- // tabControl1
- //
- this.tabControl1.Appearance = System.Windows.Forms.TabAppearance.Buttons;
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(0, 0);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(512, 285);
- this.tabControl1.TabIndex = 1;
- //
- // tabPage1
- //
- this.tabPage1.BackColor = System.Drawing.SystemColors.AppWorkspace;
- this.tabPage1.Controls.Add(this.XMLtextBox);
- this.tabPage1.ForeColor = System.Drawing.SystemColors.AppWorkspace;
- this.tabPage1.Location = new System.Drawing.Point(4, 25);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Size = new System.Drawing.Size(504, 256);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "XML";
- //
- // XMLtextBox
- //
- this.XMLtextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.XMLtextBox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.XMLtextBox.Location = new System.Drawing.Point(0, 0);
- this.XMLtextBox.Multiline = true;
- this.XMLtextBox.Name = "XMLtextBox";
- this.XMLtextBox.Size = new System.Drawing.Size(504, 256);
- this.XMLtextBox.TabIndex = 0;
- this.XMLtextBox.Text = "";
- //
- // DatasetWatchFrm
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(512, 285);
- this.Controls.Add(this.tabControl1);
- this.Name = "DatasetWatchFrm";
- this.Text = "DatasetWatchFrm";
- this.Load += new System.EventHandler(this.DatasetWatchFrm_Load);
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion
- private void DatasetWatchFrm_Load(object sender, System.EventArgs e)
- {
- }
- public void getXml(string Xmlstr)
- {
- Xmlstr=Xmlstr.Trim('"');
- Xmlstr=Xmlstr.Replace("\r\n","rn");
- Xmlstr=Xmlstr.Replace( "x5C"",""");
- //System.Windows.Forms.MessageBox.Show(Xmlstr );
- XMLtextBox.Text =Xmlstr;
- ds=new System.Data.DataSet ("time");
- System.IO.StringReader xmlReader;
- xmlReader=new System.IO.StringReader(Xmlstr);
- ds.ReadXml( xmlReader);
- this.Text="Tables for DataSet ""+ds.DataSetName+""";
- if (ds.Tables.Count>0)
- {
- intTables(ds);
- }
- else
- {
- System.Windows.Forms.MessageBox.Show("This Dataset dos not have any table" );
- this.Hide();
- }
- }
- private void intTables(System.Data.DataSet ds)
- {
- for(int i=0;i<ds.Tables.Count ;i++)
- {
- System.Windows.Forms.TabPage t;
- t=new TabPage(ds.Tables[i].TableName +" ( "+ ds.Tables[i].Rows.Count.ToString() +" )" );
- System.Windows.Forms.DataGrid dataGrid1;
- dataGrid1=new DataGrid();
- dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
- dataGrid1.DataSource=ds.Tables[i];
- t.Controls.Add(dataGrid1);
- tabControl1.TabPages.Add (t);
- }
- }
- }
- }