示例#1
0
 public WmpMonitor()
 {
     state = MonitorState.Starting;
     try {
         try {
             player = new RemotedWindowsMediaPlayer();
             player.CreateControl();
             wmp = player.GetOcx() as WindowsMediaPlayer;
             state = MonitorState.Started;
         }
         catch (Exception e) {
             errorMessage = "Error contacting player: " + e.Message;
             state = MonitorState.Error;
             return;
         }
     }
     catch (Exception e) {
         errorMessage = "Error starting monitor: " + e.Message;
         state = MonitorState.Error;
         //throw e;
     }
 }
示例#2
0
 public override void Stop()
 {
     try
     {
         lock (lckThread)
         {
             quit = true;
         }
         checkPosThread.Join();
         wmp = null;
         player = null;
         state = MonitorState.NotStarted;
     }
     catch (COMException)
     {
         // application is busy... nothing we can do... just wait, when it will become available again
     }
     catch (Exception e)
     {
         Log.Write(e);
         errorMessage = "Error stopping monitor: " + e.Message;
         state = MonitorState.Error;
     }
 }
示例#3
0
 public void Stop()
 {
     try {
         quit = true;
         wmp = null;
         player = null;
         state = MonitorState.NotStarted;
     }
     catch (COMException) {
         // application is busy... nothing we can do... just wait, when it will become available again
     }
     catch (Exception e) {
         errorMessage = "Error stopping monitor: " + e.Message;
         state = MonitorState.Error;
     }
 }
示例#4
0
 public override void Start()
 {
     try
     {
         state = MonitorState.Starting;
         try
         {
             player = new RemotedWindowsMediaPlayer();
             player.CreateControl();
             wmp = player.GetOcx() as WindowsMediaPlayer;
         }
         catch (Exception e)
         {
             Log.Write(e);
             errorMessage = "Error contacting player: " + e.Message;
             state = MonitorState.Error;
             return;
         }
         checkPosThread.Start();
     }
     catch (Exception e)
     {
         Log.Write(e);
         errorMessage = "Error starting monitor: " + e.Message;
         state = MonitorState.Error;
         //throw e;
     }
 }