protected override void Dispose(bool disposing) { base.Dispose(disposing); if (!_disposed) { if (_message != null) { _message.Dispose(); } _message = null; if (_indicator != null) { _indicator.Dispose(); } _indicator = null; if (_progress != null) { _progress.Dispose(); } _progress = null; _disposed = true; } }
public override void ViewDidUnload() { base.ViewDidUnload(); ReleaseDesignerOutlets(); slider.ValueChanged -= HandleValueChanged; slider.Dispose(); slider = null; progress.Dispose(); progress = null; normalButton.Dispose(); normalButton = null; pressedButton.Dispose(); pressedButton = null; label.Dispose(); label = null; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (plainButton != null) { plainButton.Dispose(); plainButton = null; } if (slider != null) { slider.Dispose(); slider = null; } if (progress != null) { progress.Dispose(); progress = null; } }
private void UpdateUI() { if (BookshelfBook.Status == Book.BookStatus.DOWNLOADED || BookshelfBook.Status == Book.BookStatus.ISUPDATE) { if (downloadSpinner != null) { downloadSpinner.StopAnimating(); downloadSpinner.RemoveFromSuperview(); downloadSpinner.Dispose(); downloadSpinner = null; } if (downloadLabel != null) { downloadLabel.RemoveFromSuperview(); downloadLabel.Dispose(); downloadLabel = null; } if (progressView != null) { progressView.RemoveFromSuperview(); progressView.Dispose(); progressView = null; } // bookInfoView if (bookInfoView == null) { UpdateBookInfo(); } if (BookshelfBook.Status == Book.BookStatus.DOWNLOADED) { // descriptionLabel if (descriptionLabel == null) { descriptionLabel = eBriefingAppearance.GenerateLabel(14, eBriefingAppearance.Gray2); descriptionLabel.Frame = new CGRect(10, titleLabel.Frame.Bottom + 4, 260, 42); descriptionLabel.Lines = 2; descriptionLabel.Text = BookshelfBook.Description; descriptionLabel.Alpha = 0f; this.AddSubview(descriptionLabel); } } else { // updateButton if (updateButton == null) { updateButton = UIButton.FromType(UIButtonType.Custom); updateButton.Font = eBriefingAppearance.ThemeBoldFont(14); updateButton.SetTitleColor(eBriefingAppearance.Color("37b878"), UIControlState.Normal); updateButton.SetTitleColor(UIColor.White, UIControlState.Highlighted); updateButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_unfilled.png").CreateResizableImage(new UIEdgeInsets(0, 14f, 0, 14f)), UIControlState.Normal); updateButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_filled.png").CreateResizableImage(new UIEdgeInsets(0, 14f, 0, 14f)), UIControlState.Highlighted); updateButton.Frame = new CGRect(this.Center.X - 65, bookInfoView.Frame.Top - 28, 130, updateButton.CurrentBackgroundImage.Size.Height); updateButton.SetTitle("UPDATE", UIControlState.Normal); updateButton.TouchUpInside += HandleUpdateButtonTouchUpInside; this.AddSubview(updateButton); } } ShowHideInfo(1f); } else { // downloadSpinner if (downloadSpinner == null) { downloadSpinner = eBriefingAppearance.GenerateBounceSpinner(); downloadSpinner.Frame = new CGRect(10, (this.Frame.Bottom - 50), downloadSpinner.Frame.Width, downloadSpinner.Frame.Height); this.AddSubview(downloadSpinner); } // downloadLabel if (downloadLabel == null) { downloadLabel = eBriefingAppearance.GenerateLabel(17); downloadLabel.Frame = new CGRect(downloadSpinner.Frame.Right + 8, downloadSpinner.Frame.Y + 2, this.Frame.Width - (downloadSpinner.Frame.Right + 8) - 10, 21); this.AddSubview(downloadLabel); UpdateDownloadLabel(); } // progressView if (progressView == null) { progressView = new UIProgressView(UIProgressViewStyle.Default); progressView.Frame = new CGRect(downloadLabel.Frame.X, downloadLabel.Frame.Bottom + 8, downloadLabel.Frame.Width, progressView.Frame.Height); progressView.ProgressTintColor = eBriefingAppearance.BlueColor; progressView.Progress = BookshelfBook.DownloadProgress; this.AddSubview(progressView); } } }