~ubuntu-branches/ubuntu/karmic/moon/karmic

« back to all changes in this revision

Viewing changes to class/Microsoft.SilverlightControls/Controls/Data/src/DataGrid/DataGridError.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-14 12:01:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090214120108-06539vb25vhbd8bn
Tags: upstream-1.0
Import upstream version 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright © Microsoft Corporation.
 
2
// This source is subject to the Microsoft Source License for Silverlight Controls (March 2008 Release).
 
3
// Please see http://go.microsoft.com/fwlink/?LinkID=111693 for details.
 
4
// All other rights reserved.
 
5
 
 
6
using System.Globalization;
 
7
 
 
8
namespace System.Windows.Controlsb1
 
9
{
 
10
    internal static class DataGridError
 
11
    {
 
12
        public static class DataGrid
 
13
        {
 
14
            public static InvalidOperationException CannotAddFrozenColumn()
 
15
            {
 
16
                return new InvalidOperationException(Resource.DataGrid_CannotAddFrozenColumn);
 
17
            }
 
18
 
 
19
            public static InvalidOperationException CannotAddNonFrozenColumn()
 
20
            {
 
21
                return new InvalidOperationException(Resource.DataGrid_CannotAddNonFrozenColumn);
 
22
            }
 
23
 
 
24
            public static InvalidOperationException CannotChangeColumnCollectionWhileAdjustingDisplayIndexes()
 
25
            {
 
26
                return new InvalidOperationException(Resource.DataGrid_CannotChangeColumnCollectionWhileAdjustingDisplayIndexes);
 
27
            }
 
28
 
 
29
            public static InvalidOperationException CannotMoveFrozenColumn()
 
30
            {
 
31
                return new InvalidOperationException(Resource.DataGrid_CannotMoveFrozenColumn);
 
32
            }
 
33
 
 
34
            public static InvalidOperationException CannotMoveNonFrozenColumn()
 
35
            {
 
36
                return new InvalidOperationException(Resource.DataGrid_CannotMoveNonFrozenColumn);
 
37
            }
 
38
 
 
39
            public static InvalidOperationException ColumnCannotBeCollapsed()
 
40
            {
 
41
                return new InvalidOperationException(Resource.DataGrid_ColumnCannotBeCollapsed);
 
42
            }
 
43
 
 
44
            public static InvalidOperationException ColumnCannotBeReassignedToDifferentDataGrid()
 
45
            {
 
46
                return new InvalidOperationException(Resource.DataGrid_ColumnCannotBeReassignedToDifferentDataGrid);
 
47
            }
 
48
 
 
49
            public static ArgumentException ColumnNotInThisDataGrid()
 
50
            {
 
51
                return new ArgumentException(Resource.DataGrid_ColumnNotInThisDataGrid);
 
52
            }
 
53
 
 
54
            public static InvalidOperationException CommitFailedCannotCompleteOperation()
 
55
            {
 
56
                return new InvalidOperationException(Resource.DataGrid_CommitFailedCannotCompleteOperation);
 
57
            }
 
58
 
 
59
            public static ArgumentException InvalidEnumValue(string value, string enumTypeName, string paramName)
 
60
            {
 
61
                return new ArgumentException(Format(Resource.DataGrid_InvalidEnumValue, value, enumTypeName), paramName);
 
62
            }
 
63
 
 
64
            public static ArgumentException InvalidRowElement(string paramName)
 
65
            {
 
66
                return new ArgumentException(Resource.DataGrid_InvalidRowElement, paramName);
 
67
            }
 
68
 
 
69
            public static ArgumentException ItemIsNotContainedInTheItemsSource(string paramName)
 
70
            {
 
71
                return new ArgumentException(Resource.DataGrid_ItemIsNotContainedInTheItemsSource, paramName);
 
72
            }
 
73
 
 
74
            public static InvalidOperationException ItemsSourceNullCannotCompleteOperation()
 
75
            {
 
76
                return new InvalidOperationException(Resource.DataGrid_ItemsSourceNullCannotCompleteOperation);
 
77
            }
 
78
 
 
79
            public static TypeInitializationException MissingTemplateForType(Type type)
 
80
            {
 
81
                return new TypeInitializationException(Format(Resource.DataGrid_MissingTemplateForType, type.FullName), null);
 
82
            }
 
83
 
 
84
            public static InvalidOperationException NoCurrentRow()
 
85
            {
 
86
                return new InvalidOperationException(Resource.DataGrid_NoCurrentRow);
 
87
            }
 
88
 
 
89
            public static InvalidOperationException NoOwningGrid(Type type)
 
90
            {
 
91
                return new InvalidOperationException(Format(Resource.DataGrid_NoOwningGrid, type.FullName));
 
92
            }
 
93
 
 
94
            public static InvalidOperationException UnderlyingPropertyIsReadOnly()
 
95
            {
 
96
                return new InvalidOperationException(Resource.DataGrid_UnderlyingPropertyIsReadOnly);
 
97
            }
 
98
 
 
99
            public static ArgumentNullException ValueCannotBeSetToNull(string paramName, string valueName)
 
100
            {
 
101
                return new ArgumentNullException(paramName, Format(Resource.DataGrid_ValueCannotBeSetToNull, valueName));
 
102
            }
 
103
 
 
104
            public static ArgumentException ValueIsNotAnInstanceOf(string paramName, Type type)
 
105
            {
 
106
                return new ArgumentException(paramName, Format(Resource.DataGrid_ValueIsNotAnInstanceOf, type.FullName));
 
107
            }
 
108
 
 
109
            public static ArgumentException ValueIsNotAnInstanceOfEitherOr(string paramName, Type type1, Type type2)
 
110
            {
 
111
                return new ArgumentException(paramName, Format(Resource.DataGrid_ValueIsNotAnInstanceOfEitherOr, type1.FullName, type2.FullName));
 
112
            }
 
113
 
 
114
            public static InvalidOperationException ValueIsReadOnly(string paramName)
 
115
            {
 
116
                return new InvalidOperationException(Format(Resource.DataGrid_ValueIsReadOnly, paramName));
 
117
            }
 
118
 
 
119
            public static ArgumentOutOfRangeException ValueMustBeBetween(string paramName, string valueName, object lowValue, bool lowInclusive, object highValue, bool highInclusive)
 
120
            {
 
121
                string message = null;
 
122
 
 
123
                if (lowInclusive && highInclusive)
 
124
                {
 
125
                    message = Resource.DataGrid_ValueMustBeGTEandLTE;
 
126
                }
 
127
                else if (lowInclusive && !highInclusive)
 
128
                {
 
129
                    message = Resource.DataGrid_ValueMustBeGTEandLT;
 
130
                }
 
131
                else if (!lowInclusive && highInclusive)
 
132
                {
 
133
                    message = Resource.DataGrid_ValueMustBeGTandLTE;
 
134
                }
 
135
                else
 
136
                {
 
137
                    message = Resource.DataGrid_ValueMustBeGTandLT;
 
138
                }
 
139
 
 
140
                return new ArgumentOutOfRangeException(paramName, Format(message, valueName, lowValue, highValue));
 
141
            }
 
142
 
 
143
            public static ArgumentOutOfRangeException ValueMustBeGreaterThanOrEqualTo(string paramName, string valueName, object value)
 
144
            {
 
145
                return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeGreaterThanOrEqualTo, valueName, value));
 
146
            }
 
147
 
 
148
            public static ArgumentOutOfRangeException ValueMustBeLessThanOrEqualTo(string paramName, string valueName, object value)
 
149
            {
 
150
                return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeLessThanOrEqualTo, valueName, value));
 
