예제 #1
0
 public void InitTest()
 {
     TestData.init();
     m_user = new User(TestData.username, TestData.api_key);
     m_user.setApiClient(new MockApiClient(TestData.username, TestData.api_key));
     m_historic = m_user.createHistoric(
         TestData.definition_hash,
         TestData.historic_start,
         TestData.historic_end,
         TestData.historic_sources,
         TestData.historic_sample,
         TestData.historic_name);
 }
예제 #2
0
 public void CleanupTest()
 {
     m_historic = null;
     m_user = null;
 }
예제 #3
0
 /// <summary>
 /// Subscribe this endpoint to a Historics query.
 /// </summary>
 /// <param name="historic">The Historics query.</param>
 /// <param name="name">A name for this subscription.</param>
 /// <returns>A PushSubscription object.</returns>
 public PushSubscription subscribe(Historic historic, string name)
 {
     return(subscribeHistoricPlaybackId(historic.getHash(), name));
 }
예제 #4
0
 /// <summary>
 /// Subscribe this endpoint to a Historics query.
 /// </summary>
 /// <param name="historic">The Historics query.</param>
 /// <param name="name">A name for this subscription.</param>
 /// <returns>A PushSubscription object.</returns>
 public PushSubscription subscribe(Historic historic, string name)
 {
     return subscribeHistoricPlaybackId(historic.getHash(), name);
 }
예제 #5
0
 /// <summary>
 /// Get a list of Historics queries in your account.
 /// </summary>
 /// <param name="page">The page number to get.</param>
 /// <param name="per_page">The number of items per page.</param>
 /// <returns>A list of Historic objects.</returns>
 public List <Historic> listHistorics(int page = 1, int per_page = 20)
 {
     return(Historic.list(this, page, per_page));
 }
        public void AddOrUpdateHistoricItem(Historic h, ListViewItem lvi = null)
        {
            if (lstHistoricsQueries.InvokeRequired)
            {
                AddOrUpdateHistoricItemCallback cb = new AddOrUpdateHistoricItemCallback(AddOrUpdateHistoricItem);
                this.Invoke(cb, new object[] { h, lvi });
            }
            else
            {
                lstHistoricsQueries.BeginUpdate();

                try
                {
                    if (lvi == null)
                    {
                        // No ListViewItem given, try to find a matching row
                        foreach (ListViewItem lvi_candidate in lstHistoricsQueries.Items)
                        {
                            if (h.getHash() == ((Historic)lvi_candidate.Tag).getHash())
                            {
                                lvi = lvi_candidate;
                                break;
                            }
                        }
                    }

                    if (h.isDeleted())
                    {
                        if (lvi != null)
                        {
                            lstHistoricsQueries.Items.Remove(lvi);
                        }
                    }
                    else
                    {
                        if (lvi == null)
                        {
                            // Still not found it, add it
                            lvi = lstHistoricsQueries.Items.Add(h.getName());
                            lvi.SubItems.Add(h.getStatus());
                            lvi.SubItems.Add(h.getProgress().ToString());
                            lvi.SubItems.Add(h.getStartDate().ToString());
                            lvi.SubItems.Add(h.getEndDate().ToString());
                            lvi.SubItems.Add(string.Join(", ", h.getSources().ToArray()));
                        }
                        else
                        {
                            // Already exists, update the pieces
                            lvi.SubItems[0].Text = h.getName();
                            lvi.SubItems[1].Text = h.getStatus();
                            lvi.SubItems[2].Text = h.getProgress().ToString();
                            lvi.SubItems[3].Text = h.getStartDate().ToString();
                            lvi.SubItems[4].Text = h.getEndDate().ToString();
                            lvi.SubItems[5].Text = string.Join(", ", h.getSources().ToArray());
                        }

                        // Store the Historic in the item
                        lvi.Tag = h;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                lstHistoricsQueries.EndUpdate();
            }
        }