public UserList(Channel channel) { Channel = channel; Size = new Size(150, 100); tree = new TreeView(); tree.Style = "userList"; tree.Activated += HandleActivated; items = new TreeItemCollection(); items.Add(owners = new TreeItem { Text = "Room Owners", Expanded = true }); items.Add(online = new TreeItem { Text = "Online", Expanded = true }); items.Add(away = new TreeItem { Text = "Away", Expanded = true }); if (Generator.IsMac) { foreach (var item in items.OfType <TreeItem>()) { item.Text = item.Text.ToUpperInvariant(); } } tree.DataStore = items; Content = tree; }
private void onSelectionChanged(bool fromUser) { if (ignoreSelectionChanged) { return; } try { ignoreSelectionChanged = true; if (fromUser) { var selectedCollection = SelectedItem as CollectionTreeItem; if (selectedCollection != null) { parentViewModel.SelectedCollection = selectedCollection.Collection; } else { parentViewModel.SelectedCollection = null; var selectedDb = SelectedItem as OpenedDatabaseTreeItem; parentViewModel.SelectedDatabase = selectedDb?.Database; } } else { var selectedItem = parentViewModel.SelectedDatabase; SelectedItem = tree .OfType <OpenedDatabaseTreeItem>() .FirstOrDefault(item => string.Equals(item.Database.FilePath, selectedItem?.FilePath)); } } catch (Exception error) { parentViewModel.Log.Error(error); MessageBox.Show(error.Message, "Selection Changed Error", MessageBoxButtons.OK, MessageBoxType.Error); } finally { ignoreSelectionChanged = false; } }
bool RemoveItem(TreeItemCollection items, string key) { foreach (var item in items.OfType <TreeItem>()) { if (item.Key == key) { items.Remove(item); return(true); } if (RemoveItem(item.Children, key)) { return(true); } } return(false); }
public UserList (Channel channel) { this.Channel = channel; tree = new TreeView (); tree.Style = "userList"; tree.Activated += HandleActivated; items = new TreeItemCollection (); items.Add (owners = new TreeItem { Text = "Room Owners", Expanded = true }); items.Add (online = new TreeItem { Text = "Online", Expanded = true }); items.Add (away = new TreeItem { Text = "Away", Expanded = true }); if (Generator.ID == Generators.Mac) { foreach (var item in items.OfType<TreeItem>()) { item.Text = item.Text.ToUpperInvariant(); } } tree.DataStore = items; this.AddDockedControl (tree); }
public UserList(Channel channel) { Channel = channel; Size = new Size(150, 100); tree = new TreeView(); tree.Style = "userList"; tree.Activated += HandleActivated; items = new TreeItemCollection(); items.Add(owners = new TreeItem { Text = "Room Owners", Expanded = true }); items.Add(online = new TreeItem { Text = "Online", Expanded = true }); items.Add(away = new TreeItem { Text = "Away", Expanded = true }); if (Generator.IsMac) { foreach (var item in items.OfType<TreeItem>()) { item.Text = item.Text.ToUpperInvariant(); } } tree.DataStore = items; Content = tree; }
bool RemoveItem (TreeItemCollection items, string key) { foreach (var item in items.OfType<TreeItem>()) { if (item.Key == key) { items.Remove (item); return true; } if (RemoveItem (item.Children, key)) return true; } return false; }