main.qml Example File
soapxml/assets/main.qml
import bb.cascades 1.0
import "controls"
import wsf.cdyne.com.WeatherWS 1.0
Page {
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
imageSource: "asset:///images/background.png"
}
Container {
verticalAlignment: VerticalAlignment.Top
horizontalAlignment: HorizontalAlignment.Center
leftPadding: 30
rightPadding: 30
Label {
text: qsTr("Select a city:")
textStyle {
color: Color.Black
fontSizeValue: 15
}
}
DropDown {
id: cityDropDown
enabled: !weatherService.active
title: qsTr("City")
Option {
text: qsTr("Beverly Hills")
description: qsTr("Beverly Hills, California")
value: "90210"
selected: true
}
Option {
text: qsTr("Detroit")
description: qsTr("Detroit, Michigan")
value: "48201"
}
Option {
text: qsTr("Pittsburgh")
description: qsTr("City of Pittsburgh (South Side), Pennsylvania")
value: "15203"
}
Option {
text: qsTr("Miami")
description: qsTr("Miami, Florida")
value: "33126"
}
Option {
text: qsTr("Mordor")
description: qsTr("One does not simply walk into Mordor")
value: "331261"
}
onSelectedIndexChanged: {
weatherService.reset()
}
}
Button {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("Get Weather")
enabled: !weatherService.active
onClicked: {
weatherService.requestWeatherInformation(cityDropDown.selectedValue);
}
}
NetworkActivity {
horizontalAlignment: HorizontalAlignment.Center
active: weatherService.active
}
Container {
horizontalAlignment: HorizontalAlignment.Center
topMargin: 100
topPadding: 20
leftPadding: 20
rightPadding: 20
background: Color.create("#aaffffff")
visible: !weatherService.active && weatherService.succeeded
Label {
text: weatherService.description
textStyle {
base: SystemDefaults.TextStyles.BodyText
textAlign: TextAlign.Center
}
}
Label {
topMargin: 30
text: weatherService.temperature
textStyle {
fontSizeValue: 26
color: Color.Black
textAlign: TextAlign.Center
}
}
}
Container {
horizontalAlignment: HorizontalAlignment.Center
topMargin: 100
visible: !weatherService.active && !weatherService.succeeded
TextArea {
editable: false
backgroundVisible: false
text: weatherService.error
textStyle {
base: SystemDefaults.TextStyles.SmallText
color: Color.Black
textAlign: TextAlign.Center
}
}
}
}
attachedObjects: [
WeatherService {
id: weatherService
}
]
}
}