///<reference path="/Scripts/ExtPB_Net.js" />
///<reference path="/Scripts/MyExtPB.js" />
///<reference path="/Scripts/ExtPB_Dll_Pb_Http.js" />
///<reference path="/Scripts/MyExtPb_Input.js" />

function W_My_Base() {

	 var self=this;
	 this.Instance=null;
	 var requestor= new PBWindow();
	 var tv_1= new MyJs_Base( requestor );
	 var dw_list= new DataWindow( requestor );
	 var tb_1= new ToolStrip( requestor );
	 var ContextMenuStrip1= new ContextMenu( requestor );

	 if(typeof(this.bind)=="function") var baseBind=this.bind;
	 this.bind=function(win){
	 self.Instance=win;
	 if(typeof( baseBind )=="function") baseBind(win);

		 if(requestor == null ) requestor= new PBWindow();
		 requestor.Attach(win);
		 if(tv_1 == null ) tv_1= new MyJs_Base( requestor );
		 tv_1.Attach( win.Control( "tv_1") ); 
		 if(dw_list == null ) dw_list= new DataWindow( requestor );
		 dw_list.Attach( win.Control( "dw_list") ); 
		 if(tb_1 == null ) tb_1= new ToolStrip( requestor );
		 tb_1.Attach( win.Control( "tb_1") ); 
		 if(ContextMenuStrip1 == null ) ContextMenuStrip1= new ContextMenu( requestor );
		 ContextMenuStrip1.Attach( win.Control( "ContextMenuStrip1") ); 

		 if(typeof(self.PostOpen)=="function") 
			 win.AttachEvent("window","PostOpen",self.PostOpen); 

		 if(typeof(self.Delete)=="function") 
			 win.AttachEvent("btn_Delete","Clicked",self.Delete); 

		 if(typeof(self.Exit)=="function") 
			 win.AttachEvent("btn_Exit","Clicked",self.Exit); 

		 if(typeof(self.savegs)=="function") 
			 win.AttachEvent("保存格式ToolStripMenuItem","Clicked",self.savegs); 

		 if(typeof(self.qcgs)=="function") 
			 win.AttachEvent("清除格式ToolStripMenuItem","Clicked",self.qcgs); 

	 }

	 if(typeof(this.unbind)=="function") var baseUnBind=this.unbind; 
	 this.unbind=function() {
	 self.Instance=null;
	 if(typeof(this.Release)=="function") this.Release(); 
	 if(typeof(baseUnBind)=="function") baseUnBind(); 

		 tv_1.Detach(); tv_1=null; 
		 dw_list.Detach(); dw_list=null; 
		 tb_1.Detach(); tb_1=null; 
		 ContextMenuStrip1.Detach(); ContextMenuStrip1=null; 
		 requestor.Detach(); requestor=null; 

		 setTimeout(CollectGarbage, 100); 
	 }

	 //以上代码由设计器自动生成,请不要手工修改
	 //ExtPB.Net JavaScript End  设计器查找标志,请不要删除或修改
	 var curFunctionId = "";
	 var curYhbh = "";

    this.trParent = tv_1;

    this.PostOpen = function () {
        curYhbh = requestor.GetParm("curYhbh");
        curFunctionId = requestor.GetParm("curFunctionId");
        tv_1.SetMyJs_Base(tv_1, dw_list);
       
    }
    this.Exit = function () {
        setTimeout("window.close()", 100);
    }

    //#region 格式保存
    this.savegs = function () {
        var msg = savegs(dw_list, curYhbh, curFunctionId);
        alert(msg);
    }
    //#endregion

    //#region 清除格式
    this.qcgs = function () {
        var msg = qcgs(curYhbh, curFunctionId);
        alert(msg);

    }
    //#endregion
}