Ok, I hope this code helps a bit to understand what I'm trying to achieve:
namespace AudioCuesheetEditor
.AudioBackend{ public class AudioManagerSFML
: AudioManager
{[...]private bool checkAndPlayMusic
(TimeSpan offset
) { log
.debug("checkAndPlayMusic called with " + offset
); bool playing
= false; //Always set the music, because the user might have changed it this.setMusic(); if (this.music != null) { this.music.PlayingOffset = offset
; this.music.Play(); Timer tUpdateGUI
= new Timer
(1000); tUpdateGUI
.Elapsed += delegate(object sender, ElapsedEventArgs e
) { log
.debug("updateGUI"); Gtk
.Application.Invoke(delegate { this.objProgram.getObjMainWindow().updateAudiodataOnGUI(); }); if ((this.getPlayState() == PlayState
.Paused) || (this.getPlayState() == PlayState
.Stopped)) { this.stop(); } }; tUpdateGUI
.AutoReset = true; tUpdateGUI
.Start(); playing
= true; } return playing
; }[...] }} public partial class MainWindow : Gtk.Window
{
[...]
public void updateAudiodataOnGUI()
{
this.entAudiofilePosition.Text = this.objProgram.getAudioManager().getPosition().ToString();
}
[...]
}
First enter of checkAndPlayMusic works fine, the music starts, the function gets called, and the log messages come. If I want to use this.music.pause(), it doesn't react, the breakpoint is never reached. Any ideas, why?