C# Weather App (Help please)...

I'm trying to develop a very simple C# application that should be able to tell the user the current temperature using the zip-code or city name. I don't have any knowledge on how XML works. I can only work with C#. So can someone please guide me with this.
I've looked everywhere and the codes involve really complex methods. I just want the temperature for the user in a few lines of code if possible.
Thank you!

Here is code to serialize and deserialize the data.  There are lot of methods to read and write XML.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.IO;
namespace WindowsFormsApplication1
public partial class Form1 : Form
const string FILENAME = @"c:\temp\test1.xml";
Current current = null;
public Form1()
InitializeComponent();
current = new Current()
city = new City()
name = "London",
id = 2643743,
coord = new Coord() { lat = 51.51, lon = -0.13 },
country = "GB",
sun = new Sun() { set = DateTime.Parse("2015-02-09T17:04:38"), rise = DateTime.Parse("2015-02-09T07:24:47") }
temperature = new Temperature() { value = 275.75, unit = "kelvin", max = 275.75, min = 275.75}
XmlSerializer serializer = new XmlSerializer(typeof(Current));
StreamWriter writer = new StreamWriter(FILENAME);
serializer.Serialize(writer, current);
writer.Flush();
writer.Close();
writer.Dispose();
XmlSerializer xs = new XmlSerializer(typeof(Current));
XmlTextReader reader = new XmlTextReader(FILENAME);
Current readCurrent = (Current)xs.Deserialize(reader);
[Serializable, XmlRoot("Current")]
public class Current
public City city {get;set;}
public Temperature temperature { get; set; }
[XmlRoot(ElementName = "city")]
public class City
[XmlAttribute("name")]
public string name {get;set;}
[XmlAttribute("id")]
public int id {get;set;}
public Coord coord { get; set; }
public string country { get; set; }
public Sun sun { get; set; }
[XmlRoot(ElementName = "coor")]
public class Coord
[XmlAttribute("lat")]
public double lat {get;set;}
[XmlAttribute("lon")]
public double lon {get;set;}
[XmlRoot(ElementName = "sun")]
public class Sun
[XmlAttribute("set")]
public DateTime set {get;set;}
[XmlAttribute("rise")]
public DateTime rise {get;set;}
[XmlRoot(ElementName = "temperature")]
public class Temperature
[XmlAttribute("value")]
public double value { get; set; }
[XmlAttribute("unit")]
public string unit { get; set; }
[XmlAttribute("max")]
public double max { get; set; }
[XmlAttribute("min")]
public double min { get; set; }
jdweng

