EntireTeamIsBabies
EntireTeamIsBabies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
I have to be honest and say no. I can look into the code but before I know how to fix it I am 2 hours into the future. It would be a waste of both our sleep. So. Can we pick this up again tomorrow?
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
I am as good as you are. I may just have fixed more things with carefully reading along the way.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
take your time.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
(I'm letting you read quietly in a bit, but I think You are running to fast for your boots) Get the gist of date-time first, then after, learn to condition it.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
One simple instance:
using System;
class Program
{
static void Main()
{
TimeZone zone = TimeZone.CurrentTimeZone;
DateTime local = zone.ToLocalTime(DateTime.Now);
Console.WriteLine("The Local Time is : {0}",local);
Console.ReadLine();
}
}
using System;
class Program
{
static void Main()
{
TimeZone zone = TimeZone.CurrentTimeZone;
DateTime local = zone.ToLocalTime(DateTime.Now);
Console.WriteLine("The Local Time is : {0}",local);
Console.ReadLine();
}
}
this gets the local time.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
-- Please read the contents of this link https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-7.0 It explains a lot about using dates, time and years in C#
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
Code = language
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
I'm sorry for the wordy-ness, but that's part of the territory.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
It just means to say, if this is nearly the only thing in main() then it should be fine. If you can see something that is "conditioning" or "leveraging" the datetime struct otherwise, you get different results.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
or a million other things.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
if some other code says: no this private int _countDown = Completelysomethingelse
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
It should run no matter what, unless your surrounding code dictates other standards.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
listen, I want to help out, but you are hardly giving me any responses to my questions which is kind of killing communication for me.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
Otherwise this program runs and shuts after having count down without no one any the wiser.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
But that timer has to "Click" some other function, right?
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
Like, crudely,
// A couple of variable instances.
private int _countDown = 120; // Seconds
private Timer _timer;

// constructor or load event
_timer = new Timer();
_timer.Tick += new EventHandler(timer_Tick);
_timer.Interval = 1000;
_timer.Start();

//event handler
void timer_Tick(object sender, EventArgs e)
{
_countDown--;
if (_countDown < 1)
{
//120 for 120 seconds, IE 2 minutes
_countDown = 120;
}
lblCountDown.Text = _countDown.ToString();
}
// A couple of variable instances.
private int _countDown = 120; // Seconds
private Timer _timer;

// constructor or load event
_timer = new Timer();
_timer.Tick += new EventHandler(timer_Tick);
_timer.Interval = 1000;
_timer.Start();

//event handler
void timer_Tick(object sender, EventArgs e)
{
_countDown--;
if (_countDown < 1)
{
//120 for 120 seconds, IE 2 minutes
_countDown = 120;
}
lblCountDown.Text = _countDown.ToString();
}
This would be a countdown timer for 120 seconds. (2 minutes)
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
Which is a bit rough for a starter.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
First and foremost, Yes I think it is workable. But I think you are gonna have to deal with threading next to Daytimefunctionality as well.
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
I'm not spoonfeeding you the answers but I can help you out with showing some work. Good?
57 replies
CC#
Created by Lucky_Pepsi_best on 10/21/2023 in #help
❔ Timer
I have to forewarn you I am close to ending my day here but I can give you a bump over the hill, is that good to you?
57 replies