Praeclarum.UI.DocumentsViewController.UpdateToolbar C# (CSharp) Method

UpdateToolbar() protected method

protected UpdateToolbar ( bool animated ) : void
animated bool
return void
		protected virtual void UpdateToolbar (bool animated)
		{
			try {
				var appdel = DocumentAppDelegate.Shared;

				var items = new List<UIBarButtonItem> ();

				var needsPatronBar = false;
				if (appdel.App.IsPatronSupported) {
					needsPatronBar = !appdel.Settings.IsPatron;
				}
				if (needsPatronBar) {
					items.Add (new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace));
					items.Add (patronBtn);
					items.Add (new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace));
				}

				SetToolbarItems (items.ToArray (), animated);			

				if (NavigationController != null && NavigationController.TopViewController != null && NavigationController.TopViewController.Handle == this.Handle) {
					NavigationController.SetToolbarHidden (items.Count == 0, animated);
				}
			} catch (Exception ex) {
				Log.Error (ex);				
			}
		}