Similar Messages

  • Hotmail set up with Mail app. help please

    Can anyone please tell me what I need to put in the following boxes:
    Account type:
    Incoming mail server:
    Outgoing mail server:
    I tried setting this up on entourage but it's asking me to subscribe to the premium account.
    I'm now trying to set it up on the mail account with no joy. At this rate the wife is going to make us go back to the PC... Help!

    You need to install the HTTPMail plugin.
    It seems to not work for some hotmail accounts. If your account is one of those, there is as yet no work around as far as I know, except maybe using MacFreePOPs

  • Re Downloading apps help please

    Hi, I have a nokia 5530 XM. I t had a few troubles at the beginning so i had to format the memory card and it's fine now. But i've lost all my apps and i go to the store to re download them but the download button is darker and it wont let me re download them any ideas on how to do this ?

    Livclair wrote:
    I know I have only about 13Mb left of storage
    You need to make more room on the Device for it to work as expected.
    See Here  >   http://osxdaily.com/2013/07/24/remove-data-storage-iphone-ipad/

  • Photo App help please

    macbook pro - is there app for photos that will keep my tags i.e. some historical tags,  sub folders, correct dates scanned initially onto windows computer which will allow me to do some basic editing. Nothing too technical...thanks Belinda

    macbook pro - is there app for photos that will keep my tags i.e. some historical tags,  sub folders, correct dates scanned initially onto windows computer which will allow me to do some basic editing. Nothing too technical...thanks Belinda

  • IPad App HELP PLEASE :@)

    I have an iPad 2 and tried to update my apps today.  I hit update all and everything froze.  I reset the ipad a couple of times and it is still locked up with waiting under all of the app icons that were to be updated...what do i do now?
    Thanks!

    Try and update apps using iTune. See bottom right on picture attached.
    http://i1224.photobucket.com/albums/ee374/Diavonex/8afe4ddede4f4fabb4e819174239d df4.jpg

  • Trying to find a specific app - help please!

    i am looking for an app, i have searched and searched but there are so many out there, i know someone has had to come up with this, i want an app that will child proof my phone. that will lock out most everything but the games. I have a 2 yr old that loves my phone but calls people and stuff. Is there an easier way to search? i did child or kid and there are SOOO many

    You can stop looking, there is no app that will do what you want.
    If you want to suggest this to Apple, go here: http://www.apple.com/feedback/iphone.html

  • USB Mics, Sampling Rates and "dumb" apps--help please

    I hope someone here can explain this better than the support people at Blue did.
    I have a Blue Yeti USB mic. It has a fixed output of 16 bits/ 48kHz. In most recording apps, I can set the sample rate in the app to match at 48kHz. What happens when using this mic with a "dumb" app like Camfrog or Skype, where the user cannot set a matching sample rate in the app? Will the pitch be affected due to the 48 kHz fixed rate of the mic, as opposed to a more common 44.1 kHz?
    Any insight into this would be great. I could ask people on Camfrog if my voice sounds right, but they don't know what my normal voice sounds like!
    Thank you.

    Darn.  Not being able to type at login sounds like an issue mine has every so often, although if you don't log in RIGHT AWAY on mine, you have to force it down and restart because when you type, it pinwheels and never stops.  Mine also hasn't been able to restart or shutdown so I haven't been able to apply updates.

  • My weather app is telling me it's 17 degrees and I live in Phoenix Az. Please help

    MY weather app is not displaying the correct weather. It's telling me it's 17 degrees out and I live in Phoenix Arizona. Any suggestions?

    Check the settings, it might be on Celsius and not Fahrenheit.

  • HT1766 The weather app is no longer working  Help please?

    The Weather app just stopped working yesterday.  Nothing was changed... to my knowledge.
    Has anyone else experienced this problem?  If so, what did you do to correct it?
    Thank you,
    Tim

    Basics from the manual are restart, reset, restore.  Have you done ANY trobleshooting yet?

  • I have an ipone how do i get rid of yahoo weather for a new one in the notification swipe down screen, cause i download from apple apps and false advertising i want a weather app that is good with a widget. simple. please let me know of a good one to inst

    is there an weather app that will work on the iphone beside yahoo please in the notification swipe, cause i download apple weather apps and they dont work that not right that money i paid, just want an weather app that will work with the iphone, telus is trying to help as well cause they should work but DON"T.
    please dont erase a message that is true on finding something that might work.

    No matter how many times you ask this question, the answer is going to be the same.
    You can submit feedback to Apple here:
    http://www.apple.com/feedback

  • Remote App on iPad connects but drops after about  20 mins. Need to turn  off wait about 1 minute then turn on wifi on iMac before it can reconnect. Need some help please.

    Remote App on iPad connects but drops after about  20 mins. Need to turn  off wait about 1 minute, then turn on wifi on iMac before it can reconnect. Need some help please.
    Already gone through troubleshooting guide a zillion times. Thanks.

    This worked for me... A little time consuming but once you get rolling it goes GREAT... Thanks....
    I got my artwork and saved it to my Desktop
    Opened up Microsoft Paint and clicked on "File" and "Open" and found it to get it on the screen to resize it
    Clicked "resize" and a box for changing it opened up
    Checked the box "Pixels" and "Unchecked maintain aspect ratio"
    Set Horizontal for 640 and Vertical for 480
    Clicked on "OK" and went back to "File" and did a "Save As" and chose JPEG Picture
    It came up "File Already Existed" and clicked "OK" (really did not care about the original artwork I found because wrong size)
    Went to iTunes and on the movie right clicked on "Get Info", clicked on "Details", then "Artwork"
    Go to the little box on the top left that shows your old artwork and click on it to get the little blue border to appear around it and hit "Delete" to make it gone
    Click on "Add Artwork" and find it where you put the one from above on your Desktop and hit "Open" and OK and your new artwork is now there and all good.
    Sounds like a lot of steps to follow but after around 5 or so you will fly through it. This worked perfect on my iPhone 6 Plus and I have artwork on my Home Videos now.

  • Trouble downloading apps! Please help :(

    I am trying to download apps to my iphone, it keeps telling me that verification is required, when I put in my password, it says "can't verify address", however when I sign in on my computer's itunes it has no problems. HELP please!

    I am, unless the formatting is different? I put the exact same info as I do in my itunes on my laptop and it's not working. Hopefully I'm just missing one minor detail? Is there a trick to how there are 2 address lines? (I am using my debit card)
    and yes...I'm getting very irritated. Just bought the phone today and wondering if I made a mistake!! lol
    UPDATE: thank you for your advise!! It was as simple as removing the dash between my city...CRAZY!  winston-salem and they wanted winston salem....ugh
    Message was edited by: greeneyesandmore

  • I by mistake chose to insall the weather app for Firefox on Apple iMac. I cannot uninstal from add ons since firefox crashes before then. Unable to use Firefox in safe mode. Help!

    Basically I recently installed Firefox 3.6 on my Mac Laptop, only 3-4 months old, so latest Sea Leopard OSX System whatever
    Anyway once installed I decide to have a theme, then add some add on applications. This seems to be the problem
    When I first tried to run it all the apps opened home pages and I kept trying to close them as they did
    Next time I got less pages but then I could not access the Tools>AddOns menu before the Firefox browser crashed
    What seems to be happening is that the Weather app takes forever to load, my Apple Mac goes into the circle (thinking) mode which means I cannot activate any menus or move my mouse. Then by the time I try and type in say google in the blank www URL address the browser crashed. I have tried going into safe mode using the Option but makes no difference
    If I can somehow instal the irksome weather app or get access to the Tool >Add ons menu and uninstall each of the several apps I have daftly installed I know I can get a solution
    Any help or suggestions appreciated since I still think Firefox is cool:-). its the apps or some of them that suck!

    Maybe you did't understand my previous statement. There are no crashes in FF 3.6, There is no previous evidence FF 14 was ever here, I completely uninstalled all trace of Firefox, no app data, no preferences, no cache. I will upgrade to FF14 so I can send IDs,
    so here ya go.
    Crash ID: bp-fa9da320-92dc-47f7-afff-33e702120718
    AdapterDeviceID: 0x2a02
    AdapterVendorID: 0x8086
    Add-ons: {972ce4c6-7e08-4474-a285-3208198ce6fd}:14.0.1
    BuildID: 20120713134347
    CrashTime: 1342655269
    EMCheckCompatibility: true
    Email: [email protected]
    FramePoisonBase: 7ffffffff0dea000
    FramePoisonSize: 4096
    InstallTime: 1342655256
    Notes: AdapterVendorID: 0x8086, AdapterDeviceID: 0x2a02GL Context? GL Context+ GL Layers? GL Layers+
    ProductID: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
    ProductName: Firefox
    ReleaseChannel: release
    StartupTime: 1342655256
    Theme: classic/1.0
    Throttleable: 1
    URL: http://www.mozilla.org/en-US/firefox/14.0.1/whatsnew/?oldversion=rv:1.9.2.13
    Vendor: Mozilla
    Version: 14.0.1
    This report also contains technical information about the state of the application when it crashed.

  • I bought new Macbook Pro 13" around two months before .My Apple ID is working on all other things except app store . It is buffering for a lot of time and lastly coming on screen " can not connect to app store " Please help me

    I bought new Macbook Pro 13" around two months before .My Apple ID is working on all other things except app store . It is buffering for a lot of time and lastly coming on screen " can not connect to app store " Please help me

    Have you tried repairing disk permissions : iTunes download error -45054

  • HT204266 Hi, I have a problem with my app store. It doesn't open. Can you help please ?

    Hi, I have a problem with my app store. It doesn't open. Can you help please ?

    Morning lekogni,
    Thanks for using Apple Support Communities.
    For troubleshooting on this, take a look at this article:
    Mac OS X: How to troubleshoot a software issue
    http://support.apple.com/kb/ht1199
    For more information on this, take a look at this article:
    Troubleshooting the Mac App Store
    http://support.apple.com/kb/ts3624
    Best of luck,
    Mario

Maybe you are looking for

  • How to delete Init flag in a  process chain, before processing the init

    Hi, At the end of the week i need to re-execute the init request from ODS1 to ODS2. Therefore, i have to delete the init flag first and the requests in the CUBE1, everything automatically in the process chain. The schedule must be as follow : 1. Dele

  • CNPJ Number Configuration

    Hi All, I need to configure CNPJ number for the new plant, I have a doubt on this, CNPJ number have following format , 12.345.678./0001-96 and these digits represent three distinct elements: 12.345.678. - The first eight digits refer to the company r

  • BIOS COMPATIBLE MODE -LENOVO G560

    Hello, BIOS COMPATIBLE MODE -LENOVO G560 What is that ------COMPATIBLE MODE -------IN BIOS Settings for SATA CONTROLLER MODE IS IT FOR 32 bit & 64 bit Applications & OS ?? Can I Install Windows 7(32/64)  and Microsoft Office XP on that Are there any

  • UML Modeling Tool Suggestions?????

    My group is in need of an inexpensive but good "UML Modeling Tool". We are currently looking at a tool ( Enterprise Architect ) that produces use case diagrams, object model diagrams and will produce stubs from the diagrams and will also reverse engi

  • Pre-populate and post populate fields

    What is the difference between pre-populate and post populate fields. How we test the pre-populate and post populate fields.