public override void ViewDidLoad () { base.ViewDidLoad (); SDImageCache.SharedImageCache.ClearDisk (); SDImageCache.SharedImageCache.ClearMemory (); menuItems.AddRange (new [] { new Tuple<string, string> ("Single photo", "with caption, no grid button"), new Tuple<string, string> ("Multiple photos and video", "with captions"), new Tuple<string, string> ("Multiple photo grid", "showing grid first, nav arrows enabled"), new Tuple<string, string> ("Photo selections", "selection enabled"), new Tuple<string, string> ("Photo selection grid", "selection enabled, start at grid"), new Tuple<string, string> ("Web photos", "photos from web"), new Tuple<string, string> ("Web photo grid", "showing grid first"), new Tuple<string, string> ("Single video", "with auto-play"), new Tuple<string, string> ("Web videos", "showing grid first"), new Tuple<string, string> ("Library photos and videos", "media from device library") }); Title = "MWPhotoBrowser"; browserDelegate = new BrowserDelegate (TableView); _segmentedControl = new UISegmentedControl (new []{ "Push", "Modal" }); _segmentedControl.SelectedSegment = 0; _segmentedControl.ValueChanged += delegate { TableView.ReloadData (); }; UIBarButtonItem item = new UIBarButtonItem (_segmentedControl); NavigationItem.RightBarButtonItem = item; NavigationItem.BackBarButtonItem = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, null); browserDelegate.LoadAssets (); }
/// <summary> /// Browses messages in a EMS queue. The callback gives access to the EMS Session /// and QueueBrowser in order to browse the queue and react to the contents. /// </summary> /// <param name="queueName">Name of the queue to browse, /// (to be resolved to an actual destination by a DestinationResolver)</param> /// <param name="messageSelector">The EMS message selector expression (or <code>null</code> if none).</param> /// <param name="action">The action callback delegate that exposes the session/browser pair.</param> /// <returns></returns> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public object BrowseSelectedWithDelegate(string queueName, string messageSelector, BrowserDelegate action) { AssertUtils.ArgumentNotNull(action, "action"); return Execute(session => { Queue queue = (Queue)DestinationResolver.ResolveDestinationName(session, queueName, false); QueueBrowser browser = CreateBrowser(session, queue, messageSelector); try { return action(session, browser); } finally { EmsUtils.CloseQueueBrowser(browser); } }, true); }
/// <summary> /// Browses messages in a EMS queue. The callback gives access to the EMS Session /// and QueueBrowser in order to browse the queue and react to the contents. /// </summary> /// <param name="messageSelector">The EMS message selector expression (or <code>null</code> if none).</param> /// <param name="action">The action callback delegate that exposes the session/browser pair.</param> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public object BrowseSelectedWithDelegate(string messageSelector, BrowserDelegate action) { if (DefaultDestinationName != null) { return BrowseSelectedWithDelegate(DefaultDestinationName, messageSelector, action); } else { Destination destination = DefaultDestination; if (!(destination is Queue)) { throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of EmsTemplate."); } return BrowseSelectedWithDelegate((Queue)destination, messageSelector, action); } }
/// <summary> /// Browses messages in a EMS queue. The callback gives access to the EMS Session /// and QueueBrowser in order to browse the queue and react to the contents. /// </summary> /// <param name="queueName">Name of the queue to browse, /// (to be resolved to an actual destination by a DestinationResolver)</param> /// <param name="action">The action callback delegate that exposes the session/browser pair.</param> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public object BrowseWithDelegate(string queueName, BrowserDelegate action) { return BrowseSelectedWithDelegate(queueName, null, action); }
/// <summary> /// Browses messages in a EMS queue. The callback gives access to the EMS Session /// and QueueBrowser in order to browse the queue and react to the contents. /// </summary> /// <param name="queue">The queue to browse.</param> /// <param name="action">The action callback delegate that exposes the session/browser pair.</param> /// <returns>the result object from working with the session</returns> public object BrowseWithDelegate(Queue queue, BrowserDelegate action) { return BrowseSelectedWithDelegate(queue, null, action); }
/// <summary> /// Browses messages in a EMS queue. The callback gives access to the EMS Session /// and QueueBrowser in order to browse the queue and react to the contents. /// </summary> /// <param name="queue">The queue to browse.</param> /// <param name="messageSelector">The EMS message selector expression (or <code>null</code> if none).</param> /// <param name="action">The action callback delegate that exposes the session/browser pair.</param> /// <returns></returns> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public object BrowseSelectedWithDelegate(Queue queue, string messageSelector, BrowserDelegate action) { AssertUtils.ArgumentNotNull(action, "action"); return Execute(delegate(ISession session) { QueueBrowser browser = CreateBrowser(session, queue, messageSelector); try { return action(session, browser); } finally { EmsUtils.CloseQueueBrowser(browser); } }, true); }