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; } }
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; } }
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; } }
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; } }