private void removeSapaListeners() { if (mSapaAppService != null) { mSapaAppService.removeAppStateListener(this); mSapaAppService.removeConnectionListener(this); } }
internal virtual void setSapaAppService(SapaAppService sapaAppService, string mainAppPackageName) { Log.d(TAG, "setSapaservice " + sapaAppService); SapaAppService previous = this.mSapaAppService; this.mSapaAppService = sapaAppService; if (sapaAppService != null) { mInfo.mMainApplicationPackage = mainAppPackageName; this.mSapaAppService.addConnectionListener(this); this.mSapaAppService.addAppStateListener(this); if (Context != null) { try { ((Activity)Context).runOnUiThread(() => { lock (ControlBar.this) { ControlBar.this.initializeActions(); ControlBar.this.updateBar(); ControlBar.this.fillBar(); } }); } catch (System.NullReferenceException) { ; } } ; } else if (previous != null) { previous.removeConnectionListener(this); previous.removeAppStateListener(this); } }