protected override void OnPause() { base.OnPause(); // Always detach handlers OnPause to avoid memory leaks and objects with multple handlers packageListener.OnPackageListUpdate -= UpdatePackages; packageListener.OnPackageListFail -= UpdatePackages; packageListener.OnPackageCancel -= UpdatePackage; packageListener.OnPackageUpdate -= UpdatePackage; packageListener.OnPackageStatusChange -= UpdatePackage; packageListener.OnPackageFail -= UpdatePackage; packageManager.Stop(true); packageListener = null; }
protected override void OnPause() { ContentView.Button.Click -= OnMenuButtonClicked; ContentView.Menu.CityTapped -= OnMenuSelectionChanged; // Always detach handlers OnPause to avoid memory leaks and objects with multple handlers packageListener.OnPackageCancel -= UpdatePackage; packageListener.OnPackageUpdate -= UpdatePackage; packageListener.OnPackageStatusChange -= UpdatePackage; packageListener.OnPackageFail -= UpdatePackage; manager.Stop(true); packageListener = null; base.OnPause(); }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); // Always detach handlers ViewWillDisappear to avoid memory leaks and objects with multple handlers PackageUpdateListener.OnPackageListUpdate -= UpdatePackages; PackageUpdateListener.OnPackageListFail -= UpdatePackages; PackageUpdateListener.OnPackageCancel -= UpdatePackage; PackageUpdateListener.OnPackageUpdate -= UpdatePackage; PackageUpdateListener.OnPackageStatusChange -= UpdatePackage; PackageUpdateListener.OnPackageFail -= UpdatePackage; ContentView.ListSource.CellActionButtonClicked -= OnCellActionButtonClick; packageManager.Stop(true); }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); // Always detach handlers ViewWillDisappear to avoid memory leaks and objects with multple handlers MenuButton.Click -= OnMenuButtonClick; Menu.CityTapped -= OnMenuSelectionChanged; packageListener = new PackageListener(); packageManager.PackageManagerListener = packageListener; packageListener.OnPackageCancel -= UpdatePackage; packageListener.OnPackageUpdate -= UpdatePackage; packageListener.OnPackageStatusChange -= UpdatePackage; packageListener.OnPackageFail -= UpdatePackage; packageManager.Stop(true); }
protected override void OnStop() { base.OnStop(); packageManager.Stop(false); }