?? formtest.cs
字號(hào):
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using CommCLB.Comm;
using CommCLB.asswctrl_ws;
namespace GPRSDrvWinApp
{
public class FormTest : GPRSDrvWinApp.FormParent
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox tb1;
private System.Windows.Forms.TreeView tv1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.ComponentModel.IContainer components = null;
public FormTest()
{
// 該調(diào)用是 Windows 窗體設(shè)計(jì)器所必需的。
InitializeComponent();
// TODO: 在 InitializeComponent 調(diào)用后添加任何初始化
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormTest));
this.tv1 = new System.Windows.Forms.TreeView();
this.tb1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// imgLstMain
//
this.imgLstMain.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgLstMain.ImageStream")));
//
// tv1
//
this.tv1.ImageIndex = -1;
this.tv1.Location = new System.Drawing.Point(8, 8);
this.tv1.Name = "tv1";
this.tv1.SelectedImageIndex = -1;
this.tv1.Size = new System.Drawing.Size(200, 368);
this.tv1.TabIndex = 0;
//
// tb1
//
this.tb1.Location = new System.Drawing.Point(288, 104);
this.tb1.Name = "tb1";
this.tb1.TabIndex = 1;
this.tb1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(296, 200);
this.button1.Name = "button1";
this.button1.TabIndex = 2;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(296, 240);
this.button2.Name = "button2";
this.button2.TabIndex = 3;
this.button2.Text = "button2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(400, 200);
this.button3.Name = "button3";
this.button3.TabIndex = 4;
this.button3.Text = "button3";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(408, 240);
this.button4.Name = "button4";
this.button4.TabIndex = 5;
this.button4.Text = "button4";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// FormTest
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(530, 389);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.tb1);
this.Controls.Add(this.tv1);
this.Name = "FormTest";
this.ResumeLayout(false);
}
#endregion
/// <summary>
///調(diào)用取得驅(qū)動(dòng)服務(wù)層數(shù)據(jù)的例子
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, System.EventArgs e)
{
showData2(Class_Comm.GetServiceAsswCtrl().getDrvSvcByID(tb1.Text));
}
/// <summary>
/// 調(diào)用后的類型轉(zhuǎn)換例子
/// </summary>
/// <param name="ob"></param>
private void showData2(strDrvSvc ob)
{
//strDrvSvc[] al = ob;
if(ob.fd_valid==true)
{
tv1.Nodes.Add(ob.fd_id);
}
}
/// <summary>
/// 調(diào)用取得不同時(shí)段超標(biāo)上下限結(jié)果集例子
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, System.EventArgs e)
{
//showData3(Class_Comm.GetServiceAsswCtrl().gettgtalmprd());
}
private void showData3(DataSet ds)
{
DataTable dt = ds.Tables["t_table"];
foreach(DataRow dr in dt.Rows)
{
tv1.Nodes.Add(dr["fd_sid"].ToString());
}
}
/// <summary>
/// 調(diào)用監(jiān)測(cè)點(diǎn)監(jiān)測(cè)所有指標(biāo)的例子
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button3_Click(object sender, System.EventArgs e)
{
string sqlcmd;
sqlcmd = "insert into tb_nwadmarea (fd_seq,fd_id,fd_name,fd_num) values(1893,'oo','ffd',5)";
Class_Comm.GetServiceAsswCtrl().insertData(sqlcmd);
}
private void showData4(strRtuTargt[] str)
{
for(int i = 0;i<str.Length;i++)
{
tv1.Nodes.Add(str[i].fd_fldname);
}
}
private void button4_Click(object sender, System.EventArgs e)
{
strRtuTargt[] strRtuTarget=null;
strRtuTarget=Class_Comm.GetServiceAsswCtrl().getMntSptAll("2010");
if(strRtuTarget!=null)
{
MessageBox.Show(strRtuTarget.Length.ToString());
}
else
MessageBox.Show("null");
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -