3 Replies - 6559 Views - Last Post: 03 February 2012 - 08:36 AM

#1 Sletner91  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-February 12

Help with code for WP7 Timer.

Posted 03 February 2012 - 07:30 AM

Hello.
I'm making a app for WindowsPhone7 that is supposed to assist you at the kitchen. This will include a timer, counting down from X minutes(Whatever i want it to be. But only changeable in the sourcecode).

Eks: Food ready in:

11:47 (minutes:seconds)

I'm very new to C# so i'll need some help with a code i got. This code is from a MinutesToMidnight app. That count down to midnight. So i guess there is only a few things i have to change to have it count down the way i want it to?
Can someone please edit this code for me so it will work? thanks.
I use visual studio.

http://pastebin.com/uRyWCgms

Is This A Good Question/Topic? 0
  • +

Replies To: Help with code for WP7 Timer.

#2 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Help with code for WP7 Timer.

Posted 03 February 2012 - 07:33 AM

The trick here would be to figure out how the current code determines how far away from midnight it currently is. Once you can figure that out, you should easily be able to figure out how far away from any time it currently is.
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5571
  • View blog
  • Posts: 11,908
  • Joined: 02-June 10

Re: Help with code for WP7 Timer.

Posted 03 February 2012 - 07:41 AM

Quote

counting down from X minutes(Whatever i want it to be. But only changeable in the sourcecode).


Why would you possibly do this? Who is going to use a kitchen timer where the developer hard codes the duration?

I have an app like this for my iPhone that has 6 burner timers, each settable. It keeps me from forgetting the meat out on the grill while I have something on the stove. Just a hint so you can be thinking about modular coding.

Kilorn is right that we aren't going to tear apart the sample code for you, then explain it all to you. But you have the right idea. Doing that sort of thing is a great way to learn how someone more experienced than yourself approached a project. Pay attention to lines 31-37 in that code.

If everything you are looking at there is gibberish, you might not yet be ready to build from scratch. Maybe you should do more lessons first.


Newbie/Rookie said:

I have a little programming experience but I need to write ...


You need to start there. I can't say "I have little experience in speaking Russian, but I have been assigned to write a mystery novel in Russian. Can you help me?"

We can help you by saying "First learn basic programming and the language of C#. Then take on assignments." Could someone here write this program for you? Sure. Could someone here map out all the processes you need to follow and do the Software Design part of this in the slim hope you could code it from there? Sure. But we don't volunteer to do the job that you're either getting paid for, or getting a grade for. You may want to read this.

For now, just work on the lessons. Do a self-teaching book from cover to cover. Then consider writing a program.

Don't try to create a useful working program to fit a need of yours (or a for-pay contract) as your introduction to coding project. When you are learning to code you don't know enough to code a program, let alone know how to engineer the architecture of a program. It would be like saying "I don't know how to read sheet music, or play an instrument. I think I'll write a 3 act opera as my first learning experience."

I don't say this to be mean. We've seen lots of new coders take this approach and we know it doesn't work. Trying to design your own programs before you understand the basics of the code language you've chosen just leads to problems, frustrations, and 'swiss-cheese' education (lots of holes).


Resources, references and suggestions for new programmers. - Updated Jan 2012
Spoiler

Was This Post Helpful? 0
  • +
  • -

#4 Sletner91  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-February 12

Re: Help with code for WP7 Timer.

Posted 03 February 2012 - 08:36 AM

Ok, thanks for the help. The reason why im asking so specific is that i am going to be a webdesigner. I dont care much of C, Java and so on. So i use Expression Blend to make these apps for a friend, the program writes the codes for me. But, its very limited. And for this one i need the timer, so i was trying to understand C# with my experience with Java.

The reason i want it to be developer changeable only, is that the app is a list of different items we eat alot where im from, and each item on that list has a own timer that is set to how long it needs to cook. So the user only have to click start and wait.

Thanks alot:)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1