Beispiel #1
0
        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;
        }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
 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);
 }
Beispiel #4
0
		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);
		}
Beispiel #5
0
        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;
        }
Beispiel #6
0
		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;
		}