Click here to Skip to main content
15,891,513 members
Home / Discussions / C#
   

C#

 
AnswerRe: Use DLL in C# Pin
kalberts2-May-20 4:40
kalberts2-May-20 4:40 
QuestionCan not compare a file and same file stored in mysql - sha256 Pin
wilcodk29-Apr-20 7:40
wilcodk29-Apr-20 7:40 
AnswerRe: Can not compare a file and same file stored in mysql - sha256 Pin
Luc Pattyn29-Apr-20 8:07
sitebuilderLuc Pattyn29-Apr-20 8:07 
GeneralRe: Can not compare a file and same file stored in mysql - sha256 Pin
wilcodk30-Apr-20 1:32
wilcodk30-Apr-20 1:32 
AnswerRe: Can not compare a file and same file stored in mysql - sha256 Pin
Mycroft Holmes29-Apr-20 12:18
professionalMycroft Holmes29-Apr-20 12:18 
GeneralRe: Can not compare a file and same file stored in mysql - sha256 Pin
wilcodk30-Apr-20 1:28
wilcodk30-Apr-20 1:28 
AnswerRe: Can not compare a file and same file stored in mysql - sha256 Pin
Eddy Vluggen30-Apr-20 6:34
professionalEddy Vluggen30-Apr-20 6:34 
QuestionCompare string time to timer time (noobie) Pin
Member 1481029228-Apr-20 5:36
Member 1481029228-Apr-20 5:36 
Hello, I'm new to the forum and new to C# and programming in general so any help with this is appreciated.

I have two arrays of strings. sTime holds the string TimePosition and the second holds a text string.
I have an Audio file playing using mediaPlayer.
I am trying to sample the mediaPlayer position to trigger an event when it reached a desired time.
There will be multiple sTimes that will be at random positions throughout the Audio File.
Each time the mediaPlayer.position compares to the sTime it will display the text string associated with the sTime.

Think Teleprompter or Karaoke Player.

I think mediaPlayer is not robust enough the capture every millisecond to compare, so I miss the event.
I could try comparing to see if position is greater or equal to 10.000 but I'll miss 10.678 but this code never triggers the MessageBox.

It also would be more efficient if I knew how to capture the mediaPlayer.position directly and compare it to a variable without all the wasted conversion time. But I don't.

Thanks for any help.

lblLength.Content = mediaPlayer.NaturalDuration.TimeSpan.TotalSeconds;
mediaPlayer.Play();

When the mediaPlayer.position
string Position = String.Format("{0:r}", mediaPlayer.Position.TotalSeconds);

void timer_Tick(object sender, EventArgs e)
{
if (mediaPlayer.Source != null)
{
lblStatus.Content = mediaPlayer.Position.TotalSeconds;
var ucontent = lblStatus.Content;
string eTime = ucontent.ToString();
string tTime;
tTime = "10.000";

if (String.Equals(eTime, tTime))
{
MessageBox.Show("position = " , eTime);
}

}

else
lblStatus.Content = "No file selected...";
}
AnswerRe: Compare string time to timer time (noobie) Pin
Gerry Schmitz28-Apr-20 6:48
mveGerry Schmitz28-Apr-20 6:48 
QuestionResize and move a drawn rectangle in win forms Pin
Member 1223285027-Apr-20 12:23
Member 1223285027-Apr-20 12:23 
AnswerRe: Resize and move a drawn rectangle in win forms Pin
Luc Pattyn27-Apr-20 13:17
sitebuilderLuc Pattyn27-Apr-20 13:17 
GeneralRe: Resize and move a drawn rectangle in win forms Pin
Member 1223285027-Apr-20 19:38
Member 1223285027-Apr-20 19:38 
GeneralRe: Resize and move a drawn rectangle in win forms Pin
Luc Pattyn28-Apr-20 4:50
sitebuilderLuc Pattyn28-Apr-20 4:50 
GeneralRe: Resize and move a drawn rectangle in win forms Pin
Member 1223285028-Apr-20 17:56
Member 1223285028-Apr-20 17:56 
GeneralRe: Resize and move a drawn rectangle in win forms Pin
Luc Pattyn29-Apr-20 2:30
sitebuilderLuc Pattyn29-Apr-20 2:30 
QuestionDate compare Pin
Carlos5827-Apr-20 10:42
Carlos5827-Apr-20 10:42 
AnswerRe: Date compare Pin
Luc Pattyn27-Apr-20 11:00
sitebuilderLuc Pattyn27-Apr-20 11:00 
GeneralRe: Date compare Pin
Carlos5827-Apr-20 12:31
Carlos5827-Apr-20 12:31 
GeneralRe: Date compare Pin
Luc Pattyn27-Apr-20 12:48
sitebuilderLuc Pattyn27-Apr-20 12:48 
GeneralRe: Date compare Pin
Carlos5828-Apr-20 2:19
Carlos5828-Apr-20 2:19 
GeneralRe: Date compare Pin
Luc Pattyn28-Apr-20 2:24
sitebuilderLuc Pattyn28-Apr-20 2:24 
SuggestionRe: Date compare Pin
Richard Deeming28-Apr-20 0:40
mveRichard Deeming28-Apr-20 0:40 
AnswerRe: Date compare Pin
Carlos5828-Apr-20 2:23
Carlos5828-Apr-20 2:23 
QuestionRename files in WinScp Directory using C# Pin
Sriram Valluri27-Apr-20 1:13
Sriram Valluri27-Apr-20 1:13 
AnswerRe: Rename files in WinScp Directory using C# Pin
ZurdoDev27-Apr-20 1:21
professionalZurdoDev27-Apr-20 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.