void ReleaseDesignerOutlets() { if (ArchiveMessageButton != null) { ArchiveMessageButton.Dispose(); ArchiveMessageButton = null; } if (InBoxTableView != null) { InBoxTableView.Dispose(); InBoxTableView = null; } if (MarkAsReadButton != null) { MarkAsReadButton.Dispose(); MarkAsReadButton = null; } if (ToolBar != null) { ToolBar.Dispose(); ToolBar = null; } }
// UI management void updateUIandData() { // update table content InBoxTableView.DataSource = new InBoxTableViewDataSource(inbox); InBoxTableView.ReloadData(); //title updating if (inbox != null) { if (inbox.UnreadMessageCount == 0) { Title = "Inbox"; } else { Title = "Inbox (" + inbox.UnreadMessageCount.ToString() + ")"; } } // End the refreshing if (refreshControl != null) { string title = "Last update: " + DateTime.Now.ToString("MMM d, hh:mm"); NSAttributedString attributedTitle = new NSAttributedString(title, null, UIColor.DarkGray); refreshControl.AttributedTitle = attributedTitle; refreshControl.EndRefreshing(); } }
public override void ViewDidLoad() { base.ViewDidLoad(); NSNotificationCenter notficationCenter = NSNotificationCenter.DefaultCenter; // Register for inbox notication notficationCenter.AddObserver(AccengageIOS.Constants.BMA4SInBoxDataChanged, inboxChanged); // Register for cell notification notficationCenter.AddObserver(new NSString("RefreshInbox"), inboxRefresh); // Set Title // Ex : Inbox (3) if (inbox != null) { if (inbox.UnreadMessageCount == 0) { Title = "Inbox"; } else { Title = "Inbox (" + inbox.UnreadMessageCount.ToString() + ")"; } } // Initialize the refresh controll refreshControl = new UIRefreshControl(); refreshControl.BackgroundColor = UIColor.FromWhiteAlpha(0, 0.1f); refreshControl.AddTarget((sender, e) => { reloadData(); }, UIControlEvent.ValueChanged); InBoxTableView.AddSubview(refreshControl); InvokeOnMainThread(delegate { refreshControl.BeginRefreshing(); refreshControl.EndRefreshing(); }); // Add Edit Button UIBarButtonItem rigthButton = new UIBarButtonItem("edit", UIBarButtonItemStyle.Plain, startEditing); if (NavigationItem != null) { NavigationItem.RightBarButtonItem = rigthButton; } InBoxTableView.Delegate = new InBoxTableViewDelegate(this); reloadData(); }
void activeEditionState(bool actived) { InBoxTableView.SetEditing(actived, true); if (InBoxTableView.Editing) { NavigationItem.RightBarButtonItem.Title = "Done"; NavigationItem.RightBarButtonItem.Style = UIBarButtonItemStyle.Done; } else { NavigationItem.RightBarButtonItem.Title = "Edit"; NavigationItem.RightBarButtonItem.Style = UIBarButtonItemStyle.Plain; } updateToolBarPosition(); updateUIandData(); }
void inboxRefresh(NSNotification obj) { InBoxTableView.ReloadData(); }