151
            }
 
152
 
 
153
            public static ArgumentOutOfRangeException ValueMustBeGreaterThan(string paramName, string valueName, object value)
 
154
            {
 
155
                return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeGreaterThan, valueName, value));
 
156
            }
 
157
 
 
158
            public static ArgumentOutOfRangeException ValueMustBeLessThan(string paramName, string valueName, object value)
 
159
            {
 
160
                return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeLessThan, valueName, value));
 
161
            }
 
162
 
 
163
        }
 
164
 
 
165
        public static class DataGridDataErrorEventArgs
 
166
        {
 
167
            public static ArgumentException CannotThrowNullException()
 
168
            {
 
169
                return new ArgumentException(Resource.DataGridDataErrorEventArgs_NullException);
 
170
            }
 
171
        }
 
172
 
 
173
        public static class DataGridRow
 
174
        {
 
175
            public static InvalidOperationException InvalidRowIndexCannotCompleteOperation()
 
176
            {
 
177
                return new InvalidOperationException(Resource.DataGridRow_InvalidRowIndexCannotCompleteOperation);
 
178
            }
 
179
        }
 
180
 
 
181
        public static class DataGridSelectedItemsCollection
 
182
        {
 
183
            public static InvalidOperationException CannotChangeSelectedItemsCollectionInSingleMode()
 
184
            {
 
185
                return new InvalidOperationException(Resource.DataGridSelectedItemsCollection_CannotChangeSelectedItemsCollectionInSingleMode);
 
186
            }
 
187
        }
 
188
 
 
189
        private static string Format(string formatString, params object[] args)
 
190
        {
 
191
            return String.Format(CultureInfo.CurrentCulture, formatString, args);
 
192
        }
 
193
    }
 
194
}