<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="1500" width="1007" height="1310" xmlns:qqonlinewebservice="services.qqonlinewebservice.*" xmlns:ipaddresssearchwebservice="services.ipaddresssearchwebservice.*" xmlns:mobilecodews="services.mobilecodews.*" xmlns:translatorwebservice="services.translatorwebservice.*" xmlns:weatherwebservice="services.weatherwebservice.*" xmlns:xluowebservice="services.xluowebservice.*" viewSourceURL="srcview/index.html">
    <s:layout>
        <s:BasicLayout/>
    </s:layout>
    <fx:Style source="XluoMain.css"/>

    <fx:Script>
        <![CDATA[
            import mx.containers.TitleWindow;
            import mx.controls.Alert;
            import mx.controls.Text;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;   
            public var aaa:TitleWindow=new TitleWindow();
            protected function linkLogin_clickHandler(event:MouseEvent):void
            {
            }
             

            protected function btnLogin_clickHandler(event:MouseEvent):void
            {
                loginResult.token = xluowebservice.login(this.txtLoginName.text,this.txtLoginPwd.text);
                this.lbllogints.text=loginResult.lastResult;
                if(this.lbllogints.text=="登录成功")
                {
                    this.pnlUser.visible=true;
                    this.pnlLogin.visible=false;
                }
            }


            protected function linkExit_clickHandler(event:MouseEvent):void
            {
                this.pnlUser.visible=false;
                this.pnlLogin.visible=true;
            }


            protected function btnSearchByQQ_clickHandler(event:MouseEvent):void
            {
                qqCheckOnlineResult.token = qqOnlineWebService.qqCheckOnline(this.txtQQNum.text);
                //var a=lblqqjieguo.text;
                if(qqCheckOnlineResult.lastResult=="Y")
                {
                    this.lblqqfanhuijieguo.text="查询结果:该QQ在线";
                }
                else if(qqCheckOnlineResult.lastResult=="N")
                {
                    this.lblqqfanhuijieguo.text="查询结果:该QQ号码离线或隐身";
                }
                else
                {
                    this.lblqqfanhuijieguo.text="查询结果:QQ号码错误,请检查输入";
                }
            }
            
            
            protected function btnSearchByIp_clickHandler(event:MouseEvent):void
            {
                getCountryCityByIpResult.token = ipAddressSearchWebService.getCountryCityByIp(this.txtAddress.text);
                
            }
            
            
            protected function btnSearchByPhoneNum_clickHandler(event:MouseEvent):void
            {
                getMobileCodeInfoResult.token = mobileCodeWS.getMobileCodeInfo(this.txtPhoneNum.text,null);
            }
            
            
            protected function btnSearchByFanYi_clickHandler(event:MouseEvent):void
            {
                getEnCnTwoWayTranslatorResult.token = translatorWebService.getEnCnTwoWayTranslator(this.txtfanyi.text);
            }
            
            
            protected function btnSearchByCity_clickHandler(event:MouseEvent):void
            {
                getWeatherbyCityNameResult.token = weatherWebService.getWeatherbyCityName(this.txtCity.text);
            }
            
            
            protected function btnPost_clickHandler(event:MouseEvent):void
            {
                if(this.txtContent.text!=""&&this.txtContent.text!=null)
                {
                    addResult.token = xluowebservice.add(this.txtContent.text,"xluo");
                    showListResult.token = xluowebservice.showList();
                    this.txtContent.text="";
                }
                else
                {
                    this.lblts.text="请输入留言内容";
                }
            }
            
            
            protected function adg0_creationCompleteHandler(event:FlexEvent):void
            {
                showListResult.token = xluowebservice.showList();
            }
            
            
            protected function btnReg_clickHandler(event:MouseEvent):void
            {
                var sex="";
                if(this.rdoNan.selected==true)
                {
                    sex="男";
                }
                else
                {
                    sex="女";
                }
                regResult.token = xluowebservice.reg(this.txtRegName.text,this.txtRegPwd.text,sex,this.txtRegQQ.text,this.txtRegMail.text);
                
            }
            
        ]]>
    </fx:Script>

    <fx:Declarations>
        <s:CallResponder id="qqCheckOnlineResult"/>
        <qqonlinewebservice:QqOnlineWebService id="qqOnlineWebService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="getCountryCityByIpResult"/>
        <ipaddresssearchwebservice:IpAddressSearchWebService id="ipAddressSearchWebService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="getMobileCodeInfoResult"/>
        <mobilecodews:MobileCodeWS id="mobileCodeWS" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="getMobileCodeInfoResult2"/>
        <s:CallResponder id="getMobileCodeInfoResult3"/>
        <s:CallResponder id="getEnCnTwoWayTranslatorResult"/>
        <translatorwebservice:TranslatorWebService id="translatorWebService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="getWeatherbyCityNameResult"/>
        <weatherwebservice:WeatherWebService id="weatherWebService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="addResult"/>
        <xluowebservice:Xluowebservice id="xluowebservice" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="showListResult"/>
        <s:CallResponder id="loginResult"/>
        <s:CallResponder id="regResult"/>
        <!-- 将非可视元素(例如服务、值对象)放在此处 -->
    </fx:Declarations>
    <s:Panel x="11.95" y="452.2" width="702" height="131" id="pnlLiuYan" title="我要留言">
        <s:TextArea x="4" y="12" width="607" height="80" id="txtContent"/>
        <s:Button x="619.5" y="10.6" label="留言" height="81" id="btnPost" fontSize="12" click="btnPost_clickHandler(event)"/>
        <s:Label x="576" y="-19" id="lblts" color="#FD0404" width="114"/>
    </s:Panel>
    <s:Panel x="724.2" y="977.15" width="269" height="217" id="pnlReg" title="用户注册">
        <s:Label x="11" y="16" text="用户名:"/>
        <s:TextInput x="58" y="10" width="180" id="txtRegName"/>
        <s:Label x="20" y="44" text="密码:"/>
        <s:TextInput x="58" y="38" width="180" id="txtRegPwd"/>
        <s:Label x="20" y="72" text="性别:"/>
        <s:RadioButton x="58" y="68" label="男" id="rdoNan" selected="true"/>
        <s:RadioButton x="94" y="68" label="女" id="rdoNv"/>
        <s:Label x="21" y="99" text="QQ:"/>
        <s:TextInput x="57" y="92" width="181" id="txtRegQQ"/>
        <s:Label x="10" y="126" text="E-Mail:"/>
        <s:TextInput x="56" y="126" width="182" id="txtRegMail"/>
        <s:Button x="69" y="154" label="注册" id="btnReg" click="btnReg_clickHandler(event)"/>
        <s:Button x="154" y="154" label="重置" id="btnRegReset"/>
    </s:Panel>
    <s:Panel x="720" y="590.5" width="269" height="132" id="pnlLogin" title="用户登录">
        <s:Label x="10" y="18" text="用户名:" id="lblLoginName"/>
        <s:Label x="20" y="47" text="密码:" id="lblLoginPwd"/>
        <s:TextInput x="58" y="14" width="180" id="txtLoginName"/>
        <s:TextInput x="58" y="42" width="180" id="txtLoginPwd"/>
        <s:Button x="76" y="73" label="登录" id="btnLogin" click="btnLogin_clickHandler(event)"/>
        <s:Button x="154" y="73" label="重置" id="btnLoginReset"/>
        <s:Label x="74" y="-19" width="165" id="lbllogints" color="#FC1503"/>
    </s:Panel>
        <s:Panel x="720" y="590.5" width="269" height="132" title="个人中心" id="pnlUser" visible="false">
            <s:Label x="64" y="10" text="欢迎你:"/>
            <s:Label x="105" y="11" text="UserName" color="#FF0505" width="132" id="lblUserName"/>
            <mx:LinkButton x="62" y="33" label="1.个人中心" width="107" id="linkUser"/>
            <mx:LinkButton x="64" y="63" label="2.退出" width="105" id="linkExit" click="linkExit_clickHandler(event)"/>        
    </s:Panel>
    <s:Panel x="719" y="452" width="270" height="131" title="网站公告">
        <s:Label x="6" y="7" text="xluoflex个人留言系统 开发成功!&#xd;&#xd;此系统采用flex 4.0 +asp.net 2.0开发&#xd;&#xd;数据调用采用webservice实现。&#xd;&#xd;by:xluo QQ:365160297" width="195" height="88"/>
    </s:Panel>
    <mx:Image x="190" y="10" id="xluo_logo" source="file:/C:/Users/Administrator/Desktop/xluo_flex_logo.jpg"/>
    <s:Panel x="10" y="591" width="702" height="603" title="留言列表">
        <mx:AdvancedDataGrid x="4" y="5" id="adg0" designViewDataType="flat" width="686" height="556" creationComplete="adg0_creationCompleteHandler(event)" dataProvider="{showListResult.lastResult}">
            <mx:columns>
                <mx:AdvancedDataGridColumn headerText="留言内容" dataField="0" width="400"/>
                <mx:AdvancedDataGridColumn headerText="留言人" dataField="1" width="90"/>
                <mx:AdvancedDataGridColumn headerText="留言时间" dataField="2" width="150"/>
            </mx:columns>
        </mx:AdvancedDataGrid>
    </s:Panel>
    <s:Label x="385" y="1260" text="版权所有,侵权必究。 By:xluo QQ:365160297"/>
    <s:Panel x="720" y="735" width="273" height="234" title="日历">
        <mx:DateChooser x="10" y="3" width="253" height="193"/>
    </s:Panel>
    <s:Panel x="10" y="167" width="980" height="277" title="在线WEB服务大全">
        <s:Panel x="10" y="10" width="316" height="76" title="IP地址来源搜索 WEB 服务(是目前最完整的IP地址数据)" id="pnlSearchIp">
            <s:Label x="6" y="14" text="IP地址:" id="lblIpAddress"/>
            <s:TextInput x="48" y="9" width="172" id="txtAddress" text="{getCountryCityByIpResult.lastResult[1]}"/>
            <s:Button x="229" y="9" label="查询" id="btnSearchByIp" click="btnSearchByIp_clickHandler(event)"/>
        </s:Panel>
        <s:Panel x="343" y="10" width="357" height="76" title="腾讯QQ在线状态WEB 服务" id="pnlSearchQQ">
            <s:Label x="9" y="15" text="QQ号码:" id="lblQQNum"/>
            <s:TextInput x="59" y="10" width="208" id="txtQQNum"/>
            <s:Button x="275" y="10" label="查询" id="btnSearchByQQ" click="btnSearchByQQ_clickHandler(event)"/>
            <s:Label x="149" y="-19" id="lblqqfanhuijieguo" color="#F90802"/>
        </s:Panel>
        <s:Panel x="708" y="10" width="270" height="76" title="国内手机号码归属地查询WEB 服务">
            <s:Label x="10" y="15" text="手机号码:" id="lblPhoneNum"/>
            <s:TextInput x="62" y="10" width="121" id="txtPhoneNum" text="{getMobileCodeInfoResult.lastResult}"/>
            <s:Button x="187" y="10" label="查询" id="btnSearchByPhoneNum" click="btnSearchByPhoneNum_clickHandler(event)"/>
        </s:Panel>
        <s:Panel x="10" y="94" width="690" height="140" title="中文 &lt;-&gt; 英文双向翻译 WEB 服务">
            <s:Label x="6" y="45" text="请输入中文或英文:" height="15" id="lblChineseOrEngilsh"/>
            <s:TextArea x="104" y="10" width="496" height="87" id="txtfanyi" text="{getEnCnTwoWayTranslatorResult.lastResult[0]}{getEnCnTwoWayTranslatorResult.lastResult[1]}"/>
            <s:Button x="608" y="10" label="立即翻译" height="87" width="70" id="btnSearchByFanYi" click="btnSearchByFanYi_clickHandler(event)"/>
        </s:Panel>
        <s:Panel x="708" y="94" width="270" height="140" title="400个国内外主要城市天气预报Web服务">
            <s:Label x="10" y="10" text="请输入城市:" id="lblCity"/>
            <s:TextInput x="75" y="5" width="109" id="txtCity"/>
            <s:Button x="192" y="3" label="查询" id="btnSearchByCity" click="btnSearchByCity_clickHandler(event)"/>
            <s:Label x="13" y="32" width="246" height="69" id="lblTianQiJieGuo" text="{getWeatherbyCityNameResult.lastResult[1]} {getWeatherbyCityNameResult.lastResult[5]} {getWeatherbyCityNameResult.lastResult[6]} {getWeatherbyCityNameResult.lastResult[7]} {getWeatherbyCityNameResult.lastResult[10]}"/>
        </s:Panel>
    </s:Panel>
    <s:Label x="35" y="147" text="{qqCheckOnlineResult.lastResult}" id="lblqqjieguo" visible="false"/>
</s:Application>