smartrcp实现多线程调用的示例

<?xml version="1.0" encoding="utf-8"?>
<rcp:RCPModule xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark"  xmlns:rcp="http://www.smartrcp.org"
			    creationComplete="init()"
			   xmlns:mx="library://ns.adobe.com/flex/halo" layout="horizontal" verticalGap="1"
 width="396" height="318">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
			import cn.smartinvoke.smartrcp.gui.module.CObservable;
			
			import mx.collections.ArrayCollection;
			private var systemInfo:CObservable=null;
			[Bindable]
			private var globalInfo:ArrayCollection=new ArrayCollection();
			[Binable]
			private var memoryUsage:String="";
			[Bindable]
			private var cpuUsage:String="";
			function init():void{
				var info:String="本模块通过调用java扩展库实现多线程监听当前的内存与CPU使用状况";
				smartrcpDemo.Instance.setInfo(info);
				
				
				this.systemInfo=new CObservable();
				this.systemInfo.create("cn.smartinvoke.smartrcp.demo.CSystemInfo");
				
				this.systemInfo.addListener(function (param:Array):void{
					this.labelMem.text=param[0] as String;
					this.labelCPU.text=param[1] as String;
				},this);
				
				//获得系统信息
				var propertys:Object=this.systemInfo.call("getInfo",null);
				for(var propertyName:String in propertys){
				  globalInfo.addItem({name:propertyName,value:propertys[propertyName]});
				}
			}
		]]>
	</fx:Script>
	<s:Panel width="100%" height="100%" dropShadowVisible="false" title="系统基本信息">
		<s:layout>
			<s:VerticalLayout/>
		</s:layout>
		<mx:DataGrid x="41" y="17" width="100%" height="100%" 
             dataProvider="{globalInfo}">
			<mx:columns>
				<mx:DataGridColumn headerText="查看项目" dataField="name"/>
				<mx:DataGridColumn headerText="当前值" dataField="value"/>
			</mx:columns>
		</mx:DataGrid>
	</s:Panel>
	<s:Panel id="panelState" width="100%" height="100%" dropShadowVisible="false"
       title="系统当前信息">
		<s:layout>
			<s:BasicLayout/>
		</s:layout>
		<s:Label text="当前CPU使用状况" x="10" y="14" width="113" height="21" 
fontWeight="normal"/>
		<s:Label text="当前可用物理内存" x="10" y="76" width="113" height="21" 
fontWeight="normal"/>
		<s:Label x="22" y="109" id="labelMem"  width="143" height="20" color="#1655E6"/>
		<s:Label x="22" y="47" id="labelCPU"  width="124" height="20" color="#166BEB"/>
	</s:Panel>
	
</rcp:RCPModule>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值