5
5
using System . ComponentModel ;
6
6
using System . ComponentModel . Design ;
7
7
using System . ComponentModel . Design . Serialization ;
8
- using System . Diagnostics ;
9
8
10
9
namespace System . Windows . Forms . Design
11
10
{
12
- /// <include file='doc\ListViewGroupCollectionEditor.uex' path='docs/doc[@for="ListViewGroupCollectionEditor"]/*' />
13
- /// <devdoc>
14
- /// <para>
15
- /// Provides an editor for an image collection.</para>
16
- /// </devdoc>
11
+ /// <summary>
12
+ /// Provides an editor for an image collection.</para>
13
+ /// </summary>
17
14
internal class ListViewGroupCollectionEditor : CollectionEditor
18
15
{
16
+ object _editValue ;
19
17
20
- object editValue ;
21
- /// <include file='doc\ListViewGroupCollectionEditor.uex' path='docs/doc[@for="ListViewGroupCollectionEditor.ListViewGroupCollectionEditor"]/*' />
22
- /// <devdoc>
23
- /// </devdoc>
24
18
public ListViewGroupCollectionEditor ( Type type ) : base ( type )
25
- { }
19
+ { }
26
20
27
- /// <include file='doc\ListViewGroupCollectionEditor.uex' path='docs/doc[@for="ListViewGroupCollectionEditor.CreatesInstance"]/*' />
28
- /// <devdoc>
29
- /// Creates a ListViewGroup instance.
30
- /// </devdoc>
21
+ /// <summary>
22
+ /// Creates a ListViewGroup instance.
23
+ /// </summary>
31
24
protected override object CreateInstance ( Type itemType )
32
25
{
33
26
ListViewGroup lvg = ( ListViewGroup ) base . CreateInstance ( itemType ) ;
34
27
35
28
// Create an unique name for the list view group.
36
- lvg . Name = CreateListViewGroupName ( ( ListViewGroupCollection ) this . editValue ) ;
29
+ lvg . Name = CreateListViewGroupName ( ( ListViewGroupCollection ) _editValue ) ;
37
30
38
31
return lvg ;
39
32
}
@@ -42,22 +35,23 @@ private string CreateListViewGroupName(ListViewGroupCollection lvgCollection)
42
35
{
43
36
string lvgName = "ListViewGroup" ;
44
37
string resultName ;
45
- INameCreationService ncs = this . GetService ( typeof ( INameCreationService ) ) as INameCreationService ;
46
- IContainer container = this . GetService ( typeof ( IContainer ) ) as IContainer ;
38
+ INameCreationService ncs = GetService ( typeof ( INameCreationService ) ) as INameCreationService ;
39
+ IContainer container = GetService ( typeof ( IContainer ) ) as IContainer ;
47
40
48
41
if ( ncs != null && container != null )
49
42
{
50
43
lvgName = ncs . CreateName ( container , typeof ( ListViewGroup ) ) ;
51
44
}
52
45
53
46
// strip the digits from the end.
54
- while ( Char . IsDigit ( lvgName [ lvgName . Length - 1 ] ) )
47
+ while ( char . IsDigit ( lvgName [ lvgName . Length - 1 ] ) )
55
48
{
56
49
lvgName = lvgName . Substring ( 0 , lvgName . Length - 1 ) ;
57
50
}
58
51
59
52
int i = 1 ;
60
53
resultName = lvgName + i . ToString ( System . Globalization . CultureInfo . CurrentCulture ) ;
54
+
61
55
while ( lvgCollection [ resultName ] != null )
62
56
{
63
57
i ++ ;
@@ -69,15 +63,15 @@ private string CreateListViewGroupName(ListViewGroupCollection lvgCollection)
69
63
70
64
public override object EditValue ( ITypeDescriptorContext context , IServiceProvider provider , object value )
71
65
{
72
- this . editValue = value ;
66
+ _editValue = value ;
73
67
object ret ;
74
68
75
69
// This will block while the ListViewGroupCollectionDialog is running.
76
70
ret = base . EditValue ( context , provider , value ) ;
77
71
78
72
// The user is done w/ the ListViewGroupCollectionDialog.
79
73
// Don't need the edit value any longer
80
- this . editValue = null ;
74
+ _editValue = null ;
81
75
82
76
return ret ;
83
77
}
0 commit comments