private void LoadContainerList() { // // When we keep reconnecting the memory usage goes thru the roof // GC.Collect(); if (m_listingThread != null && m_listingThread.ThreadState == ThreadState.Running) { return; } containersListView.Items.Clear(); m_containerList.Clear(); m_listingThread = new Thread(delegate() { TioClient.Connection cn = new TioClient.Connection(m_connection.Host, m_connection.Port); m_containerCount = cn.Open("__meta__/containers").Count; cn.Open("__meta__/containers").Query( delegate(object key, object value, object metadata) { if (m_stopping) { m_connection.Close(); return; } lock (m_containerList) { m_containerList.Add(new ContainerItem { key = key.ToString(), value = value.ToString() }); } }); cn.Close(); }); m_listingThread.Start(); }
private void ContainerViewer_Load(object sender, EventArgs e) { Text = m_containerName; containerNameTextBox.Text = m_containerName; Application.DoEvents(); try { m_connection = new TioClient.Connection(m_server, m_port); m_container = m_connection.Open(m_containerName); } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.Message); Close(); return; } UpdateData(); }
private void LoadContainerList() { // // When we keep reconnecting the memory usage goes thru the roof // GC.Collect(); if (m_listingThread != null && m_listingThread.ThreadState == ThreadState.Running) return; containersListView.Items.Clear(); m_containerList.Clear(); m_listingThread = new Thread(delegate() { TioClient.Connection cn = new TioClient.Connection(m_connection.Host, m_connection.Port); m_containerCount = cn.Open("__meta__/containers").Count; cn.Open("__meta__/containers").Query( delegate(object key, object value, object metadata) { if (m_stopping) { m_connection.Close(); return; } lock (m_containerList) { m_containerList.Add(new ContainerItem { key=key.ToString(), value=value.ToString() }); } }); cn.Close(); }); m_listingThread.Start(); }