Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/31/12 12:42:45 (12 years ago)
Author:
ascheibe
Message:

#1648 improved user information dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/UserViews/LightweightUserInformationView.cs

    r7611 r7942  
    2020#endregion
    2121
     22using System.Windows.Forms;
    2223using HeuristicLab.MainForm;
    2324using HeuristicLab.MainForm.WindowsForms;
     
    3839    protected override void OnContentChanged() {
    3940      base.OnContentChanged();
    40       rolesListBox.Items.Clear();
    41       groupsListBox.Items.Clear();
     41      rolesListView.Items.Clear();
     42      groupsListView.Items.Clear();
     43      rolesListView.SmallImageList.Images.Clear();
     44      groupsListView.SmallImageList.Images.Clear();
    4245
    4346      if (Content == null) {
     
    4750        userNameTextBox.Text = Content.UserName;
    4851        fullNameTextBox.Text = Content.FullName;
    49         rolesListBox.Items.AddRange(Content.Roles.ToArray());
    50         groupsListBox.Items.AddRange(Content.Groups.ToArray());
     52
     53        foreach (Role r in Content.Roles)
     54          rolesListView.Items.Add(CreateListViewRoleItem(r));
     55
     56        foreach (UserGroup g in Content.Groups)
     57          groupsListView.Items.Add(CreateListViewGroupItem(g));
     58
     59        rolesListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     60        groupsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
    5161      }
    5262    }
     
    5767      }
    5868    }
     69
     70    private ListViewItem CreateListViewRoleItem(Role item) {
     71      ListViewItem listViewItem = new ListViewItem();
     72
     73      listViewItem.Text = item.ToString();
     74      rolesListView.SmallImageList.Images.Add(item.ItemImage);
     75      listViewItem.ImageIndex = rolesListView.SmallImageList.Images.Count - 1;
     76      listViewItem.Tag = item;
     77
     78      return listViewItem;
     79    }
     80
     81    private ListViewItem CreateListViewGroupItem(UserGroup item) {
     82      ListViewItem listViewItem = new ListViewItem();
     83
     84      listViewItem.Text = item.ToString();
     85      groupsListView.SmallImageList.Images.Add(item.ItemImage);
     86      listViewItem.ImageIndex = rolesListView.SmallImageList.Images.Count - 1;
     87      listViewItem.Tag = item;
     88
     89      return listViewItem;
     90    }
    5991  }
    6092}
Note: See TracChangeset for help on using the changeset viewer.