//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "WeatherWebService.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
NS_WeatherWebService::_di_WeatherWebServiceSoap p =NS_WeatherWebService::GetWeatherWebServiceSoap(true,"");
AnsiString province = ComboBox1->Text;
AnsiString city = ComboBox2->Text;
ArrayOfString arr1 = p->getSupportProvince();
ArrayOfString arr2 = p->getSupportCity(province);
ArrayOfString arr3 = p->getWeatherbyCityName(city);
for (int i = 0; i < arr1.Length; i++)
{
ComboBox1->Items->Add(arr1[i]);
}
for (int i = 0; i < arr2.Length; i++)
{
AnsiString s1 = StringReplace(arr2[i], " ", "\r\n", TReplaceFlags() << rfReplaceAll);
TStringList *lst1 = new TStringList;
lst1->Text = s1;
ComboBox2->Items->Add(lst1->Strings[0]);
}
for (int i = 0; i < arr3.Length; i++)
{
Memo1->Lines->Add(arr3[i]);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Select(TObject *Sender)
{
NS_WeatherWebService::_di_WeatherWebServiceSoap p =NS_WeatherWebService::GetWeatherWebServiceSoap(true,"");
AnsiString province = ComboBox1->Text;
ArrayOfString arr = p->getSupportCity(province);
ComboBox2->Clear();
AnsiString s1 = StringReplace(arr[0], " ", "\r\n", TReplaceFlags() << rfReplaceAll);
TStringList *lst1 = new TStringList;
lst1->Text = s1;
ComboBox2->Text = lst1->Strings[0];
for (int i = 1; i < arr.Length; i++)
{
AnsiString s2 = StringReplace(arr[i], " ", "\r\n", TReplaceFlags() << rfReplaceAll);
TStringList *lst2 = new TStringList;
lst2->Text = s2;
ComboBox2->Items->Add(lst2->Strings[0]);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox2Select(TObject *Sender)
{
NS_WeatherWebService::_di_WeatherWebServiceSoap p =NS_WeatherWebService::GetWeatherWebServiceSoap(true,"");
AnsiString city = ComboBox2->Text;
ArrayOfString arr = p->getWeatherbyCityName(city);
for (int i = 0; i < arr.Length; i++)
{
Memo1->Lines->Add(arr[i]);
}
}
void __fastcall TForm1::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params);
Params.WndParent=NULL;
Params.ExStyle=Params.ExStyle|WS_EX_PALETTEWINDOW;
Params.Style=Params.Style&~WS_CAPTION|WS_POPUP;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
ShowWindow(Application->Handle, SW_HIDE);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
ReleaseCapture();
SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION,0);
}
//---------------------------------------------------------------------------
评论0
最新资源