public void AddOrUpdatePushItem(PushSubscription p, ListViewItem lvi = null) { if (lstPushSubscriptions.InvokeRequired) { AddOrUpdatePushItemCallback cb = new AddOrUpdatePushItemCallback(AddOrUpdatePushItem); this.Invoke(cb, new object[] { p, lvi }); } else { lstPushSubscriptions.BeginUpdate(); try { if (lvi == null) { // No ListViewItem given, try to find a matching row foreach (ListViewItem lvi_candidate in lstPushSubscriptions.Items) { if (p.getId() == ((PushSubscription)lvi_candidate.Tag).getId()) { lvi = lvi_candidate; break; } } } if (p.isDeleted()) { if (lvi != null) { lstPushSubscriptions.Items.Remove(lvi); } } else { if (lvi == null) { // Still not found it, add it lvi = lstPushSubscriptions.Items.Add(p.getName()); lvi.SubItems.Add(p.getCreatedAt().ToString()); lvi.SubItems.Add(p.getStatus()); lvi.SubItems.Add(p.getOutputType()); lvi.SubItems.Add(p.getLastRequest().ToString()); lvi.SubItems.Add(p.getLastSuccess().ToString()); } else { // Already exists, update the pieces lvi.SubItems[0].Text = p.getName(); lvi.SubItems[1].Text = p.getCreatedAt().ToString(); lvi.SubItems[2].Text = p.getStatus(); lvi.SubItems[3].Text = p.getOutputType(); lvi.SubItems[4].Text = p.getLastRequest().ToString(); lvi.SubItems[5].Text = p.getLastSuccess().ToString(); } // Store the Push subscription in the item lvi.Tag = p; } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } lstPushSubscriptions.EndUpdate(); } }
/// <summary> /// Get a page of Push subscriptions for the given stream hash in the /// user's account, where each page contains up to per_page /// items. Results will be ordered according to the supplied ordering /// parameters. /// </summary> /// <param name="hash">The stream hash.</param> /// <param name="page">The page number to get.</param> /// <param name="per_page">The number of items per page.</param> /// <param name="order_by">The field by which to order the results.</param> /// <param name="order_dir">Ascending or descending.</param> /// <returns>A PushSubscriptionList object.</returns> public PushSubscriptionList listPushSubscriptionsByStreamHash(string hash, int page, int per_page, string order_by = PushSubscription.ORDERBY_CREATED_AT, string order_dir = PushSubscription.ORDERDIR_ASC) { return(PushSubscription.listByStreamHash(this, hash, page, per_page, order_by, order_dir)); }
/// <summary> /// Get a page of Push subscriptions the user's account, /// where each page contains up to per_page items. Results will be /// ordered according to the supplied ordering parameters. /// </summary> /// <param name="page">The page number to get.</param> /// <param name="per_page">The number of items per page.</param> /// <param name="order_by">The field by which to order the results.</param> /// <param name="order_dir">Ascending or descending.</param> /// <param name="include_finished">True to include subscriptions against finished Historics queries.</param> /// <param name="hash_type">Optional hash type to look for (hash is also required)</param> /// <param name="hash">Optional hash to look for (hash_type is also required)</param> /// <returns>A PushSubscriptionList object.</returns> public PushSubscriptionList listPushSubscriptions(int page, int per_page, string order_by = PushSubscription.ORDERBY_CREATED_AT, string order_dir = PushSubscription.ORDERDIR_ASC, bool include_finished = false) { return(PushSubscription.list(this, page, per_page, order_by, order_dir, include_finished)); }
/// <summary> /// Get a page of Push subscriptions for this Historics query, where each page contains up to per_page items. Results will be returned in the order requested. /// </summary> /// <param name="page">The page number to get.</param> /// <param name="per_page">The number of items per page.</param> /// <param name="order_by">The field by which to order the results.</param> /// <param name="order_dir">Ascending or descending</param> /// <returns>A PushSubscriptionList object.</returns> public PushSubscriptionList getPushSubscriptions(int page = 1, int per_page = 20, string order_by = PushSubscription.ORDERBY_CREATED_AT, string order_dir = PushSubscription.ORDERDIR_ASC) { return(PushSubscription.list(m_user, page, per_page, order_by, order_dir, true, "playback_id", m_playback_id)); }