ocaccy
asked on
C# - Button with time
Button with time to perform the tasks for a period and stop automatically in time configured.
Any idea is welcome.
ocaccy
Any idea is welcome.
ocaccy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not stopping and not delay the execution of the program.
How to play an mp3 of 1.5 seconds here?
ocaccy
How to play an mp3 of 1.5 seconds here?
ocaccy
/// <summary>
/// COUNT 1st time, 2nd time and 3rd time.
/// </summary>
private void timer3_Tick(object sender, EventArgs e)
{
int i_KyuSoku = Convert.ToInt32(nUD_KyuSoku.Value);
int i_RyuSoku = Convert.ToInt32(nUD_RyuSoku.Value);
int i_Seiti = Convert.ToInt32(nUD_Seiti.Value);
int i_2sEstagios = i_KyuSoku + i_RyuSoku;
int i_3sEstagios = i_KyuSoku + i_RyuSoku + i_Seiti;
TimeSpan ts = DateTime.Now.Subtract(inicio);
lbl_crono.Text = (string.Format("{0:00}:{1:00}:{2:00}", (int)ts.TotalHours, ts.Minutes, ts.Seconds));
TimeSpan ts1 = TimeSpan.FromSeconds(i_KyuSoku + 1);
string txtDate1 = string.Format("Full time: {0}", new DateTime(ts.Ticks).ToString("HH:mm:ss"));
TimeSpan ts2 = TimeSpan.FromSeconds(i_RyuSoku + 1);
string txtDate2 = string.Format("Full time: {0}", new DateTime(ts.Ticks).ToString("HH:mm:ss"));
TimeSpan ts3 = TimeSpan.FromSeconds(i_Seiti + 1);
string txtDate3 = string.Format("Full time: {0}", new DateTime(ts.Ticks).ToString("HH:mm:ss"));
TimeSpan ts22 = TimeSpan.FromSeconds(i_2sEstagios + 1);
//string txtDate3 = string.Format("Full time: {0}", new DateTime(ts.Ticks).ToString("HH:mm:ss"));
TimeSpan ts33 = TimeSpan.FromSeconds(i_3sEstagios);
//string txtDate3 = string.Format("Full time: {0}", new DateTime(ts.Ticks).ToString("HH:mm:ss"));
if (ts <= ts1)
{
label152.Visible = false;
label153.Visible = false;
label154.Visible = false;
label155.Visible = false;
label151.Visible = true;
}
if (ts > ts1 && ts <= ts22)
{
label151.Visible = false;
label152.Visible = true;
}
if (ts > ts1 && ts > ts22 && ts <= ts33)
{
// i see one stop in the flow with this:
DateTime stopTime = DateTime.Now.AddSeconds(2);
while (stopTime > DateTime.Now)
{
System.Media.SystemSounds.Beep.Play();
// Not stopping and not delay the execution
// of the program.
// How to play an mp3 of 1.5 seconds here?
}
label151.Visible = false;
label152.Visible = false;
label153.Visible = true;
label154.Visible = true;
}
if (ts > ts33)
{
timer3.Stop();
timer_10.Stop();
label151.Visible = false;
label152.Visible = false;
label153.Visible = false;
label154.Visible = false;
label155.Visible = true;
//timer_10.Enabled = true;
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I still do not know how to use, so I put the code as the previous model.
I have a time routine.
Also has an alarm sound with duration of 1.5 seconds.
This format mpe3, but can transform to wav.
When give a x time, I want to play this sound, but I want to continue running normally.
I have a time routine.
Also has an alarm sound with duration of 1.5 seconds.
This format mpe3, but can transform to wav.
When give a x time, I want to play this sound, but I want to continue running normally.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, but, how to this sound play only one time?
As I did, every second restart, and processing delays.
As I did, every second restart, and processing delays.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
sorry for the confusion.
I want to play a file of 1.5 seconds, just one time.
sorry for the confusion.
I want to play a file of 1.5 seconds, just one time.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, I put the play alone in another condition.
ASKER
If I need 10 minutes,
This is OK?
Open in new window