private void RunAction(List<Capability> capabilities, List<Host> hosts) { OnPageUpdated(); _hostList.Clear(); flickerFreeListBox1.Items.Clear(); label1.Text = ""; long size = 0; foreach (Capability c in capabilities) if (c.Key != "client-logs") size += c.MinSize; foreach(Host host in hosts) { HostWithStatus hostWithStatus = new HostWithStatus(host,size); _hostList.Add(hostWithStatus); flickerFreeListBox1.Items.Add(hostWithStatus); } List<string> strings = new List<string>(); foreach(Capability c in capabilities) strings.Add(c.Key); _action = new SystemStatusAction(_hostList, strings); _action.Changed += new EventHandler<EventArgs>(_action_Changed); _action.Completed += new EventHandler<EventArgs>(_action_Completed); _action.RunAsync(); }
/// <summary> /// Must be called on the event thread. /// </summary> private void CancelAction() { Program.AssertOnEventThread(); OnPageUpdated(); _action.Changed -= _action_Changed; _action.Completed -= _action_Completed; _action.Cancel(); _action = null; }