Skip to content

mxsxs2/UWP-Weather-App-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UWP-Weather-App-Project

Weather app project for MOBILE APPLICATIONS DEVELOPMENT 2 College module. The project was created in Visual Studio 2017

What is it?

A Universal Windows Platform(UWP) application written in C#. The purpose of this app is to show weather details to the user. It is using Accuweather.com API to get the latest weather information.

Why will the user open this app for a second time?

It is a very simple application that shows only the most important details of weather, like temperatures daily forecast and hourly forecast. To switch between two cities is only one click, where in most weather applications it takes 2-5 clicks to check other saved city's weather.

Layout

When the app is first opened there is only a plus button is visible at the top left corner. When the button is pressed a Flyout appears at the middle of the screen. This Flyout contains the city adding options.

The user has two ways to find a city, either by typing it to the text field or by clicking on the "Use My Location" button. Either way if there was any result, it will appear in a ListView under the search input. Once a city is clicked in the list view, it is added to the saved cities.

If there is any city added, it appears before the plus sign. When there is more cities are added, always the first one is the default. The default city's forecast will be loaded first when the application is loaded, the rest will be loaded only when they are clicked.

A settings icon is placed at the right top corner of each city tile. When this icon is tapped, a little FlyoutPresenter appears under the icon with three options:

  • Set as default - Will move the city to the begining of the list
  • Remove - Will remove all data from the city after it is confirmed by the user
  • Close - Closes the flyout presenter


At the bottom of the application is a status bar. * Left side is a clickable Privacy Policy link * The middle is the last updated status, so the user always knows when the weather data was loaded * Right side is the server connection status. If there is a circle going around then it is loading. If there is an earth icon in a red circle, then the data could not be loaded form the server.

How it works

Weather data collection

There is a one class which handles all the HTTP request to accuweather.com.
Free account members can only access:

  • Current weather
  • 5 days forecast
  • 12 hours forecast
  • Location services Also there is a limitation of 50 request per day, so when the limit is reached the app will stop loading any weather data and location data. The weather data will be loaded form the local storage.


Each request type has its own method to assemble the http link. This http link is passed to a shared private method which calls the server and parses the result to a JSON object with the aid of NewtenSoft's JSON parser. This json object is returned back to the UI.

LocalStorage

LocalStorage is used to store the previously loaded weather data to ensure there is always something to show in the UI even when there is no internet connection.

The local storage is managed by a dedicated class. This class has functions to add city, save city, remove city and set a city to default.
If the storage file is not created yet, an algorithm will create one. Otherwise it will use the original file.

UI

Most of the UI is generated programatically as the city tiles, hourly forecast and daily forecast is generated by for loops. The main layout of the application is Grid based. This grid is filled up be the for loops.

Models

Each HTTP reqest's JSON result has it's own model.

About the code in general

Each algorithm is designed to be as small as possible and to serve only one purpose. The biggest design decison was to use function callbacks as I prefer the usage of them even if they make the code a bit less easily readable.

References

Resource References

About

Weather app project for MOBILE APPLICATIONS DEVELOPMENT 2 College module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published