File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
mcs/class/System/System.Net.NetworkInformation Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ static void MaybeCreate ()
107
107
if ( networkChange != null )
108
108
return ;
109
109
110
+ if ( IsWindows )
111
+ throw new PlatformNotSupportedException ( "NetworkInformation.NetworkChange is not supported on the current platform." ) ;
110
112
try {
111
113
networkChange = new MacNetworkChange ( ) ;
112
114
} catch {
@@ -117,6 +119,21 @@ static void MaybeCreate ()
117
119
#endif // MONOTOUCH_WATCH
118
120
}
119
121
122
+ static bool IsWindows
123
+ {
124
+ get
125
+ {
126
+ PlatformID platform = Environment . OSVersion . Platform ;
127
+ if ( platform == PlatformID . Win32S ||
128
+ platform == PlatformID . Win32Windows ||
129
+ platform == PlatformID . Win32NT ||
130
+ platform == PlatformID . WinCE ) {
131
+ return true ;
132
+ }
133
+ return false ;
134
+ }
135
+ }
136
+
120
137
static void MaybeDispose ( )
121
138
{
122
139
if ( networkChange != null && networkChange . HasRegisteredEvents ) {
You can’t perform that action at this time.
0 commit comments