Added initial source and README
|
@ -1,47 +1,252 @@
|
|||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# =========================
|
||||
# Operating System Files
|
||||
# =========================
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# OSX
|
||||
# =========================
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
# Weather
|
||||
|
||||
**Weather** is a Xamarin.Forms **GTK backend** application that makes use [OpenWeatherMap.org API](https://openweathermap.org/api), to demonstrate the possibilities of the new backend making use of a great variety of functionality.
|
||||
|
||||
<img src="images/weatherapp.png" alt="WeatherApp" Width="800" />
|
||||
|
||||
## Xamarin.Forms App
|
||||
|
||||
[Xamarin.Forms](https://www.xamarin.com/forms) allows you to build native UIs for iOS, Android, Windows, macOS and **Linux** from a single, shared codebase. You can dive into mobile development with Xamarin.Forms by following our [free self-guided learning](https://university.xamarin.com/classes/track/self-guided) from Xamarin University. This project exercises the following patterns and features:
|
||||
|
||||
* Xamarin.Forms
|
||||
* [XAML UI](https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/)
|
||||
* Converters
|
||||
* Custom Controls
|
||||
* [Data Binding](https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/data_binding_basics/)
|
||||
* [MVVM](https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/data_bindings_to_mvvm/)
|
||||
* [Styles](https://developer.xamarin.com/guides/xamarin-forms/user-interface/styles/)
|
||||
|
||||
## Requirements
|
||||
|
||||
* [Visual Studio __2015__](https://www.visualstudio.com/en-us/products/vs-2015-product-editions.aspx) Update 3 (14.0 or higher) to compile C# 6 language features (or Visual Studio MacOS)
|
||||
* Xamarin add-ons for Visual Studio 3.2.1.64 or higher (available via the Visual Studio installer)
|
||||
* __Visual Studio Community Edition is fully supported!__
|
||||
|
||||
## Setup
|
||||
|
||||
**Download** or clone the repository. This is a solution with two projects.
|
||||
|
||||
**Rebuild** the solution to get all neccesary **NuGet** packages.
|
||||
|
||||
Access to **AppSettings.cs** file available in the Portable Class Library to introduce city.
|
||||
|
||||
Enjoy!
|
||||
|
||||
## Licenses
|
||||
|
||||
This project is based on [MyWeather.Forms](https://github.com/jamesmontemagno/MyWeather.Forms) by James Montemagno.
|
||||
|
||||
## Clean and Rebuild
|
||||
|
||||
If you see build issues when pulling updates from the repo, try cleaning and rebuilding the solution.
|
||||
|
||||
## Copyright and license
|
||||
|
||||
Code released under the [MIT license](https://opensource.org/licenses/MIT).
|
После Ширина: | Высота: | Размер: 360 KiB |
|
@ -0,0 +1,138 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeatherApp", "WeatherApp\WeatherApp\WeatherApp.csproj", "{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeatherApp.GTK", "WeatherApp\WeatherApp.GTK\WeatherApp.GTK.csproj", "{9C25D1E8-C689-4328-B822-17C885E2C279}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||
Ad-Hoc|ARM = Ad-Hoc|ARM
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator
|
||||
Ad-Hoc|x64 = Ad-Hoc|x64
|
||||
Ad-Hoc|x86 = Ad-Hoc|x86
|
||||
AppStore|Any CPU = AppStore|Any CPU
|
||||
AppStore|ARM = AppStore|ARM
|
||||
AppStore|iPhone = AppStore|iPhone
|
||||
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
|
||||
AppStore|x64 = AppStore|x64
|
||||
AppStore|x86 = AppStore|x86
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|ARM.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|x64.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Ad-Hoc|x86.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|ARM.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|ARM.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|x64.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|x64.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|x86.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.AppStore|x86.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|ARM.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|x64.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Ad-Hoc|x86.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|ARM.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|ARM.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|x64.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|x64.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|x86.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.AppStore|x86.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9C25D1E8-C689-4328-B822-17C885E2C279}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
После Ширина: | Высота: | Размер: 2.1 KiB |
После Ширина: | Высота: | Размер: 24 KiB |
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 2.8 KiB |
После Ширина: | Высота: | Размер: 42 KiB |
После Ширина: | Высота: | Размер: 2.4 KiB |
После Ширина: | Высота: | Размер: 792 B |
После Ширина: | Высота: | Размер: 6.2 KiB |
После Ширина: | Высота: | Размер: 34 KiB |
После Ширина: | Высота: | Размер: 3.0 KiB |
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.GTK;
|
||||
|
||||
namespace WeatherApp.GTK
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
|
||||
Gtk.Application.Init();
|
||||
Forms.Init();
|
||||
var app = new App();
|
||||
var window = new FormsWindow();
|
||||
window.LoadApplication(app);
|
||||
window.SetApplicationTitle("WeatherApp");
|
||||
window.Show();
|
||||
Gtk.Application.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// La información general de un ensamblado se controla mediante el siguiente
|
||||
// conjunto de atributos. Cambie estos valores de atributo para modificar la información
|
||||
// asociada con un ensamblado.
|
||||
[assembly: AssemblyTitle("WeatherApp.GTK")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WeatherApp.GTK")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
|
||||
// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde
|
||||
// COM, establezca el atributo ComVisible en true en este tipo.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
|
||||
[assembly: Guid("9c25d1e8-c689-4328-b822-17c885e2c279")]
|
||||
|
||||
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
|
||||
//
|
||||
// Versión principal
|
||||
// Versión secundaria
|
||||
// Número de compilación
|
||||
// Revisión
|
||||
//
|
||||
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
|
||||
// mediante el carácter '*', como se muestra a continuación:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9C25D1E8-C689-4328-B822-17C885E2C279}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WeatherApp.GTK</RootNamespace>
|
||||
<AssemblyName>WeatherApp.GTK</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\gdk-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\glade-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\glib-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="gtk-dotnet, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\gtk-dotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\gtk-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\pango-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\net45\Xamarin.Forms.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\net45\Xamarin.Forms.Platform.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform.GTK, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\net45\Xamarin.Forms.Platform.GTK.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\net45\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WeatherApp\WeatherApp.csproj">
|
||||
<Project>{2381a53a-9cb7-48a0-967b-fb8919af8fc7}</Project>
|
||||
<Name>WeatherApp</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Images\cloud.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\clouds-background.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\curve-mask.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\moon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\rain-background.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\rain.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\reload.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\shadow-overlay.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\sun-background.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\sun.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\packages\Xamarin.Forms.3.0.0\build\netstandard1.0\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.3.0.0\build\netstandard1.0\Xamarin.Forms.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.3.0.0\build\netstandard1.0\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.3.0.0\build\netstandard1.0\Xamarin.Forms.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Xamarin.Forms" version="3.0.0" targetFramework="net452" />
|
||||
</packages>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:converters="clr-namespace:WeatherApp.Converters;assembly=WeatherApp"
|
||||
x:Class="WeatherApp.App">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<!-- COLORS -->
|
||||
<Color x:Key="AccentColor">#353186</Color>
|
||||
<Color x:Key="WhiteColor">#FFFFFF</Color>
|
||||
<Color x:Key="BlackColor">#000000</Color>
|
||||
|
||||
<!-- CONVERTERS -->
|
||||
<converters:BackgroundConverter x:Key="BackgroundConverter" />
|
||||
<converters:IconConverter x:Key="IconConverter" />
|
||||
<converters:InverseBoolConverter x:Key="InverseBoolConverter" />
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,30 @@
|
|||
using WeatherApp.Views;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
MainPage = new CustomNavigationPage(new WeatherView());
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
// Handle when your app starts
|
||||
}
|
||||
|
||||
protected override void OnSleep()
|
||||
{
|
||||
// Handle when your app sleeps
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
{
|
||||
// Handle when your app resumes
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace WeatherApp
|
||||
{
|
||||
public class AppSettings
|
||||
{
|
||||
public static string Location = "Sevilla";
|
||||
public static bool IsImperial = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.Controls
|
||||
{
|
||||
public class HorizontalList : Grid
|
||||
{
|
||||
private ICommand _innerSelectedCommand;
|
||||
private readonly ScrollView _scrollView;
|
||||
private readonly StackLayout _itemsStackLayout;
|
||||
|
||||
public event EventHandler SelectedItemChanged;
|
||||
|
||||
public StackOrientation ListOrientation { get; set; }
|
||||
|
||||
public double Spacing { get; set; }
|
||||
|
||||
public static readonly BindableProperty SelectedCommandProperty =
|
||||
BindableProperty.Create("SelectedCommand", typeof(ICommand), typeof(HorizontalList), null);
|
||||
|
||||
public static readonly BindableProperty ItemsSourceProperty =
|
||||
BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(HorizontalList), default(IEnumerable<object>), BindingMode.TwoWay, propertyChanged: ItemsSourceChanged);
|
||||
|
||||
public static readonly BindableProperty SelectedItemProperty =
|
||||
BindableProperty.Create("SelectedItem", typeof(object), typeof(HorizontalList), null, BindingMode.TwoWay, propertyChanged: OnSelectedItemChanged);
|
||||
|
||||
public static readonly BindableProperty ItemTemplateProperty =
|
||||
BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(HorizontalList), default(DataTemplate));
|
||||
|
||||
public ICommand SelectedCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(SelectedCommandProperty); }
|
||||
set { SetValue(SelectedCommandProperty, value); }
|
||||
}
|
||||
|
||||
public IEnumerable ItemsSource
|
||||
{
|
||||
get { return (IEnumerable)GetValue(ItemsSourceProperty); }
|
||||
set { SetValue(ItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
public object SelectedItem
|
||||
{
|
||||
get { return (object)GetValue(SelectedItemProperty); }
|
||||
set { SetValue(SelectedItemProperty, value); }
|
||||
}
|
||||
|
||||
public DataTemplate ItemTemplate
|
||||
{
|
||||
get { return (DataTemplate)GetValue(ItemTemplateProperty); }
|
||||
set { SetValue(ItemTemplateProperty, value); }
|
||||
}
|
||||
|
||||
private static void ItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var itemsLayout = (HorizontalList)bindable;
|
||||
itemsLayout.SetItems();
|
||||
}
|
||||
|
||||
public HorizontalList()
|
||||
{
|
||||
Spacing = 6;
|
||||
_scrollView = new ScrollView();
|
||||
_itemsStackLayout = new StackLayout
|
||||
{
|
||||
BackgroundColor = BackgroundColor,
|
||||
Padding = Padding,
|
||||
Spacing = Spacing,
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
|
||||
_scrollView.BackgroundColor = BackgroundColor;
|
||||
_scrollView.Content = _itemsStackLayout;
|
||||
Children.Add(_scrollView);
|
||||
}
|
||||
|
||||
protected virtual void SetItems()
|
||||
{
|
||||
_itemsStackLayout.Children.Clear();
|
||||
_itemsStackLayout.Spacing = Spacing;
|
||||
|
||||
_innerSelectedCommand = new Command<View>(view =>
|
||||
{
|
||||
SelectedItem = view.BindingContext;
|
||||
SelectedItem = null; // Allowing item second time selection
|
||||
});
|
||||
|
||||
_itemsStackLayout.Orientation = ListOrientation;
|
||||
_scrollView.Orientation = ListOrientation == StackOrientation.Horizontal
|
||||
? ScrollOrientation.Horizontal
|
||||
: ScrollOrientation.Vertical;
|
||||
|
||||
if (ItemsSource == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var item in ItemsSource)
|
||||
{
|
||||
_itemsStackLayout.Children.Add(GetItemView(item));
|
||||
}
|
||||
|
||||
_itemsStackLayout.BackgroundColor = BackgroundColor;
|
||||
SelectedItem = null;
|
||||
}
|
||||
|
||||
protected virtual View GetItemView(object item)
|
||||
{
|
||||
var content = ItemTemplate.CreateContent();
|
||||
var view = content as View;
|
||||
|
||||
if (view == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
view.BindingContext = item;
|
||||
|
||||
var gesture = new TapGestureRecognizer
|
||||
{
|
||||
Command = _innerSelectedCommand,
|
||||
CommandParameter = view
|
||||
};
|
||||
|
||||
AddGesture(view, gesture);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void AddGesture(View view, TapGestureRecognizer gesture)
|
||||
{
|
||||
view.GestureRecognizers.Add(gesture);
|
||||
|
||||
var layout = view as Layout<View>;
|
||||
|
||||
if (layout == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var child in layout.Children)
|
||||
{
|
||||
AddGesture(child, gesture);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnSelectedItemChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var itemsView = (HorizontalList)bindable;
|
||||
if (newValue == oldValue && newValue != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
itemsView.SelectedItemChanged?.Invoke(itemsView, EventArgs.Empty);
|
||||
|
||||
if (itemsView.SelectedCommand?.CanExecute(newValue) ?? false)
|
||||
{
|
||||
itemsView.SelectedCommand?.Execute(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.Converters
|
||||
{
|
||||
public class BackgroundConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return string.Empty;
|
||||
|
||||
var condition = value.ToString();
|
||||
|
||||
if (condition.Contains("cloud"))
|
||||
return "Images/clouds-background.jpg";
|
||||
else if (condition.Contains("rain"))
|
||||
return "Images/rain-background.jpg";
|
||||
else if (condition.Contains("sun") || (condition.Contains("clear sky")))
|
||||
return "Images/sun-background.jpg";
|
||||
else
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.Converters
|
||||
{
|
||||
public class IconConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return string.Empty;
|
||||
|
||||
var iconType = value.ToString();
|
||||
|
||||
switch(iconType)
|
||||
{
|
||||
case "01n":
|
||||
return "Images/moon.png";
|
||||
case "01d":
|
||||
return "Images/sun.png";
|
||||
case "02n":
|
||||
case "02D":
|
||||
case "04d":
|
||||
return "Images/cloud.png";
|
||||
case "10d":
|
||||
return "Images/rain.png";
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.Converters
|
||||
{
|
||||
public class InverseBoolConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
{
|
||||
throw new InvalidOperationException("The target must be a boolean");
|
||||
}
|
||||
|
||||
return !(bool)value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WeatherApp.Models
|
||||
{
|
||||
public class Coord
|
||||
{
|
||||
[JsonProperty("lon")]
|
||||
public double Longitude { get; set; } = 0;
|
||||
|
||||
[JsonProperty("lat")]
|
||||
public double Latitude { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class Sys
|
||||
{
|
||||
|
||||
[JsonProperty("country")]
|
||||
public string Country { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Weather
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; } = 0;
|
||||
|
||||
[JsonProperty("main")]
|
||||
public string Main { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("icon")]
|
||||
public string Icon { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Main
|
||||
{
|
||||
[JsonProperty("temp")]
|
||||
public double Temperature { get; set; } = 0;
|
||||
[JsonProperty("pressure")]
|
||||
public double Pressure { get; set; } = 0;
|
||||
|
||||
[JsonProperty("humidity")]
|
||||
public double Humidity { get; set; } = 0;
|
||||
[JsonProperty("temp_min")]
|
||||
public double MinTemperature { get; set; } = 0;
|
||||
|
||||
[JsonProperty("temp_max")]
|
||||
public double MaxTemperature { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class Wind
|
||||
{
|
||||
[JsonProperty("speed")]
|
||||
public double Speed { get; set; } = 0;
|
||||
|
||||
[JsonProperty("deg")]
|
||||
public double WindDirectionDegrees { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
public class Clouds
|
||||
{
|
||||
|
||||
[JsonProperty("all")]
|
||||
public int CloudinessPercent { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class WeatherRoot
|
||||
{
|
||||
[JsonProperty("coord")]
|
||||
public Coord Coordinates { get; set; } = new Coord();
|
||||
|
||||
[JsonProperty("sys")]
|
||||
public Sys System { get; set; } = new Sys();
|
||||
|
||||
[JsonProperty("weather")]
|
||||
public List<Weather> Weather { get; set; } = new List<Weather>();
|
||||
|
||||
[JsonProperty("main")]
|
||||
public Main MainWeather { get; set; } = new Main();
|
||||
|
||||
[JsonProperty("wind")]
|
||||
public Wind Wind { get; set; } = new Wind();
|
||||
|
||||
[JsonProperty("clouds")]
|
||||
public Clouds Clouds { get; set; } = new Clouds();
|
||||
|
||||
[JsonProperty("id")]
|
||||
public int CityId { get; set; } = 0;
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("dt_txt")]
|
||||
public string Date { get; set; } = string.Empty;
|
||||
|
||||
[JsonIgnore]
|
||||
public string DisplayDate => DateTime.Parse(Date).Hour.ToString();
|
||||
[JsonIgnore]
|
||||
public string DisplayTemp => $"{MainWeather?.Temperature ?? 0}° {Weather?[0]?.Main ?? string.Empty}";
|
||||
[JsonIgnore]
|
||||
public string DisplayIcon => $"http://openweathermap.org/img/w/{Weather?[0]?.Icon}.png";
|
||||
[JsonIgnore]
|
||||
public string Icon => Weather?[0]?.Icon;
|
||||
}
|
||||
|
||||
public class WeatherForecastRoot
|
||||
{
|
||||
[JsonProperty("city")]
|
||||
public City City { get; set; }
|
||||
[JsonProperty("cod")]
|
||||
public string Vod { get; set; }
|
||||
[JsonProperty("message")]
|
||||
public double Message { get; set; }
|
||||
[JsonProperty("cnt")]
|
||||
public int Cnt { get; set; }
|
||||
[JsonProperty("list")]
|
||||
public List<WeatherRoot> Items { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class City
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("coord")]
|
||||
public Coord Coord { get; set; }
|
||||
[JsonProperty("country")]
|
||||
public string Country { get; set; }
|
||||
[JsonProperty("population")]
|
||||
public int Population { get; set; }
|
||||
[JsonProperty("sys")]
|
||||
public Sys Sys { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WeatherApp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WeatherApp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,78 @@
|
|||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using WeatherApp.Models;
|
||||
using static Newtonsoft.Json.JsonConvert;
|
||||
|
||||
namespace WeatherApp.Services
|
||||
{
|
||||
public enum Units
|
||||
{
|
||||
Imperial,
|
||||
Metric
|
||||
}
|
||||
|
||||
public class WeatherService
|
||||
{
|
||||
const string WeatherCoordinatesUri = "http://api.openweathermap.org/data/2.5/weather?lat={0}&lon={1}&units={2}&appid=fc9f6c524fc093759cd28d41fda89a1b";
|
||||
const string WeatherCityUri = "http://api.openweathermap.org/data/2.5/weather?q={0}&units={1}&appid=fc9f6c524fc093759cd28d41fda89a1b";
|
||||
const string ForecaseUri = "http://api.openweathermap.org/data/2.5/forecast?id={0}&units={1}&appid=fc9f6c524fc093759cd28d41fda89a1b";
|
||||
|
||||
private static WeatherService _instance;
|
||||
|
||||
public static WeatherService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
_instance = new WeatherService();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<WeatherRoot> GetWeatherAsync(double latitude, double longitude, Units units = Units.Imperial)
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var url = string.Format(WeatherCoordinatesUri, latitude, longitude, units.ToString().ToLower());
|
||||
var json = await client.GetStringAsync(url);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
return null;
|
||||
|
||||
return DeserializeObject<WeatherRoot>(json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<WeatherRoot> GetWeatherAsync(string city, Units units = Units.Imperial)
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var url = string.Format(WeatherCityUri, city, units.ToString().ToLower());
|
||||
var json = await client.GetStringAsync(url);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
return null;
|
||||
|
||||
return DeserializeObject<WeatherRoot>(json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<WeatherForecastRoot> GetForecast(int id, Units units = Units.Imperial)
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var url = string.Format(ForecaseUri, id, units.ToString().ToLower());
|
||||
var json = await client.GetStringAsync(url);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
return null;
|
||||
|
||||
return DeserializeObject<WeatherForecastRoot>(json);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using WeatherApp.Models;
|
||||
using WeatherApp.Services;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.ViewModels
|
||||
{
|
||||
public class WeatherViewModel : BindableObject
|
||||
{
|
||||
private bool _isBusy;
|
||||
private string _temp;
|
||||
private string _condition;
|
||||
private WeatherForecastRoot _forecast;
|
||||
private ICommand _reloadCommand;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get { return _isBusy; }
|
||||
set
|
||||
{
|
||||
_isBusy = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Temp
|
||||
{
|
||||
get { return _temp; }
|
||||
set
|
||||
{
|
||||
_temp = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Condition
|
||||
{
|
||||
get { return _condition; }
|
||||
set
|
||||
{
|
||||
_condition = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public WeatherForecastRoot Forecast
|
||||
{
|
||||
get { return _forecast; }
|
||||
set
|
||||
{
|
||||
_forecast = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ReloadCommand =>
|
||||
_reloadCommand ??
|
||||
(_reloadCommand = new Command(async () => await GetWeatherAsync()));
|
||||
|
||||
public async Task GetWeatherAsync()
|
||||
{
|
||||
if (IsBusy)
|
||||
return;
|
||||
|
||||
IsBusy = true;
|
||||
try
|
||||
{
|
||||
WeatherRoot weatherRoot = null;
|
||||
var units = AppSettings.IsImperial ? Units.Imperial : Units.Metric;
|
||||
weatherRoot = await WeatherService.Instance.GetWeatherAsync(AppSettings.Location.Trim(), units);
|
||||
Forecast = await WeatherService.Instance.GetForecast(weatherRoot.CityId, units);
|
||||
var unit = AppSettings.IsImperial ? "F" : "C";
|
||||
Temp = $"{weatherRoot?.MainWeather?.Temperature ?? 0}°{unit}";
|
||||
Condition = $"{weatherRoot.Name}: {weatherRoot?.Weather?[0]?.Description ?? string.Empty}";
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Temp = "Unable to get Weather";
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<NavigationPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WeatherApp.Views.CustomNavigationPage"
|
||||
BarBackgroundColor="{StaticResource AccentColor}"
|
||||
BarTextColor="{StaticResource WhiteColor}"
|
||||
BackgroundColor="Transparent">
|
||||
</NavigationPage>
|
|
@ -0,0 +1,17 @@
|
|||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.Views
|
||||
{
|
||||
public partial class CustomNavigationPage : NavigationPage
|
||||
{
|
||||
public CustomNavigationPage() : base()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public CustomNavigationPage(Page root) : base(root)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WeatherApp.Views.Templates.WeatherItemTemplate">
|
||||
<ContentView.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<Style x:Key="TextStyle" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="Gray" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="IconStyle" TargetType="Image">
|
||||
<Setter Property="Aspect" Value="AspectFit" />
|
||||
<Setter Property="WidthRequest" Value="150" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ContentView.Resources>
|
||||
<ContentView.Content>
|
||||
<Grid
|
||||
WidthRequest="150"
|
||||
Margin="6, 0, 6, 24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Text="{Binding DisplayDate}"
|
||||
Style="{StaticResource TextStyle}"/>
|
||||
<Image
|
||||
Grid.Row="1"
|
||||
Source="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
Style="{StaticResource IconStyle}"/>
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Text="{Binding DisplayTemp}"
|
||||
Style="{StaticResource TextStyle}"/>
|
||||
</Grid>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
|
@ -0,0 +1,12 @@
|
|||
using Xamarin.Forms;
|
||||
|
||||
namespace WeatherApp.Views.Templates
|
||||
{
|
||||
public partial class WeatherItemTemplate : ContentView
|
||||
{
|
||||
public WeatherItemTemplate()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WeatherApp.Views.WeatherView"
|
||||
xmlns:controls="clr-namespace:WeatherApp.Controls;assembly=WeatherApp"
|
||||
xmlns:templates="clr-namespace:WeatherApp.Views.Templates;assembly=WeatherApp"
|
||||
Title="WeatherApp">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<Style x:Key="BackgroundStyle" TargetType="Image">
|
||||
<Setter Property="Aspect" Value="AspectFill" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TempTextStyle" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{StaticResource WhiteColor}" />
|
||||
<Setter Property="FontSize" Value="48" />
|
||||
<Setter Property="Margin" Value="12, 48, 0, 0" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ConditionTextStyle" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{StaticResource WhiteColor}" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Margin" Value="12, 0" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem
|
||||
Icon="Images/reload.png"
|
||||
Text="Reaload"
|
||||
Command="{Binding ReloadCommand}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<ContentPage.Content>
|
||||
<Grid
|
||||
BackgroundColor="{StaticResource WhiteColor}">
|
||||
<Grid
|
||||
RowSpacing="0"
|
||||
IsVisible="{Binding IsBusy, Converter={StaticResource InverseBoolConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="7*" />
|
||||
<RowDefinition Height="3*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
RowSpacing="0"
|
||||
BackgroundColor="{StaticResource AccentColor}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Source="{Binding Condition, Converter={StaticResource BackgroundConverter}}"
|
||||
Style="{StaticResource BackgroundStyle}"/>
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Source="shadow-overlay.png"
|
||||
Style="{StaticResource BackgroundStyle}"/>
|
||||
<Grid
|
||||
Grid.Row="0">
|
||||
<Label
|
||||
Text="{Binding Temp}"
|
||||
Style="{StaticResource TempTextStyle}"/>
|
||||
</Grid>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="{Binding Condition}"
|
||||
Style="{StaticResource ConditionTextStyle}"/>
|
||||
</Grid>
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
Aspect="Fill"
|
||||
Margin="0,-1,0,-1"
|
||||
Source="curve-mask.png"
|
||||
VerticalOptions="End"/>
|
||||
<Grid
|
||||
Grid.Row="1">
|
||||
<controls:HorizontalList
|
||||
ListOrientation="Horizontal"
|
||||
ItemsSource="{Binding Forecast.Items}">
|
||||
<controls:HorizontalList.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<templates:WeatherItemTemplate />
|
||||
</DataTemplate>
|
||||
</controls:HorizontalList.ItemTemplate>
|
||||
</controls:HorizontalList>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<ActivityIndicator
|
||||
IsVisible="{Binding IsBusy}"
|
||||
IsRunning="{Binding IsBusy}"
|
||||
Color="{StaticResource AccentColor}"
|
||||
BackgroundColor="{StaticResource WhiteColor}"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
|
@ -0,0 +1,27 @@
|
|||
using WeatherApp.ViewModels;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace WeatherApp.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class WeatherView : ContentPage
|
||||
{
|
||||
public WeatherView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = new WeatherViewModel();
|
||||
}
|
||||
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
if (BindingContext is WeatherViewModel)
|
||||
{
|
||||
await ((WeatherViewModel)BindingContext).GetWeatherAsync();
|
||||
}
|
||||
|
||||
base.OnAppearing();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2381A53A-9CB7-48A0-967B-FB8919AF8FC7}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WeatherApp</RootNamespace>
|
||||
<AssemblyName>WeatherApp</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AppSettings.cs" />
|
||||
<Compile Include="Controls\HorizontalList\HorizontalList.cs" />
|
||||
<Compile Include="Converters\BackgroundConverter.cs" />
|
||||
<Compile Include="Converters\IconConverter.cs" />
|
||||
<Compile Include="Converters\InverseBoolConverter.cs" />
|
||||
<Compile Include="Models\Weather.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\WeatherService.cs" />
|
||||
<Compile Include="ViewModels\WeatherViewModel.cs" />
|
||||
<Compile Include="Views\CustomNavigationPage.xaml.cs">
|
||||
<DependentUpon>CustomNavigationPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Templates\WeatherItemTemplate.xaml.cs">
|
||||
<DependentUpon>WeatherItemTemplate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\WeatherView.xaml.cs">
|
||||
<DependentUpon>WeatherView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\portable-net45+win8+wp8+wpa81\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Extensions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xamarin.Forms.3.0.0\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Views\Templates\WeatherItemTemplate.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Views\WeatherView.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Views\CustomNavigationPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||
</Target>
|
||||
<Import Project="..\..\packages\Xamarin.Forms.3.0.0\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.3.0.0\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.3.0.0\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.3.0.0\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
<package id="Xamarin.Forms" version="3.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
|
||||
</packages>
|