{C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Debug|x86.ActiveCfg = Debug|x86\r
- {C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Debug|x86.Build.0 = Debug|x86\r
{C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Release|Any CPU.Build.0 = Release|Any CPU\r
{C191AC11-5EF9-4F37-82C4-BD2C5E0369D2}.Release|x86.ActiveCfg = Release|x86\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|x86.ActiveCfg = Debug|x86\r
- {BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|x86.Build.0 = Debug|x86\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|Any CPU.Build.0 = Release|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|x86.ActiveCfg = Release|x86\r
- {BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|x86.Build.0 = Release|x86\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|x86.ActiveCfg = Debug|x86\r
- {D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|x86.Build.0 = Debug|x86\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|Any CPU.Build.0 = Release|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|x86.ActiveCfg = Release|x86\r
- {D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|x86.Build.0 = Release|x86\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|x86.ActiveCfg = Debug|x86\r
- {33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|x86.Build.0 = Debug|x86\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|Any CPU.Build.0 = Release|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|x86.ActiveCfg = Release|x86\r
- {33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|x86.Build.0 = Release|x86\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Debug|x86.ActiveCfg = Debug|x86\r
- {DDFA3357-938D-41A3-881E-152105641A3D}.Debug|x86.Build.0 = Debug|x86\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Release|Any CPU.Build.0 = Release|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Release|x86.ActiveCfg = Release|x86\r
- {DDFA3357-938D-41A3-881E-152105641A3D}.Release|x86.Build.0 = Release|x86\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
this.btnLink = new System.Windows.Forms.Button();\r
this.tpgPlaces = new System.Windows.Forms.TabPage();\r
this.pnlPlaceDetail = new System.Windows.Forms.Panel();\r
- this.lvwPlaces = new Radegast.ListViewNoFlicker();\r
- this.Place = new System.Windows.Forms.ColumnHeader();\r
- this.Traffic = new System.Windows.Forms.ColumnHeader();\r
this.btnSearchPlace = new System.Windows.Forms.Button();\r
this.txtSearchPlace = new System.Windows.Forms.TextBox();\r
this.label2 = new System.Windows.Forms.Label();\r
this.btnNextPlace = new System.Windows.Forms.Button();\r
this.btnPrevPlace = new System.Windows.Forms.Button();\r
this.lblNrPlaces = new System.Windows.Forms.Label();\r
+ this.tpgGroups = new System.Windows.Forms.TabPage();\r
+ this.pnlGroupDetail = new System.Windows.Forms.Panel();\r
+ this.btnSearchGroup = new System.Windows.Forms.Button();\r
+ this.txtSearchGroup = new System.Windows.Forms.TextBox();\r
+ this.label3 = new System.Windows.Forms.Label();\r
+ this.btnNextGroup = new System.Windows.Forms.Button();\r
+ this.btnPrevGroup = new System.Windows.Forms.Button();\r
+ this.lblNrGroups = new System.Windows.Forms.Label();\r
+ this.columnHeader1 = new System.Windows.Forms.ColumnHeader();\r
+ this.columnHeader2 = new System.Windows.Forms.ColumnHeader();\r
+ this.lvwPlaces = new Radegast.ListViewNoFlicker();\r
+ this.Place = new System.Windows.Forms.ColumnHeader();\r
+ this.Traffic = new System.Windows.Forms.ColumnHeader();\r
+ this.lvwGroups = new Radegast.ListViewNoFlicker();\r
+ this.columnHeader3 = new System.Windows.Forms.ColumnHeader();\r
+ this.columnHeader4 = new System.Windows.Forms.ColumnHeader();\r
this.tabControl1.SuspendLayout();\r
this.tpgPeople.SuspendLayout();\r
this.tpgPlaces.SuspendLayout();\r
+ this.tpgGroups.SuspendLayout();\r
this.SuspendLayout();\r
// \r
// pnlFindPeople\r
// \r
this.tabControl1.Controls.Add(this.tpgPeople);\r
this.tabControl1.Controls.Add(this.tpgPlaces);\r
+ this.tabControl1.Controls.Add(this.tpgGroups);\r
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.tabControl1.Location = new System.Drawing.Point(0, 0);\r
this.tabControl1.Name = "tabControl1";\r
this.pnlPlaceDetail.Size = new System.Drawing.Size(353, 338);\r
this.pnlPlaceDetail.TabIndex = 15;\r
// \r
- // lvwPlaces\r
- // \r
- this.lvwPlaces.AllowColumnReorder = true;\r
- this.lvwPlaces.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\r
- | System.Windows.Forms.AnchorStyles.Left)));\r
- this.lvwPlaces.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {\r
- this.Place,\r
- this.Traffic});\r
- this.lvwPlaces.FullRowSelect = true;\r
- this.lvwPlaces.GridLines = true;\r
- this.lvwPlaces.HideSelection = false;\r
- this.lvwPlaces.Location = new System.Drawing.Point(12, 35);\r
- this.lvwPlaces.MultiSelect = false;\r
- this.lvwPlaces.Name = "lvwPlaces";\r
- this.lvwPlaces.ShowGroups = false;\r
- this.lvwPlaces.ShowItemToolTips = true;\r
- this.lvwPlaces.Size = new System.Drawing.Size(294, 315);\r
- this.lvwPlaces.Sorting = System.Windows.Forms.SortOrder.Ascending;\r
- this.lvwPlaces.TabIndex = 14;\r
- this.lvwPlaces.UseCompatibleStateImageBehavior = false;\r
- this.lvwPlaces.View = System.Windows.Forms.View.Details;\r
- this.lvwPlaces.SelectedIndexChanged += new System.EventHandler(this.lvwPlaces_SelectedIndexChanged);\r
- this.lvwPlaces.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvwPlaces_ColumnClick);\r
- // \r
- // Place\r
- // \r
- this.Place.Text = "Place";\r
- this.Place.Width = 200;\r
- // \r
- // Traffic\r
- // \r
- this.Traffic.Text = "Traffic";\r
- this.Traffic.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;\r
- this.Traffic.Width = 50;\r
- // \r
// btnSearchPlace\r
// \r
this.btnSearchPlace.Enabled = false;\r
this.lblNrPlaces.TabIndex = 8;\r
this.lblNrPlaces.Text = "0 places found";\r
// \r
+ // tpgGroups\r
+ // \r
+ this.tpgGroups.Controls.Add(this.pnlGroupDetail);\r
+ this.tpgGroups.Controls.Add(this.lvwGroups);\r
+ this.tpgGroups.Controls.Add(this.btnSearchGroup);\r
+ this.tpgGroups.Controls.Add(this.txtSearchGroup);\r
+ this.tpgGroups.Controls.Add(this.label3);\r
+ this.tpgGroups.Controls.Add(this.btnNextGroup);\r
+ this.tpgGroups.Controls.Add(this.btnPrevGroup);\r
+ this.tpgGroups.Controls.Add(this.lblNrGroups);\r
+ this.tpgGroups.Location = new System.Drawing.Point(4, 22);\r
+ this.tpgGroups.Name = "tpgGroups";\r
+ this.tpgGroups.Padding = new System.Windows.Forms.Padding(3);\r
+ this.tpgGroups.Size = new System.Drawing.Size(672, 374);\r
+ this.tpgGroups.TabIndex = 2;\r
+ this.tpgGroups.Text = "Groups";\r
+ this.tpgGroups.UseVisualStyleBackColor = true;\r
+ // \r
+ // pnlGroupDetail\r
+ // \r
+ this.pnlGroupDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\r
+ | System.Windows.Forms.AnchorStyles.Left)\r
+ | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.pnlGroupDetail.AutoScroll = true;\r
+ this.pnlGroupDetail.Location = new System.Drawing.Point(312, 9);\r
+ this.pnlGroupDetail.Name = "pnlGroupDetail";\r
+ this.pnlGroupDetail.Size = new System.Drawing.Size(353, 338);\r
+ this.pnlGroupDetail.TabIndex = 23;\r
+ // \r
+ // btnSearchGroup\r
+ // \r
+ this.btnSearchGroup.Enabled = false;\r
+ this.btnSearchGroup.Location = new System.Drawing.Point(228, 5);\r
+ this.btnSearchGroup.Name = "btnSearchGroup";\r
+ this.btnSearchGroup.Size = new System.Drawing.Size(75, 23);\r
+ this.btnSearchGroup.TabIndex = 21;\r
+ this.btnSearchGroup.Text = "Search";\r
+ this.btnSearchGroup.UseVisualStyleBackColor = true;\r
+ this.btnSearchGroup.Click += new System.EventHandler(this.btnSearchGroup_Click);\r
+ // \r
+ // txtSearchGroup\r
+ // \r
+ this.txtSearchGroup.Location = new System.Drawing.Point(44, 7);\r
+ this.txtSearchGroup.Name = "txtSearchGroup";\r
+ this.txtSearchGroup.Size = new System.Drawing.Size(178, 21);\r
+ this.txtSearchGroup.TabIndex = 20;\r
+ this.txtSearchGroup.TextChanged += new System.EventHandler(this.txtSearchGroup_TextChanged);\r
+ this.txtSearchGroup.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearchGroup_KeyDown);\r
+ // \r
+ // label3\r
+ // \r
+ this.label3.AutoSize = true;\r
+ this.label3.Location = new System.Drawing.Point(6, 10);\r
+ this.label3.Name = "label3";\r
+ this.label3.Size = new System.Drawing.Size(36, 13);\r
+ this.label3.TabIndex = 19;\r
+ this.label3.Text = "Group";\r
+ // \r
+ // btnNextGroup\r
+ // \r
+ this.btnNextGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.btnNextGroup.Enabled = false;\r
+ this.btnNextGroup.Location = new System.Drawing.Point(591, 347);\r
+ this.btnNextGroup.Name = "btnNextGroup";\r
+ this.btnNextGroup.Size = new System.Drawing.Size(75, 23);\r
+ this.btnNextGroup.TabIndex = 18;\r
+ this.btnNextGroup.Text = "Next >";\r
+ this.btnNextGroup.UseVisualStyleBackColor = true;\r
+ this.btnNextGroup.Click += new System.EventHandler(this.btnNextGroup_Click);\r
+ // \r
+ // btnPrevGroup\r
+ // \r
+ this.btnPrevGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.btnPrevGroup.Enabled = false;\r
+ this.btnPrevGroup.Location = new System.Drawing.Point(510, 347);\r
+ this.btnPrevGroup.Name = "btnPrevGroup";\r
+ this.btnPrevGroup.Size = new System.Drawing.Size(75, 23);\r
+ this.btnPrevGroup.TabIndex = 17;\r
+ this.btnPrevGroup.Text = "< Previous";\r
+ this.btnPrevGroup.UseVisualStyleBackColor = true;\r
+ this.btnPrevGroup.Click += new System.EventHandler(this.btnPrevGroup_Click);\r
+ // \r
+ // lblNrGroups\r
+ // \r
+ this.lblNrGroups.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
+ this.lblNrGroups.AutoSize = true;\r
+ this.lblNrGroups.Location = new System.Drawing.Point(6, 352);\r
+ this.lblNrGroups.Name = "lblNrGroups";\r
+ this.lblNrGroups.Size = new System.Drawing.Size(80, 13);\r
+ this.lblNrGroups.TabIndex = 16;\r
+ this.lblNrGroups.Text = "0 groups found";\r
+ this.lblNrGroups.Visible = false;\r
+ // \r
+ // columnHeader1\r
+ // \r
+ this.columnHeader1.Text = "Place";\r
+ this.columnHeader1.Width = 200;\r
+ // \r
+ // columnHeader2\r
+ // \r
+ this.columnHeader2.Text = "Traffic";\r
+ this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;\r
+ this.columnHeader2.Width = 50;\r
+ // \r
+ // lvwPlaces\r
+ // \r
+ this.lvwPlaces.AllowColumnReorder = true;\r
+ this.lvwPlaces.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\r
+ | System.Windows.Forms.AnchorStyles.Left)));\r
+ this.lvwPlaces.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {\r
+ this.Place,\r
+ this.Traffic});\r
+ this.lvwPlaces.FullRowSelect = true;\r
+ this.lvwPlaces.GridLines = true;\r
+ this.lvwPlaces.HideSelection = false;\r
+ this.lvwPlaces.Location = new System.Drawing.Point(12, 35);\r
+ this.lvwPlaces.MultiSelect = false;\r
+ this.lvwPlaces.Name = "lvwPlaces";\r
+ this.lvwPlaces.ShowGroups = false;\r
+ this.lvwPlaces.ShowItemToolTips = true;\r
+ this.lvwPlaces.Size = new System.Drawing.Size(294, 315);\r
+ this.lvwPlaces.Sorting = System.Windows.Forms.SortOrder.Ascending;\r
+ this.lvwPlaces.TabIndex = 14;\r
+ this.lvwPlaces.UseCompatibleStateImageBehavior = false;\r
+ this.lvwPlaces.View = System.Windows.Forms.View.Details;\r
+ this.lvwPlaces.SelectedIndexChanged += new System.EventHandler(this.lvwPlaces_SelectedIndexChanged);\r
+ this.lvwPlaces.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvwPlaces_ColumnClick);\r
+ // \r
+ // Place\r
+ // \r
+ this.Place.Text = "Place";\r
+ this.Place.Width = 200;\r
+ // \r
+ // Traffic\r
+ // \r
+ this.Traffic.Text = "Traffic";\r
+ this.Traffic.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;\r
+ this.Traffic.Width = 50;\r
+ // \r
+ // lvwGroups\r
+ // \r
+ this.lvwGroups.AllowColumnReorder = true;\r
+ this.lvwGroups.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\r
+ | System.Windows.Forms.AnchorStyles.Left)));\r
+ this.lvwGroups.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {\r
+ this.columnHeader3,\r
+ this.columnHeader4});\r
+ this.lvwGroups.FullRowSelect = true;\r
+ this.lvwGroups.GridLines = true;\r
+ this.lvwGroups.HideSelection = false;\r
+ this.lvwGroups.Location = new System.Drawing.Point(9, 34);\r
+ this.lvwGroups.MultiSelect = false;\r
+ this.lvwGroups.Name = "lvwGroups";\r
+ this.lvwGroups.ShowGroups = false;\r
+ this.lvwGroups.ShowItemToolTips = true;\r
+ this.lvwGroups.Size = new System.Drawing.Size(294, 315);\r
+ this.lvwGroups.Sorting = System.Windows.Forms.SortOrder.Ascending;\r
+ this.lvwGroups.TabIndex = 22;\r
+ this.lvwGroups.UseCompatibleStateImageBehavior = false;\r
+ this.lvwGroups.View = System.Windows.Forms.View.Details;\r
+ this.lvwGroups.SelectedIndexChanged += new System.EventHandler(this.lvwGroups_SelectedIndexChanged);\r
+ this.lvwGroups.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvwGroups_ColumnClick);\r
+ // \r
+ // columnHeader3\r
+ // \r
+ this.columnHeader3.Text = "Group";\r
+ this.columnHeader3.Width = 200;\r
+ // \r
+ // columnHeader4\r
+ // \r
+ this.columnHeader4.Text = "Members";\r
+ this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;\r
+ this.columnHeader4.Width = 50;\r
+ // \r
// SearchConsole\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.tpgPeople.PerformLayout();\r
this.tpgPlaces.ResumeLayout(false);\r
this.tpgPlaces.PerformLayout();\r
+ this.tpgGroups.ResumeLayout(false);\r
+ this.tpgGroups.PerformLayout();\r
this.ResumeLayout(false);\r
\r
}\r
public System.Windows.Forms.ColumnHeader Place;\r
public System.Windows.Forms.ColumnHeader Traffic;\r
public System.Windows.Forms.Panel pnlPlaceDetail;\r
+ public System.Windows.Forms.TabPage tpgGroups;\r
+ public System.Windows.Forms.Panel pnlGroupDetail;\r
+ public ListViewNoFlicker lvwGroups;\r
+ public System.Windows.Forms.ColumnHeader columnHeader3;\r
+ public System.Windows.Forms.ColumnHeader columnHeader4;\r
+ public System.Windows.Forms.Button btnSearchGroup;\r
+ public System.Windows.Forms.TextBox txtSearchGroup;\r
+ public System.Windows.Forms.Label label3;\r
+ public System.Windows.Forms.Button btnNextGroup;\r
+ public System.Windows.Forms.Button btnPrevGroup;\r
+ public System.Windows.Forms.Label lblNrGroups;\r
+ public System.Windows.Forms.ColumnHeader columnHeader1;\r
+ public System.Windows.Forms.ColumnHeader columnHeader2;\r
\r
}\r
}\r
// Callbacks\r
client.Directory.DirPeopleReply += new EventHandler<DirPeopleReplyEventArgs>(Directory_DirPeopleReply);\r
client.Directory.DirPlacesReply += new EventHandler<DirPlacesReplyEventArgs>(Directory_DirPlacesReply);\r
+ client.Directory.DirGroupsReply += new EventHandler<DirGroupsReplyEventArgs>(Directory_DirGroupsReply);\r
console = new FindPeopleConsole(instance, UUID.Random());\r
console.Dock = DockStyle.Fill;\r
console.SelectedIndexChanged += new EventHandler(console_SelectedIndexChanged);\r
pnlFindPeople.Controls.Add(console);\r
lvwPlaces.ListViewItemSorter = new PlaceSorter();\r
+ lvwGroups.ListViewItemSorter = new GroupSorter();\r
}\r
\r
void SearchConsole_Disposed(object sender, EventArgs e)\r
{\r
client.Directory.DirPeopleReply -= new EventHandler<DirPeopleReplyEventArgs>(Directory_DirPeopleReply);\r
client.Directory.DirPlacesReply -= new EventHandler<DirPlacesReplyEventArgs>(Directory_DirPlacesReply);\r
+ client.Directory.DirGroupsReply -= new EventHandler<DirGroupsReplyEventArgs>(Directory_DirGroupsReply);\r
}\r
\r
#endregion Construction and disposal\r
}\r
}\r
#endregion Places search\r
+\r
+ #region Groups search\r
+ private UUID groupSearch;\r
+ private int groupMatches = 0;\r
+ private int groupStart = 0;\r
+\r
+ void Directory_DirGroupsReply(object sender, DirGroupsReplyEventArgs e)\r
+ {\r
+ if (e.QueryID != groupSearch) return;\r
+\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new MethodInvoker(() => Directory_DirGroupsReply(sender, e)));\r
+ return;\r
+ }\r
+\r
+ lvwGroups.BeginUpdate();\r
+\r
+ if (e.MatchedGroups.Count == 0)\r
+ lvwGroups.Items.Clear();\r
+\r
+ foreach (DirectoryManager.GroupSearchData group in e.MatchedGroups)\r
+ {\r
+ if (group.GroupID == UUID.Zero) continue;\r
+\r
+ ListViewItem item = new ListViewItem();\r
+ item.Name = group.GroupID.ToString();\r
+ item.Text = group.GroupName;\r
+ item.Tag = group;\r
+ item.SubItems.Add(new ListViewItem.ListViewSubItem(item, group.Members.ToString()));\r
+\r
+ lvwGroups.Items.Add(item);\r
+ }\r
+ lvwGroups.Sort();\r
+ lvwGroups.EndUpdate();\r
+\r
+ groupMatches += e.MatchedGroups.Count;\r
+ btnNextGroup.Enabled = groupMatches > 100;\r
+ btnPrevGroup.Enabled = placeStart != 0;\r
+\r
+ if (e.MatchedGroups.Count > 0 && e.MatchedGroups[e.MatchedGroups.Count - 1].GroupID == UUID.Zero)\r
+ groupMatches -= 1;\r
+\r
+ lblNrGroups.Visible = true;\r
+ lblNrGroups.Text = string.Format("{0} groups found", groupMatches > 100 ? "More than " + (groupStart + 100).ToString() : (groupStart + groupMatches).ToString());\r
+ }\r
+\r
+ private void btnSearchGroup_Click(object sender, EventArgs e)\r
+ {\r
+ groupMatches = 0;\r
+ groupStart = 0;\r
+ lvwGroups.Items.Clear();\r
+ groupSearch = client.Directory.StartGroupSearch(txtSearchGroup.Text.Trim(), 0);\r
+ }\r
+\r
+ private void txtSearchGroup_KeyDown(object sender, KeyEventArgs e)\r
+ {\r
+ if (e.KeyCode == Keys.Enter)\r
+ {\r
+ e.SuppressKeyPress = e.Handled = true;\r
+ btnSearchGroup.PerformClick();\r
+ }\r
+ }\r
+\r
+ private void txtSearchGroup_TextChanged(object sender, EventArgs e)\r
+ {\r
+ if (txtSearchGroup.Text.Length > 1)\r
+ {\r
+ btnSearchGroup.Enabled = true;\r
+ }\r
+ else\r
+ {\r
+ btnSearchGroup.Enabled = false;\r
+ }\r
+ }\r
+\r
+ private void btnPrevGroup_Click(object sender, EventArgs e)\r
+ {\r
+ groupMatches = 0;\r
+ groupStart -= 100;\r
+ lvwGroups.Items.Clear();\r
+ groupSearch = client.Directory.StartGroupSearch(txtSearchGroup.Text.Trim(), groupStart);\r
+ }\r
+\r
+ private void btnNextGroup_Click(object sender, EventArgs e)\r
+ {\r
+ groupMatches = 0;\r
+ groupStart += 100;\r
+ lvwGroups.Items.Clear();\r
+ groupSearch = client.Directory.StartGroupSearch(txtSearchGroup.Text.Trim(), groupStart);\r
+ }\r
+\r
+ private void lvwGroups_SelectedIndexChanged(object sender, EventArgs e)\r
+ {\r
+ foreach (Control c in pnlGroupDetail.Controls)\r
+ {\r
+ c.Dispose();\r
+ }\r
+ pnlGroupDetail.Controls.Clear();\r
+\r
+ if (lvwGroups.SelectedItems.Count == 1)\r
+ {\r
+ try\r
+ {\r
+ DirectoryManager.GroupSearchData g = (DirectoryManager.GroupSearchData)lvwGroups.SelectedItems[0].Tag;\r
+ GroupDetails grpPanel = new GroupDetails(instance, new Group() { ID = g.GroupID, Name = g.GroupName });\r
+ grpPanel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;\r
+ grpPanel.Region = new System.Drawing.Region(\r
+ new System.Drawing.RectangleF(\r
+ grpPanel.tpGeneral.Left, grpPanel.tpGeneral.Top, grpPanel.tpGeneral.Width, grpPanel.tpGeneral.Height));\r
+ pnlGroupDetail.Controls.Add(grpPanel);\r
+ }\r
+ catch { }\r
+ }\r
+ }\r
+\r
+ private void lvwGroups_ColumnClick(object sender, ColumnClickEventArgs e)\r
+ {\r
+ GroupSorter sorter = (GroupSorter)lvwGroups.ListViewItemSorter;\r
+ switch (e.Column)\r
+ {\r
+ case 0:\r
+ sorter.SortBy = GroupSorter.SortByColumn.Name;\r
+ break;\r
+\r
+ case 1:\r
+ sorter.SortBy = GroupSorter.SortByColumn.Members;\r
+ break;\r
+ }\r
+\r
+ if (sorter.CurrentOrder == GroupSorter.SortOrder.Ascending)\r
+ sorter.CurrentOrder = GroupSorter.SortOrder.Descending;\r
+ else\r
+ sorter.CurrentOrder = GroupSorter.SortOrder.Ascending;\r
+\r
+ lvwGroups.Sort();\r
+ }\r
+\r
+ public class GroupSorter : System.Collections.IComparer\r
+ {\r
+ public enum SortByColumn\r
+ {\r
+ Name,\r
+ Members\r
+ }\r
+\r
+ public enum SortOrder\r
+ {\r
+ Ascending,\r
+ Descending\r
+ }\r
+\r
+ public SortOrder CurrentOrder = SortOrder.Ascending;\r
+ public SortByColumn SortBy = SortByColumn.Name;\r
+\r
+ public int Compare(object x, object y)\r
+ {\r
+ ListViewItem item1 = (ListViewItem)x;\r
+ ListViewItem item2 = (ListViewItem)y;\r
+ DirectoryManager.GroupSearchData group1 = (DirectoryManager.GroupSearchData)item1.Tag;\r
+ DirectoryManager.GroupSearchData group2 = (DirectoryManager.GroupSearchData)item2.Tag;\r
+\r
+ switch (SortBy)\r
+ {\r
+ case SortByColumn.Name:\r
+ if (CurrentOrder == SortOrder.Ascending)\r
+ return string.Compare(item1.Text, item2.Text);\r
+ else\r
+ return string.Compare(item2.Text, item1.Text);\r
+\r
+ case SortByColumn.Members:\r
+ if (CurrentOrder == SortOrder.Ascending)\r
+ {\r
+ if (group1.Members > group2.Members)\r
+ return 1;\r
+ else if (group1.Members < group2.Members)\r
+ return -1;\r
+ }\r
+ else\r
+ {\r
+ if (group1.Members > group2.Members)\r
+ return -1;\r
+ else if (group1.Members < group2.Members)\r
+ return 1;\r
+ }\r
+ break;\r
+ }\r
+\r
+ return 0;\r
+ }\r
+ }\r
+ #endregion Groups search\r
}\r
}\r