日期:2014-05-20  浏览次数:20776 次

多线程问题,敬请指教!
using   System;
using   System.Drawing;
using   System.Collections;
using   System.ComponentModel;
using   System.Windows.Forms;
using   System.Data;
using   WatchCenter.DataAccess;
using   WatchCenter.DataModel;
using   System.Threading;
using   mo=ESRI.MapObjects2.Core;
using   System.IO;
using   System.Diagnostics;
using   DBConnSetup;
namespace   WatchCenter
{
///   <summary>
///   Form1   的摘要说明。
///   </summary>
public   class   frmMain   :   System.Windows.Forms.Form
{
private   System.Windows.Forms.ListView   listView1;
private   System.Windows.Forms.Splitter   splitter1;
private   System.Windows.Forms.Panel   panel1;
private   ESRI.MapObjects2.Core.AxMap   axMap1;
private   WatchCenterStatusAction   wcsa;
private   mo.Line   lines;
private   mo.Line   fullextent;  
private   ArrayList   lst;
private   Thread   t;
private   MapCtrl   mapctrl;
///   <summary>
///   必需的设计器变量。
///   </summary>
private   System.ComponentModel.Container   components   =   null;

public   frmMain()
{
//
//   Windows   窗体设计器支持所必需的
//
InitializeComponent();
wcsa=new   WatchCenterStatusAction();
mapctrl=new   MapCtrl();
InitializeTrackingLayer();

//
//   TODO:   在   InitializeComponent   调用后添加任何构造函数代码
//
}

///   <summary>
///   清理所有正在使用的资源。
///   </summary>
protected   override   void   Dispose(   bool   disposing   )
{
if(   disposing   )
{
if   (components   !=   null)  
{
components.Dispose();
}
}
base.Dispose(   disposing   );
}

#region   Windows   窗体设计器生成的代码
///   <summary>
///   设计器支持所需的方法   -   不要使用代码编辑器修改
///   此方法的内容。
///   </summary>
private   void   InitializeComponent()
{

}
#endregion

///   <summary>
///   应用程序的主入口点。
///   </summary>
[STAThread]
static   void   Main()  
{
try
{
string   appPath   =   Application.StartupPath;
if(!File.Exists( "key.dat "))
{
frmDBConnect   frm=new   frmDBConnect();
frm.ShowDialog();
// Process   process   =   new   Process();
// process.StartInfo.FileName   =   "DBConnSetup.exe ";
// process.Start();
// process.WaitForInputIdle();
if(null!=frm.Tag)
{
File.Create(Application.StartupPath+ "\\key.dat ");
Application.Run(new   frmMain());
}
else
{
Application.Exit();
}
}
else
{
Application.Run(new   frmMain());
}
}
catch(Exception   ee)
{
MessageBox.Show(ee.Message);
}
}

private   void   frmMain_Load(object   sender,   System.EventArgs   e)
{
mapctrl.loadLayer(this.axMap1);