void OnColumnUpdate(MLRatColumn sender, MLPlugin plugin, IClient client, string value) { try { MLClientData d = ConnectedClients[client.ID]; ListViewItem i = (ListViewItem)d.DisplayObject; EditSubitem(i, sender.Index, value); } catch(Exception ex) { DisplayException(plugin, ex); } }
IMLRatColumn OnColumnAdd(MLPlugin _plugin, string name, string defaultValue) { lock(this) { MLRatColumn column = new MLRatColumn(OnColumnUpdate); column.Parent = _plugin; ColumnHeader header = clientList.Columns.Add(name); column.Index = header.Index; header.Tag = defaultValue; Invoke((MethodInvoker)delegate () { foreach (ListViewItem clientItem in clientList.Items) { foreach (ColumnHeader cheader in clientList.Columns) { if (clientItem.SubItems.Count == header.Index) { clientItem.SubItems.Add((string)header.Tag); } } } }); Console.WriteLine("Added column: {0}", name); return column; } }