public void MPEI_OnConfigurationChanged(string guid) { // Check if message is for us if (guid == this.Guid) { Log.Debug("CecRemote: Settings changed from Extensions plugin, updating configuration."); _config = null; PrepareClient(); _client.LoadConfig(); } }
public void Stop() { Log.Info("CecRemote: Closing connection to client..."); if (_client == null) { Log.Info("CecRemote: Client already closed. Plugin exit."); return; } _client.OnStop(); _client = null; _config = null; Log.Info("CecRemote: Plugin exit."); }
public CecSettings() { // Read MediaPortal config _config = new CecConfig(); try { _config.ReadConfig(); } catch (Exception exp) { MessageBox.Show("Error while reading configuration from MediaPortal.xml" + exp.ToString()); } InitializeComponent(); AddBindings(); }
private void PrepareClient() { if (_client == null) { _client = new CecRemoteClient(); } if (_config == null) { _config = new CecConfig(); try { _config.ReadConfig(); _client.SetConfig(_config); } catch (Exception ex) { Log.Error("CecRemote: Error while reading config. " + ex.ToString()); // Defaults will be used automatically if config reading fails, so we can still try to connect. } } }
public CecConfig(CecConfig conf) : base((CecConfigBase)conf) { }
private void HandleResume(bool automatic) { if (_sleep) { _sleep = false; _away = false; // DeInitialize when resuming to make sure client is prepared properly. if (_client != null) { _client.DeInit(); _client = null; } } if (_client == null) { _config = null; PrepareClient(); } if (automatic) { Thread resumeThread = new Thread(new ThreadStart(_client.OnResumeByAutomatic)); resumeThread.Name = "CECResA"; resumeThread.Start(); } else { Thread resumeThread = new Thread(new ThreadStart(_client.OnResumeByUser)); resumeThread.Name = "CECResU"; resumeThread.Start(); } }